Esempio n. 1
0
func setSampleTime(m *models.PvInverterRunData, dataMap map[string]interface{}) {
	if sTime, ok := dataMap["SmplTime"].(uint64); ok {
		m.SmplTime = int64(sTime)

		hour, min, _ := time.Unix(m.SmplTime, 0).Clock()
		m.BatchOrder = int32(hour*12 + min/5 + 1)
		//fmt.Printf("SampleTime ---> BatchOrder:hour=%d, min=%d, batchOrder=%d\n", hour, min, m.BatchOrder)
	}
}
Esempio n. 2
0
func setRunTimeTotal(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_RunTimeTotal, dataMap); err == nil {
		if time, ok := v.(float64); ok {
			m.RunTimeTotal = time
		}
	}
}
Esempio n. 3
0
func setWorkStatus(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	var workStatus = "Normal"

	if v, err := utils.RunCalcUnit(fname, utils.Cmd_WorkStatus, dataMap); err == nil {
		if s, ok := v.(string); ok {
			m.WorkStatus = s
			if b := strings.Contains(s, STR_FAULT); !b {
				if b = strings.Contains(s, STR_OFF); !b {
					m.WorkStatus = workStatus
				}
			}
		} else {
			m.WorkStatus = workStatus
		}
	}
}
Esempio n. 4
0
func setFgrid(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_Fgrid, dataMap); err == nil {
		if grid, ok := v.(float64); ok {
			m.Fgrid = grid
		}
	}
}
Esempio n. 5
0
func setBatchOrder(m *models.PvInverterRunData, dataMap map[string]interface{}) {
	if order, ok := dataMap["BatchOrder"].(uint64); ok {
		m.BatchOrder = int32(order)
	}
}