sogno-platform/dpsim

Restructure and test VILLAS examples

Closed this issue · 2 comments

All villas related examples should be located in examples/villas and included in the tests if possible.
Examples using old interface can be moved to a villas-deprecated folder.

Focus for the examples should be on:

  • MQTT
  • simple circuit with import + export
  • CIGRE-MV with node voltage export
  • new villas interface
JTS22 commented

Overview over which Villas examples actually work (tested on the reorganization-Branch (PR #94)):

Python / Jupyter Examples

  • dpsim-file.py: Works without any interaction
  • dpsim-mqtt.py: Works, but explicitly waits for input data from MQTT
  • dpsim-mqtt-import-export.py: Works, but does not wait for input data from MQTT
  • dpsim-mqtt-import-export-MIMO.py: Segfaults after about 3 seconds
  • shmem-distributed-reference.py: Works (but also does not use any interfaces, as intended)
  • shmem-distributed-villas.py: Runs til the end, but produces an error when stopping villas. All log files remain empty, so no correct results are written:
    Opening shared memory interface failed (ret=-8): No such file or directory
    villas-node: /tmp/villasnode/lib/super_node.cpp:436: villas::node::SuperNode::~SuperNode(): Assertion `state ==     State::INITIALIZED || state == State::PARSED || state == State::CHECKED || state == State::STOPPED || state ==   State::PREPARED' failed.
    Traceback (most recent call last):
    File "/dpsim/examples/villas/shmem-distributed-villas.py", line 170, in <module>
      p_villas.join()
    
  • test_shmem_cigre_mv_pf_profiles.py: Starts up VillasNode and then immediately segfaults
  • test_shmem_distributed_direct.py: Uses the old dpsim-Python interface and therefore does not run at all
  • test_shmem_import_export.py: Starts up and segfaults after about a second
  • ShmemExample.ipynb: The first cell runs but finishes with an error, the following cell cannot find the required log files:
    12:54:52 info node             This is VILLASnode v0.11.0-b94746e-release (built on Jul  5 2022, 15:08:48)
    12:54:52 info signals          Initialize subsystem
    12:54:52 info config           Reading configuration from local file: /tmp/tmp.pCdHd59j7J
    12:54:52 info memory           Initialize memory sub-system: #hugepages=100
    12:54:52 warn memory:mmap      Running in an unprivileged environment. Hugepages are not used!
    12:54:52 warn memory           Running in an unprivileged environment. Memory is not locked to RAM!
    12:54:52 info kernel:rt        Initialize sub-system
    12:54:52 warn kernel:rt        We recommend to use an PREEMPT_RT patched kernel!
    12:54:52 warn kernel:rt        You might want to use the 'priority' setting to increase 's process priority
    12:54:52 warn kernel:rt        You might want to use the 'affinity' setting to pin  to dedicate CPU cores
    12:54:52 info node:shmem       Initialized node type which is used by 1 nodes
    12:54:52 info node:file        Initialized node type which is used by 2 nodes
    12:54:52 info api              Starting sub-system
    12:54:52 info web              Starting sub-system
    12:54:52 info api              Started worker
    12:54:52  err lws              ERROR on binding fd 14 to port 80 (-1 98)
    12:54:52  err lws              init server failed
    12:54:52 warn web              Failed to setup vhost. Trying another port: 81
    12:54:52  err lws              ERROR on binding fd 14 to port 81 (-1 98)
    12:54:52  err lws              init server failed
    12:54:52 warn web              Failed to setup vhost. Trying another port: 82
    12:54:52 info web              Started worker
    Error while terminating subprocess (pid=83557):
    
  • ShmemDistributedDirect.ipynb: Relative paths are wrong so the first cell does not run
  • cigre-mv-pf-profiles-shmem.ipynb: Simulation setup works, but the kernel crashes on sim.run()

Cpp Examples

  • FileExample.cpp: Starts up then throws a std::exception without any further description
  • MqttExample.cpp: Works, but explicitly waits for input data from MQTT
  • ShmemExample.cpp Only starts up when run on its own, but then awaits some input. When started via configs/start_ShmemExample.sh, it runs forever without producing any useful logs, outputting an error on KeyboardInterrupt:
    13:16:39  err node             Opening shared memory interface failed (ret=-8): No such file or directory
    villas-node: /tmp/villasnode/lib/super_node.cpp:436: villas::node::SuperNode::~SuperNode(): Assertion `state ==   State::INITIALIZED || state == State::PARSED || state == State::CHECKED || state == State::STOPPED || state ==   State::PREPARED' failed.
    13:16:39  err node             Opening shared memory interface failed (ret=-8): No such file or directory
    villas-node: /tmp/villasnode/lib/super_node.cpp:436: villas::node::SuperNode::~SuperNode(): Assertion `state == State::INITIALIZED || state == State::PARSED || state == State::CHECKED || state == State::STOPPED || state == State::PREPARED' failed.
    configs/start_ShmemExample.sh: line 69: 108105 Aborted                 (core dumped) villas-node ${CONFIG}
    
  • Shmem_CIGRE_MV_PowerFlowTest_LoadProfiles.cpp: Immediately crashes with FileNotFound Error
  • Shmem_CIGRE_MV_PowerFlowTest.cpp: Immediately crashes with FileNotFound Error
  • Shmem_WSCC-9bus_Ctrl.cpp: Immediately crashes with FileNotFound Error
  • Shmem_WSCC-9bus_CtrlDist.cpp: Ends immediately with no output whatsoever
  • Shmem_WSCC-9bus.cpp: Immediately crashes with FileNotFound Error
  • ShmemControllableFiltSource.cpp: Immediately crashes with a CPS::TypeException and no further information
  • ShmemControllableSource.cpp: Opens the interface, then immediately segfaults
  • ShmemDistributedDirect.cpp: Segfaults immediately for individual runs as well as for the start via the configs/start_ShmemDistributedDirect.sh script.
  • ShmemDistributedReference.cpp: Works (but also does not use any interfaces, as intended)
  • ShmemDistributedVillas.cpp: Segfaults immediately for both inputs 0 and 1
  • ShmemExample.cpp: Segfaults immediately

Summary

4/9 Python, 0/3 Jupyter, and 2/14 Cpp Examples actually work the way they are supposed to (and two of the working ones do not even use the Villas interface).

I think we might want to close due to:

  • PR #94 was merged

Additionally:

  • Issue #252 is dealing with examples for VILLAS