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) } }
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 } } }
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 } } }
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 } } }
func setBatchOrder(m *models.PvInverterRunData, dataMap map[string]interface{}) { if order, ok := dataMap["BatchOrder"].(uint64); ok { m.BatchOrder = int32(order) } }