Пример #1
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
		}
	}
}
Пример #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
		}
	}
}
Пример #3
0
func setEnergyDay(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_EnergyDay, dataMap); err == nil {
		if energy, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", energy)
			m.EnergyDay, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #4
0
func setEfficiency(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_Efficiency, dataMap); err == nil {
		if ef, ok := v.(float64); ok {
			s := fmt.Sprintf("%.1f", ef*100)
			m.Efficiency, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #5
0
func setACActivePowerTotal(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_ACActivePowerTotal, dataMap); err == nil {
		if power, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", power)
			m.AcActivePowerTotal, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #6
0
func setIacBalance(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_IacBalance, dataMap); err == nil {
		if iBlc, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", iBlc)
			m.IacBalance, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #7
0
func setAverVac(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_AverVac, dataMap); err == nil {
		if avgVac, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", avgVac)
			m.AverVac, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #8
0
func setGFCIResistorPV4(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_GFCIResistorPV4, dataMap); err == nil {
		if r, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", r)
			m.Pv4Resistor, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #9
0
func setVdcPV4(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_VdcPV4, dataMap); err == nil {
		if vdc, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", vdc)
			m.VdcPv4, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #10
0
func setInterTemperature(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_ITemp, dataMap); err == nil {
		if t, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", t)
			m.InternalTemperature, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #11
0
func setSPLPEnergy(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_SPLPEnergy, dataMap); err == nil {
		if simu, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", simu)
			//fmt.Printf("simu=%v, s=%s\n", simu, s)
			m.SimuKwh5Min, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #12
0
func setIacTotal(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_IacTotal, dataMap); err == nil {
		if iac, ok := v.(float64); ok {
			s := fmt.Sprintf("%.02f", iac)
			//fmt.Printf("iac=%v, siac=%v\n", iac, s)
			m.IacTotal, _ = strconv.ParseFloat(s, 64)
		}
	}
}
Пример #13
0
func getErrorMessage(m *models.PvInverterRunData, fname string, dataMap map[string]interface{}) string {
	if v, err := utils.RunCalcUnit(fname, utils.Cmd_ErrorMessage, dataMap); err == nil {
		if msg, ok := v.(string); ok {
			//s := fmt.Sprintf("%.02f", simu)
			//fmt.Printf("simu=%v, s=%s\n", simu, s)
			return msg
		}
	}

	return ""
}
Пример #14
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
		}
	}
}