Skip to content

Conversation

@PhilipFackler
Copy link
Collaborator

@PhilipFackler PhilipFackler commented Nov 14, 2025

Description

Capability for printing monitored variables during time iterations

Proposed changes

Let each bus and device specify variables to monitor based on *Data input. During Ida::runSimulation allow for monitoring output as well as user-defined step_callback.

Checklist

  • All tests pass.
  • Code compiles cleanly with flags -Wall -Wpedantic -Wconversion -Wextra.
  • The new code follows GridKit™ style guidelines.
  • There are unit tests for the new code.
  • The new code is documented.
  • The feature branch is rebased with respect to the target branch.
  • I have updated CHANGELOG.md to reflect the changes in this PR. If this is a minor PR that is part of a larger fix already included in the file, state so.

Further comments

I'm starting this as a draft because I need some feedback before I can consider it completed.

@pelesh pelesh requested review from superwhiskers and removed request for pelesh November 14, 2025 21:34
Copy link
Collaborator

@superwhiskers superwhiskers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pull request leaves casing of enums inconsistent in data structures. for instance, the newly added monitorable variables in busdata are all caps, inconsistent with enums in other files. this should be resolved prior to merge.

additionally, we should evaluate whether we are willing to use magic_enum to sidestep the requirement of a SIZE variant, something i worked around with it previously.

@PhilipFackler
Copy link
Collaborator Author

this pull request leaves casing of enums inconsistent in data structures. for instance, the newly added monitorable variables in busdata are all caps, inconsistent with enums in other files. this should be resolved prior to merge.

additionally, we should evaluate whether we are willing to use magic_enum to sidestep the requirement of a SIZE variant, something i worked around with it previously.

Both good points. I'll check the guidelines for enum member styles. If we want to make magic_enum a public dependency that would help with the implementation here a lot. Or we could install it as part of gridkit so users don't have to deal with that. What do people think? I implemented this treating it purely as a build dependency.

Copy link
Collaborator

@lukelowry lukelowry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than my one concern regardining output format, this is an invaluable PR. Labeled output data will accelerate verification for the 37/39 bus case and larger cases. Having this in the develop branch would be incredibly valuable right now.

@pelesh pelesh added the enhancement New feature or request label Nov 18, 2025
@pelesh
Copy link
Collaborator

pelesh commented Nov 18, 2025

this pull request leaves casing of enums inconsistent in data structures. for instance, the newly added monitorable variables in busdata are all caps, inconsistent with enums in other files. this should be resolved prior to merge.
additionally, we should evaluate whether we are willing to use magic_enum to sidestep the requirement of a SIZE variant, something i worked around with it previously.

Both good points. I'll check the guidelines for enum member styles. If we want to make magic_enum a public dependency that would help with the implementation here a lot. Or we could install it as part of gridkit so users don't have to deal with that. What do people think? I implemented this treating it purely as a build dependency.

The GridKit code outside the I/O parser should not depend on magic_enum. I would try to avoid it being GridKit library dependency. It should be available only in utilities for building GridKit apps.

@pelesh
Copy link
Collaborator

pelesh commented Nov 24, 2025

this pull request leaves casing of enums inconsistent in data structures. for instance, the newly added monitorable variables in busdata are all caps, inconsistent with enums in other files. this should be resolved prior to merge.
additionally, we should evaluate whether we are willing to use magic_enum to sidestep the requirement of a SIZE variant, something i worked around with it previously.

Both good points. I'll check the guidelines for enum member styles. If we want to make magic_enum a public dependency that would help with the implementation here a lot. Or we could install it as part of gridkit so users don't have to deal with that. What do people think? I implemented this treating it purely as a build dependency.

magic_enum is an external library over which we have little control. Making it required GridKit dependency is something I would prefer to avoid. I understand it's easier said than done, though.

@PhilipFackler
Copy link
Collaborator Author

Just so y'all know, I'm planning to finish up requested changes and get this updated tomorrow.

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch 3 times, most recently from 4a1097d to d3a86af Compare November 26, 2025 21:56
@PhilipFackler
Copy link
Collaborator Author

I have added the capability of choosing the output format(s) using the JSON input file. By default, it will print CSV style to the console. I included changes to ThreeBusBasic.json as an example of how to use this. It prints three files (in addition to the console). If you want to change the console style, you just add a format group without the file_name parameter. Let me know what you all think. I'll add documentation, etc... next week. Happy Thanksgiving!

@PhilipFackler
Copy link
Collaborator Author

Not sure why the consumer test is failing (it works locally for me). I'll have to dig into that later this week.

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch from bed5a07 to 3bdebf5 Compare December 15, 2025 16:34
@PhilipFackler PhilipFackler marked this pull request as ready for review December 15, 2025 17:22
Copy link
Collaborator

@pelesh pelesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More offline discussion is needed before this PR can be merged. Some issues to consider:

  • Conversion of strings to enums should ideally be in parser functions only. Moving them to component data structures is not an ideal design.
  • Setting monitored variables should be done in parser. I am not sure the current solution is sustainable.
  • Capitalization of enums should not be changed in this PR.
  • It is unclear what is the purpose of the VariableMonitorBase class.

@PhilipFackler
Copy link
Collaborator Author

Conversion of strings to enums should ideally be in parser functions only. Moving them to component data structures is not an ideal design.

@pelesh That IS done only in the parser. If you're referring to the enumLabel function, that is for printing enum values as labels in the monitor output.

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch from a0625be to 86a737f Compare December 17, 2025 20:36
Copy link
Collaborator

@superwhiskers superwhiskers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall the code quality looks good. i only have architectural questions that i would prefer be answered before we merge this.

@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch from f7f972c to b553868 Compare December 19, 2025 19:28
@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch from cd01a7c to cece7cf Compare December 19, 2025 19:32
@PhilipFackler PhilipFackler force-pushed the PhilipFackler/print-monitored-vars branch from 7b1d272 to 0479284 Compare December 19, 2025 20:49
@pelesh pelesh requested a review from superwhiskers December 19, 2025 23:27
Copy link
Collaborator

@lukelowry lukelowry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invaluable. Thank you @PhilipFackler ! This opens so many doors for case validation.

Any feedback of value from me will come after I use this feature to validate/debug the larger cases.

@pelesh pelesh merged commit df24ad0 into develop Dec 22, 2025
6 checks passed
@superwhiskers superwhiskers deleted the PhilipFackler/print-monitored-vars branch December 23, 2025 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants