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
85b0e59 to
2d95f6c
Compare
2d95f6c to
c385e36
Compare
|
As far as the naming conventions go, I would suggest using either "port" or "terminal" for the connectors but not a mixture of the two. The way I see it, we have three types of terminals (ports): bus, signal out and signal in. I also suggest when making a wholesale name changes to have a purely name changing pull request to separate it from any design changes in the code. This makes reviewing PRs and tracking back changes easier. |
Maybe this should be a question for users? I don't know power systems, but we do treat the bus connection differently. If it is conceptually different from signal connections, then it would make sense (to me) to call it something else to distinguish the two. But at the end of the day, what makes the most intuitive sense for users is what matters in this case. |
8966e77 to
f213ffa
Compare
|
@pelesh @PhilipFackler This branch has been updated to only have the naming changes, now following the pattern:
Ready for review. mostly mechanical change |
|
@lukelowry Just double-checking. I thought from our meeting, it was decided to use the word ports for all of them:
It appears we did not write it down, though. :) @pelesh do you remember? |
We agreed to have
and if there is a common name (i.e. base class) needed that would be |
|
Alright, sorry about my confusion. |
|
By looking at the implementation, the three are very different, so it doesn't seem we need |
PhilipFackler
left a comment
There was a problem hiding this comment.
Looks good. Tested locally.
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.