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

Correct UPS Load display #112

Merged
merged 4 commits into from Oct 20, 2023
Merged

Correct UPS Load display #112

merged 4 commits into from Oct 20, 2023

Conversation

gbakeman
Copy link
Contributor

The UPS Load dial presents conflicting information, depending on the UPS being monitored. Typically, the load percentage and real value do not line up with what the maximum possible load is. This PR will aim to correct this by:

  • Disabling post-initialization modification of the UPS Load dial besides setting displayed values. It's a gauge of a percentage, which is always between 0 and 100 percent so there's no need to modify it outside of the Designer (unless the user wants to change dial tick settings - open to discussion)
  • Similarly remove references to the MinUPSLoad and MaxUPSLoad calibration settings since those were representing the percentage.
  • Redo how WinNUT determines Load percentage and output power;
    • Output power can be directly determined with ups.realpower or ups.realpower.nominal
      • If those options aren't available, calculate the max possible power by multiplying input.current.nominal * input.voltage.nominal and 0.8 to account for loss. To find the current output power, multiply the calculated max by ups.load (the percentage of max load)
      • Don't plan on having a fallback at this time. May need to allow user-specified max value in the future.
    • Load percentage can be directly determined with ups.load
      • This variable seems to be common enough that there's no reason to account for it missing. May need to add an alternative method later.

Closes #41
Related to #24, #69, #74, #100, #101 and #102

- Reorganized some lines in UPS_Device
- Made Socket object access private, WinNUT now gets connection status from UPS_Device only.
- Began implementation of max load calculation algorithm
- Relocated static UPS device info display logic out of variable update function and into UPS initialization function.
- Also cleaned up some unused code in WinNUT.vb.
Effectively disable any post-initialization of the Load dial, since it represents a percentage which will always be between 0 and 100 percent. This removes the UPS Load fields from the Calibration tab of the Prefs GUI, and also removes any references to the `MinUPSLoad` and `MaxUPSLoad` configuration settings.
- Removed the binary Icon data from Prefs resx
@gbakeman gbakeman added bug Something isn't working enhancement New feature or request labels Oct 18, 2023
@gbakeman gbakeman added this to the 2.2 Stable Release milestone Oct 18, 2023
@gbakeman gbakeman self-assigned this Oct 18, 2023
@gbakeman gbakeman linked an issue Oct 18, 2023 that may be closed by this pull request
The node tree is created with the root node having the name of the UPS. Since UPS variables do not have the UPS name at the beginning, the UPS name had to be stripped from the node's fullpath. The Replace function was previously unlimited, which caused it to strip out the UPS name wherever it appeared in the node path. If a UPS's name was 'ups', then any variable in a 'ups' group would become unreadable. The Replace function now only removes the UPS name from the beginning of the full path.
Replacing old power calculation methods with new system. On connection, WinNUT determines what power/load data variables are available and sets an enum variable accordingly. If no such method is available, a warning is logged to the output, and future attempts to get the power value will return with 0. On every update, the appropriate method is selected from the enum variable and the calculation is returned. The hope is that this covers the majority of UPS devices.
- Also cleaned up or rearranged code in the UPS_Device class.
@gbakeman gbakeman merged commit 788cdd3 into Dev-2.2 Oct 20, 2023
1 check passed
@gbakeman gbakeman deleted the 41-fix-power-display branch October 20, 2023 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UPS Power out showing wrong Wattage
1 participant