-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix line overload color computation #109
Conversation
Signed-off-by: jamal-khey <myjamal89@gmail.com>
06401cb
to
0d575af
Compare
@@ -61,9 +61,10 @@ export function getLineLoadingZoneOfSide(limit, intensity, lineFlowAlertThreshol | |||
return LineLoadingZone.UNKNOWN; | |||
} else { | |||
let threshold = (lineFlowAlertThreshold * limit) / 100; | |||
if (intensity > 0 && intensity < threshold) { | |||
const absoluteIntensity = Math.abs(intensity); | |||
if (absoluteIntensity > 0 && absoluteIntensity < threshold) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolute intensity is always > 0 as we checked if intensity === 0 before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Signed-off-by: jamal-khey <myjamal89@gmail.com>
Quality Gate passedIssues Measures |
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
This PR fixes the function that computes the color of lines based on their overload status.
What kind of change does this PR introduce?
Bug fix: Corrects line coloring calculation by considering absolute values of line intensities
What is the current behavior?
The current implementation uses raw intensity values to determine line loading zones, which causes incorrect coloring when the intensity is negative. Negative values are being treated as overload when they should be treated based on their magnitude regardless of direction.
What is the new behavior (if this is a feature change)?
The fix uses the absolute value of the intensity (Math.abs(intensity)) when comparing against thresholds. This ensures that line loading zones are correctly calculated regardless of the current flow direction. For example, an intensity of -900A on a line with a 1000A limit will now properly show as being close to overload, whereas before it might have been incorrectly shown as safe.
Does this PR introduce a breaking change or deprecate an API?
Other information:
This fix ensures consistent line coloring behavior regardless of power flow direction
The change affects the visual representation only and does not impact any underlying calculations or data