Add simple one-sided co-sim example taking constant current over zmq - #537
Add simple one-sided co-sim example taking constant current over zmq#537PhilipFackler wants to merge 1 commit into
Conversation
c94431f to
5eef957
Compare
pelesh
left a comment
There was a problem hiding this comment.
It would be good to document code and add a README file with description of the cosimulation app and the example.
| SystemModelData<double, size_t> parseSystemModelData(const std::string& fileName) | ||
| { | ||
| auto stream = std::ifstream(fileName); | ||
| if (!stream) | ||
| { | ||
| std::stringstream ss; | ||
| ss << "Could not open file: " << fileName; | ||
| Log::error() << ss.str() << std::endl; | ||
| throw std::runtime_error(ss.str()); | ||
| } | ||
| return parseSystemModelData(stream); | ||
| } |
There was a problem hiding this comment.
Why is this function removed?
There was a problem hiding this comment.
It caused a compiler error for my app because it's redundant/ambiguous.
There was a problem hiding this comment.
I understand the issue here. I will use a workaround in this PR and create an issue for the change.
pelesh
left a comment
There was a problem hiding this comment.
Please document the code per developer guidelines. Also, please add a README file explaining what the co-sim application does.
If changes to the SystemModel class are needed that needs to be tracked in an issue. Modifying SystemModel is out of scope of this PR.
Description
See #469
Introduce a minimal example using zmq for communication between GridKit processes.
Proposed changes
This example duplicates the behavior of the
ThreeBusConstantSourceexample, but with theConstantSignalSourcecomponent removed and its behavior reproduced in the app (external to the system model) with currents being received over zmq from another app.Checklist
-Wall -Wpedantic -Wconversion -Wextra.Further comments
A lot of comments here. 😄 I have numbered them for reference in discussion.
ConstantSignalSourceexample.Ida::runSimulationrather than managing the stepping itself; this is questionable :), since we are intending to remove that.evaluateResidualComponentSignals. Extend it to make ports configurable...enabling the zmq exchange to be triggered when signals are read from ports.ConstantSignalSourcethat would use zmq to update its "constant" values.I'll add that in either of the "IOPorts" scenarios the co-simulation "manager" could be set up to exchange all necessary variables in one send/recv.