Use ports for PhasorDynamics signal connectivity#440
Conversation
7b362b4 to
1faac07
Compare
superwhiskers
left a comment
There was a problem hiding this comment.
i'd recommend we make this one change. everything else seems fine. i have not attempted to compile or test the diff.
| /// Concept requiring an enum to have a `MAXIMUM` variant and that it have | ||
| /// the underlying type of `size_t`. This does not ensure the variant is | ||
| /// the actual maximum | ||
| template <typename T> | ||
| concept EnumHasMaximumValueAndIsSizeT = std::is_enum_v<T> | ||
| && std::is_same_v<std::underlying_type_t<T>, size_t> | ||
| && requires { T::MAXIMUM; }; |
There was a problem hiding this comment.
i think we should keep this concept. above, in the json parsing code, you rely upon the existence of a SIZE variant in the enums. just swap the T::MAXIMUM requirement for T::SIZE.
additionally, there's many cases in this diff where you don't have any ports, and just leave an empty enum for one of the input/output/terminal port enums. it may be beneficial to keep the NoVariables enum---perhaps renamed---for those cases. that's less important, though.
There was a problem hiding this comment.
Thank you for the feedback. Regarding your second comment about NoVariables: My rational was that some of these models can be implemented with or without internal variables (e.g. Branch and LoadZIP). I agree that having the model internal variables enum just contain SIZE is a bit useless, but it makes adding variables/ports easier and makes the model implementation more copy-and-paste-able.
What are your thoughts?
There was a problem hiding this comment.
i'm of the opinion that boilerplate exists to be minimized, so i don't view a copy-and-pasteable implementation to be a good thing. however, i can see how it could be useful for people unfamiliar with the codebase or c++ generally to be able to easily see how to add internal variables in their own model without cross-referencing more.
the former opinion is what leads me to suggest retaining a NoVariables-like placeholder. if you disagree with this stance, and want to make it simpler to copy-and-paste an implementation as a template wholesale, then go ahead with that. this was a minor concern anyway.
1faac07 to
01869ef
Compare
Description
This PR updates PhasorDynamics component wiring so signal nodes are associated with input/output ports instead of internal/external variable enums.
Closes #407
@PhilipFackler, what are your thoughts? Managed to do it with no
*.case.jsonchanges, which lets us do the INPUT_FORMAT changes and documentation with a few changes in code once we get to itProposed changes
"ports"format, but parse entries into the new internal maps.ComponentSignals,SystemModel, components, examples, and tests to use port enums for signal wiring.Checklist
-Wall -Wpedantic -Wconversion -Wextra.Further comments
I organized the commits so we can roll back if the scope is too big, but it was mechanical and straightforward after the main changes were in.