andes icon indicating copy to clipboard operation
andes copied to clipboard

Logging message enhancement

Open jinningwang opened this issue 8 months ago • 8 comments

  • Skip InitChecker logging and limiter adjust for offline devices.
  • When reading files, issue a warning only once per model for the following cases: 1) a NumParam value does not meet the expected criteria, or 2) unused data is detected.

jinningwang avatar Apr 28 '25 15:04 jinningwang

I'm not sure why it's better to show the warning message only once for nonconforming inputs.

In the input stage, when we add one device, GEN 1 with inertia H = 0, for example, this should trigger one message so that the user will be able to identify and fix it.

When the second device GEN 2 with H = 0 is added, shouldn't this message be displayed again?

cuihantao avatar May 02 '25 01:05 cuihantao

A useful enhancement would be to show which device violated the property constraint. I didn't do it, because in order to do it, one parameter needs to access its owner and then access the idx field, which looked messy to me. Maybe we can revisit it.

cuihantao avatar May 02 '25 01:05 cuihantao

I add a notebook to explain this, https://github.com/CURENT/demo/blob/master/demo/logging/logging.ipynb:

  • Property violation and auto correction is triggered ONLY in file loading stage, for PSS/E and JSON files.
  • Property violation and auto correction is not triggered for XLSX file.

It seems that when add a model manually after file loading, the property violation is not triggered.

Indeed this is a very marginal feature, but I can handle this if helpful "which device violated the property constraint"

jinningwang avatar May 02 '25 03:05 jinningwang

In this example, in Input 8, I think a warning is desired, because it will immediately alert the user to input issues. Suppressing the message creates the possibility of omission. There should be a warning to each violation, although I agree the information should be more rich. Regards, Hantao Cui

On Thu, May 1, 2025, 11:06 PM Jinning Wang @.***> wrote:

jinningwang left a comment (CURENT/andes#606) https://github.com/CURENT/andes/pull/606#issuecomment-2846214936

I add a notebook to explain this, https://github.com/CURENT/demo/blob/master/demo/logging/logging.ipynb:

  • Property violation and auto correction is triggered ONLY in file loading stage, for PSS/E and JSON files.
  • Property violation and auto correction is not triggered for XLSX file.

It seems that when add a model manually after file loading, the property violation is not triggered.

Indeed this is a very marginal feature, but I can handle this if helpful "which device violated the property constraint"

— Reply to this email directly, view it on GitHub https://github.com/CURENT/andes/pull/606#issuecomment-2846214936, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSNZA65JPFJOADPJNZF6NL24LOKRAVCNFSM6AAAAAB4AX3NL6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBWGIYTIOJTGY . You are receiving this because you commented.Message ID: @.***>

cuihantao avatar May 02 '25 03:05 cuihantao

Thank you for your comment. I agree with your opinion and plan to implement the following enhancements:

  1. Individual Check by Default: This will perform a check on a single device input by default. When reading from a file, this will be turned off, and a model-level check will be conducted instead. Additionally, when users add new devices one by one, this check should be triggered automatically when calling NumParam.add
  2. Model-Level Check: This will perform a check on all devices within a model, identifying which devices have violations and providing the idxes. This one should be triggered automatically after adding all devices from case file.

Change 1 involves System.add, ModelData.add, and NumParam.add

Change 2 involves the three file parsing modules.

Let me know if I miss anything.

jinningwang avatar May 05 '25 18:05 jinningwang

When reading from a file, this will be turned off, and a model-level check will be conducted instead

Turning off the warning is not a great idea because some warnings are due to user omissions that need attention. The proposed change falls under the category of "fail silently" and is generally advised against. If the goal is to make the program less verbose, we can store all the warning messages somewhere and output a message at the end like this:

```There are warnings during the data parsing. To see all the warnings, do system.show_warnings()

(you can decide where to place the function.)

In that output, then provide more information regarding which parameter of which device trigger the warning, and the exact reason. 

Let me know if this makes sense and if you'd like to proceed.

cuihantao avatar May 11 '25 20:05 cuihantao

Agree with you, but we might skip this feature for now.

jinningwang avatar May 12 '25 14:05 jinningwang

Now in this PR I only skip the InitChecker logging and limiter adjust for offline devices.

jinningwang avatar May 12 '25 14:05 jinningwang