Add new node-type FMU#1017
Conversation
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com> Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com> Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com> Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com> Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com> Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
Signed-off-by: Ritesh.K <riteshkarki6@gmail.com>
stv0g
left a comment
There was a problem hiding this comment.
Nice work. Its great to see FMI support landing in VILLAS
| @@ -0,0 +1,61 @@ | |||
| # SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University | |||
| @@ -0,0 +1,26 @@ | |||
| # CMakeLists.txt. | |||
| # | |||
| # Author: Ritesh Karki | |||
There was a problem hiding this comment.
Please add a contact mail address
| @@ -0,0 +1,7 @@ | |||
| # yaml-language-server: $schema=http://json-schema.org/draft-07/schema | |||
| # SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University | |||
| }, | ||
| fmu_node = { | ||
| type = "fmu" | ||
| # Path to fmu file |
There was a problem hiding this comment.
| # Path to fmu file | |
| # Path to the FMU file (.fmu) |
| # Path to fmu file | ||
| fmu_path = "/workspaces/node/fmu_temp/asine.fmu" | ||
| fmu_unpack_path = "/workspaces/node/fmu_temp/fmu_asine" | ||
| fmu_writefirst = true |
There was a problem hiding this comment.
| fmu_writefirst = true | |
| fmu_write_first = true |
| type = "file" | ||
| # format = "csv" | ||
| uri = "/workspaces/node/fmu_temp/output.dat" | ||
| out = { |
There was a problem hiding this comment.
Is this empty section required?
| callbacks.log_level = jm_log_level_info; | ||
| callbacks.context = nullptr; | ||
| context = fmi_import_allocate_context(&callbacks); | ||
|
|
There was a problem hiding this comment.
I believe at least the callbacks can be initialized in the constructor?
|
|
||
| struct stat sb; | ||
| if (stat(unpack_path, &sb) != 0) | ||
| std::cerr << "The unpack path is invalid" << std::endl; |
There was a problem hiding this comment.
Dont log via iostreams. Use the existing logging infrastructure.
| return Node::prepare(); | ||
| } | ||
|
|
||
| int FmuNode::check() { return Node::check(); } |
| while (hasInputs && (writingTurn || currentTime >= stopTime)) { | ||
| pthread_cond_wait(&cv, &mutex); | ||
| } | ||
| double targetTime = currentTime + stepSize; |
There was a problem hiding this comment.
I think this not executing the FMU using a real-time scale?
Can you elaborate a bit how this node-type is indentend to be used?
E.g. does it expect periodic input data to proceed its internal time?
How does the internal time related to the real time?
Do we already have a PR for the node-type? I think this deserves some explanation.
@al3xa23
New node type implementation based on Functional Mock-up Interface (FMI 3.0). Currently supports Co-Simulation. Functionality can be further extended to include Model Exchange simulation too.