Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecomode_addon-2 #2684

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions data/cmdvartab
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ VARDESC input.transfer.low.max "greatest settable low voltage transfer point (V)
VARDESC input.transfer.high.min "smallest settable high voltage transfer point (V)"
VARDESC input.transfer.high.max "greatest settable high voltage transfer point (V)"
VARDESC input.eco.switchable "Input High Efficiency (aka ECO) mode switch"
VARDESC input.transfer.forced "Input forced transfer modes enable/disable"
VARDESC input.bypass.switch.on "Put the UPS in bypass mode"
VARDESC input.bypass.switch.off "Take the UPS out of bypass mode"
VARDESC input.transfer.bypass.forced "Input forced auto Bypass switch (on/off) transfer modes (enabled or disabled)"
VARDESC input.transfer.bypass.overload "Rule for auto transfer on Bypass when overload (enabled or disabled)"
VARDESC input.transfer.bypass.outlimits "Rule for auto transfer on Bypass when out of tolerance (enabled or disabled)"
VARDESC input.bypass.switchable "Input auto transfer on Bypass when overload or out of tolerance (enabled or disabled)"
VARDESC input.bypass.switch.on "Put the UPS in Bypass mode"
VARDESC input.bypass.switch.off "Take the UPS out of Bypass mode"
VARDESC input.sensitivity "Input power sensitivity"
VARDESC input.quality "Input power quality"
VARDESC input.current "Input current (A)"
Expand Down Expand Up @@ -234,8 +237,8 @@ CMDDESC test.battery.stop "Stop the battery test"
CMDDESC test.system.start "Start a system test"
CMDDESC calibrate.start "Start run time calibration"
CMDDESC calibrate.stop "Stop run time calibration"
CMDDESC bypass.start "Put the UPS in bypass mode"
CMDDESC bypass.stop "Take the UPS out of bypass mode"
CMDDESC bypass.start "Put the UPS in Bypass mode"
CMDDESC bypass.stop "Take the UPS out of Bypass mode"
CMDDESC ecomode.enable "Put UPS in High Efficiency (aka ECO) mode"
CMDDESC ecomode.disable "Take the UPS out of High Efficiency (aka ECO) mode"
CMDDESC essmode.enable "Put UPS in Energy Saver System (aka ESS) mode"
Expand Down
21 changes: 15 additions & 6 deletions docs/nut-names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,23 @@ input: Incoming line/power information
transfer point (V) | 264
| input.transfer.frequency.bypass.range | Frequency range Bypass transfer
point (percent of nominal Hz) | 10
| input.transfer.frequency.eco.range | Frequency range ECO transfer
| input.transfer.frequency.eco.range | Frequency range ECO transfer
point (percent of nominal Hz) | 5
| input.transfer.hysteresis | Threshold of switching protection modes,
voltage transfer point (V) | 10
| input.transfer.forced | Input forced transfer modes
| input.transfer.bypass.forced | Input forced auto Bypass switch
(on/off) transfer modes
(enabled or disabled) | enabled
| input.bypass.switch.on | Put the UPS in bypass mode | on
| input.bypass.switch.off | Take the UPS out of bypass mode | disabled
| input.transfer.bypass.overload | Rule for auto transfer on Bypass when
overload (enabled or disabled) | enabled
| input.transfer.bypass.outlimits | Rule for auto transfer on Bypass when
out of tolerance (enabled or disabled)
| enabled
| input.bypass.switchable | Input auto transfer on Bypass when overload
or out of tolerance (enabled or disabled)
| enabled
| input.bypass.switch.on | Put the UPS in Bypass mode | on
| input.bypass.switch.off | Take the UPS out of Bypass mode | disabled
| input.load | Load on (ePDU) input (percent
of full) | 25
| input.realpower | Current sum value of all (ePDU)
Expand Down Expand Up @@ -871,8 +880,8 @@ Instant commands
| test.system.start | Start a system test
| calibrate.start | Start runtime calibration
| calibrate.stop | Stop runtime calibration
| bypass.start | Put the UPS in bypass mode
| bypass.stop | Take the UPS out of bypass mode
| bypass.start | Put the UPS in Bypass mode
| bypass.stop | Take the UPS out of Bypass mode
| ecomode.enable | Put UPS in High Efficiency (aka ECO) mode
| ecomode.disable | Take the UPS out of High Efficiency (aka ECO) mode
| essmode.enable | Put UPS in Energy Saver System (aka ESS) mode
Expand Down
49 changes: 32 additions & 17 deletions drivers/mge-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,15 +769,22 @@ static const char *eaton_input_eco_mode_check_range(double value)
) {
return "ECO"; /* Enter Eco mode */
} else {
/* Condensed debug messages for out of range voltage and frequency */
if (bypass_voltage < eco_low || bypass_voltage > eco_high) {
upsdebugx(1, "Bypass voltage out of transfer ECO limits: %.1f V", bypass_voltage);
}
if (bypass_frequency < lower_frequency_limit || bypass_frequency > upper_frequency_limit) {
upsdebugx(1, "Bypass frequency out of transfer ECO limits: %.1f Hz", bypass_frequency);
}
return NULL; /* Do not enter Eco mode */
}
}

/* High Efficiency (aka ECO) mode */
static info_lkp_t eaton_input_mode_info[] = {
/* High Efficiency (aka ECO) mode, Energy Saver System (aka ESS) mode makes sense for UPS like (93PM G2, 9395P) */
static info_lkp_t eaton_input_eco_mode_on_off_info[] = {
{ 0, "normal", NULL, NULL },
{ 1, "ECO", eaton_input_eco_mode_check_range, NULL }, /* NOTE: "ecomode" = checked and working fine */
{ 2, "ESS", NULL, NULL }, /* Energy Saver System, makes sense for UPS that implements this mode (93PM G2, 9395P) */
{ 1, "ECO", eaton_input_eco_mode_check_range, NULL }, /* NOTE: "ECO" = tested on 9E model and working fine */
{ 2, "ESS", NULL, NULL },
{ 0, NULL, NULL, NULL }
};

Expand Down Expand Up @@ -853,6 +860,13 @@ static const char *eaton_input_bypass_check_range(double value)
) {
return "on"; /* Enter bypass mode */
} else {
/* Condensed debug messages for out of range voltage and frequency */
if (bypass_voltage < bypass_low || bypass_voltage > bypass_high) {
upsdebugx(1, "Bypass voltage out of transfer bypass limits: %.1f V", bypass_voltage);
}
if (bypass_frequency < lower_frequency_limit || bypass_frequency > upper_frequency_limit) {
upsdebugx(1, "Bypass frequency out of transfer bypass limits: %.1f Hz", bypass_frequency);
}
return NULL; /* Do not enter bypass mode */
}
}
Expand All @@ -864,7 +878,7 @@ static info_lkp_t eaton_input_bypass_mode_on_info[] = {
{ 0, NULL, NULL, NULL }
};

/* Automatic Bypass mode Off */
/* Automatic Bypass mode off (switch on inverter) */
static info_lkp_t eaton_input_bypass_mode_off_info[] = {
{ 0, "disabled", NULL, NULL },
{ 1, "off", NULL, NULL },
Expand Down Expand Up @@ -1563,8 +1577,7 @@ static hid_info_t mge_hid2nut[] =
{ "BOOL", 0, 0, "UPS.PowerConverter.Input.[2].PresentStatus.Used", NULL, NULL, 0, bypass_auto_info }, /* Automatic bypass */
/* NOTE: entry [3] is above as mge_onbatt_info */
{ "BOOL", 0, 0, "UPS.PowerConverter.Input.[4].PresentStatus.Used", NULL, NULL, 0, bypass_manual_info }, /* Manual bypass */
/* NOTE: needs to be tested */
{ "BOOL", 0, 0, "UPS.PowerConverter.Input.[5].PresentStatus.Used", NULL, NULL, 0, eco_mode_info }, /* ECO/HE Mode */
{ "BOOL", 0, 0, "UPS.PowerConverter.Input.[5].PresentStatus.Used", NULL, NULL, 0, eco_mode_info }, /* ECO(HE), ESS Mode */
{ "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FanFailure", NULL, NULL, 0, fanfail_info },
{ "BOOL", 0, 0, "UPS.BatterySystem.Battery.PresentStatus.Present", NULL, NULL, 0, nobattery_info },
{ "BOOL", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.InternalFailure", NULL, NULL, 0, chargerfail_info },
Expand Down Expand Up @@ -1616,8 +1629,9 @@ static hid_info_t mge_hid2nut[] =
{ "input.transfer.frequency.bypass.range", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.FrequencyRangeBypassTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL },
{ "input.transfer.frequency.eco.range", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.FrequencyRangeEcoTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL },
{ "input.transfer.hysteresis", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.HysteresisVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL },
/* input.transfer.forced = 1 needs for Bypass Switch On/Off */
{ "input.transfer.forced", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].ForcedTransferEnable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_enable_disable_info },
{ "input.transfer.bypass.forced", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].ForcedTransferEnable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_enable_disable_info },
{ "input.transfer.bypass.overload", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].OverloadTransferEnable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_enable_disable_info },
{ "input.transfer.bypass.outlimits", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].OutOfToleranceTransferEnable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_enable_disable_info },
{ "input.transfer.trim.high", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.HighVoltageBuckTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL },
{ "input.sensitivity", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerConverter.Output.SensitivityMode", NULL, "%s", HU_FLAG_SEMI_STATIC, mge_sensitivity_info },
{ "input.voltage.extended", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.ExtendedVoltageMode", NULL, "%s", HU_FLAG_SEMI_STATIC, yes_no_info },
Expand All @@ -1640,15 +1654,16 @@ static hid_info_t mge_hid2nut[] =
{ "input.bypass.frequency", 0, 0, "UPS.PowerConverter.Input.[2].Frequency", NULL, "%.1f", 0, NULL },
{ "input.bypass.frequency.nominal", 0, 0, "UPS.Flow.[2].ConfigFrequency", NULL, "%.0f", HU_FLAG_STATIC, NULL },

/* ECO(HE) Mode switch */
{ "input.eco.switchable", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[5].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_mode_info },
/* ECO(HE), ESS Mode switch, to use when 'input.bypass.switch.on' is on */
{ "input.eco.switchable", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[5].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_eco_mode_on_off_info },

/* Auto Bypass Mode on/off */
/* needs check this variable, maybe "Bypass switch ability" like Qualify bypass */
/* { "input.bypass.switchable", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_bypass_mode_info }, */
/* Auto Bypass Mode on/off, to use when 'input.transfer.bypass.forced' is enabled */
{ "input.bypass.switch.on", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_bypass_mode_on_info },
{ "input.bypass.switch.off", ST_FLAG_RW | ST_FLAG_STRING, 12, "UPS.PowerConverter.Input.[2].SwitchOffControl", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_input_bypass_mode_off_info },

/* Transfer on automatic Bypass switch with rules 'input.transfer.bypass.overload' and 'input.transfer.bypass.outlimits' */
{ "input.bypass.switchable", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.PowerConverter.Input.[2].Switchable", NULL, "%.0f", HU_FLAG_SEMI_STATIC, eaton_enable_disable_info },

/* Output page */
{ "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL },
{ "output.L1-N.voltage", 0, 0, "UPS.PowerConverter.Output.Phase.[1].Voltage", NULL, "%.1f", 0, NULL },
Expand Down Expand Up @@ -1753,13 +1768,13 @@ static hid_info_t mge_hid2nut[] =
{ "outlet.2.load.off", 0, 0, "UPS.OutletSystem.Outlet.[3].DelayBeforeShutdown", NULL, "0", HU_TYPE_CMD, NULL },
{ "outlet.2.load.on", 0, 0, "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup", NULL, "0", HU_TYPE_CMD, NULL },

/* Command to switch ECO Mode */
/* Command to switch ECO(HE), ESS Mode */
{ "ecomode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, NULL },
{ "ecomode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_mode_info },
{ "ecomode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "1", HU_TYPE_CMD, eaton_input_eco_mode_on_off_info },
{ "essmode.enable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "2", HU_TYPE_CMD, NULL },
{ "essmode.disable", 0, 0, "UPS.PowerConverter.Input.[5].Switchable", NULL, "0", HU_TYPE_CMD, NULL },

/* Command to switch Automatic Bypass Mode On/Off */
/* Command to switch Automatic Bypass Mode on/off */
{ "bypass.start", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOnControl", NULL, "1", HU_TYPE_CMD, eaton_input_bypass_mode_on_info },
{ "bypass.stop", 0, 0, "UPS.PowerConverter.Input.[2].SwitchOffControl", NULL, "1", HU_TYPE_CMD, NULL },

Expand Down
10 changes: 7 additions & 3 deletions drivers/usbhid-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ static status_lkp_t status_info[] = {
{ "bypassauto", STATUS(BYPASSAUTO) },
{ "bypassman", STATUS(BYPASSMAN) },
{ "ecomode", STATUS(ECOMODE) },
{ "essmode", STATUS(ESSMODE) },
{ "off", STATUS(OFF) },
{ "cal", STATUS(CALIB) },
{ "overheat", STATUS(OVERHEAT) },
Expand Down Expand Up @@ -387,7 +388,7 @@ info_lkp_t bypass_manual_info[] = {
info_lkp_t eco_mode_info[] = {
{ 0, "normal", NULL, NULL },
{ 1, "ecomode", NULL, NULL },
{ 2, "ESS", NULL, NULL }, /* makes sense for UPS that implements this mode */
{ 2, "essmode", NULL, NULL },
{ 0, NULL, NULL, NULL }
};
/* note: this value is reverted (0=set, 1=not set). We report "being
Expand Down Expand Up @@ -2136,7 +2137,7 @@ static void ups_alarm_set(void)
}
/*if (ups_status & STATUS(ECOMODE)) {
alarm_set("ECO(HE) mode!");
}*/ /* disable alarm for eco as we dont want raise alarm ? */
}*/ /* disable alarm for eco as we dont want raise alarm ? */
}

/* Return the current value of ups_status */
Expand Down Expand Up @@ -2444,7 +2445,10 @@ static void ups_status_set(void)
status_set("BYPASS"); /* on bypass */
}
if (ups_status & STATUS(ECOMODE)) {
status_set("ECO"); /* on ECO Mode */
status_set("ECO"); /* on ECO(HE) Mode */
}
if (ups_status & STATUS(ESSMODE)) {
status_set("ESS"); /* on ESS Mode */
}
if (ups_status & STATUS(OFF)) {
status_set("OFF"); /* ups is off */
Expand Down
1 change: 1 addition & 0 deletions drivers/usbhid-ups.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ typedef enum {
BYPASSAUTO, /* on automatic bypass */
BYPASSMAN, /* on manual/service bypass */
ECOMODE, /* High Efficiency (aka ECO Mode) */
ESSMODE, /* Energy Saver System (aka ESS Mode) */
OFF, /* ups is off */
CALIB, /* calibration */
OVERHEAT, /* overheat; Belkin, TrippLite */
Expand Down