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 6 commits 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.
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.
5eef957 to
139dc62
Compare
nkoukpaizan
left a comment
There was a problem hiding this comment.
I have a few requests for better documentation and (sparse) diagnostic messages. Otherwise looks good.
139dc62 to
0b930a2
Compare
Co-authored-by: superwhiskers <whiskerdev@protonmail.com>
superwhiskers
left a comment
There was a problem hiding this comment.
just one more comment and this should be good to go. runs fine on my machine
| ./CoSimServer & | ||
|
|
||
| ./CoSimClient |
There was a problem hiding this comment.
one more comment in this file, we should not expect PWD to contain these files. i think it would be an improvement to:
- copy this file to the
build/directory - change the current working directory to the directory containing the file (retrieved using
dirname(1)overrealpath(1)over$0) - then do
./CoSimServer,./CoSimClient
or do COSIM_DIRECTORY=$(dirname $(realpath $0)) and then ${COSIM_DIRECTORY}/CoSimServer, etc. either works
There was a problem hiding this comment.
alternatively, you could substitute in the build/... directory using cmake. your choice
There was a problem hiding this comment.
I added this script as an easy way to run both apps together in the build directory. I'm thinking now that it might be better if it were removed altogether. When the time comes for a full-fledged co-simulation application, there should be a discussion about how users may best launch it. What do you think?
There was a problem hiding this comment.
the way i would probably go about doing it is to manually launch a bunch of workers on the hardware you would like to run a simulation on, then have a "frontend" program that is configured with a list of addresses to workers that submits a job to the worker services.
alternatively, perhaps one of these workers is delegated a "leader" and maintains a list of all of the details of a job or something like that and only serves as a way for other workers to retrieve parts of a job to simulate. this would be the only worker the frontend needs to connect to as it could be polled by other workers for more work to do.
maybe this doesn't answer your question, but this is my first thought as to how this could be launched and how it could operate. maybe the direction you were going in was different.
There was a problem hiding this comment.
Oh, yes. 😄 My question was more "should we remove this for now?". But these are definitely interesting ideas for the (future) discussion I was anticipating.
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.