本文整理汇总了Golang中solarzoom/utils.RunCalcUnit函数的典型用法代码示例。如果您正苦于以下问题:Golang RunCalcUnit函数的具体用法?Golang RunCalcUnit怎么用?Golang RunCalcUnit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RunCalcUnit函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: setFgrid
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: setRunTimeTotal
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: setEnergyDay
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: setEfficiency
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: setACActivePowerTotal
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: setIacBalance
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: setAverVac
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: setGFCIResistorPV4
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: setVdcPV4
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: setInterTemperature
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: setSPLPEnergy
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: setIacTotal
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: getErrorMessage
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: setWorkStatus
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
}
}
}