Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add FMI3.0 prototype for cosimulation #1414

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bfa6858
add FMI3.0 prototype for cosimulation
arun3688 Dec 13, 2024
dbf8e13
check for .fmu
arun3688 Dec 13, 2024
fadef84
fix variable name conflicts
arun3688 Dec 14, 2024
4395cd6
add Makefile
arun3688 Dec 14, 2024
c941bd0
add test VanDerPol.lua
arun3688 Dec 14, 2024
229e535
add test to Makefile
arun3688 Dec 14, 2024
f1be98b
handle numeric types for data types
arun3688 Dec 18, 2024
0aba6ae
add reference test Stair.lua
arun3688 Dec 18, 2024
94e3de3
fix switch cases
arun3688 Dec 18, 2024
b5b32fe
add support for multiple numeric types
arun3688 Dec 19, 2024
ed25ed3
add reference-fmu test Feedthrough
arun3688 Dec 19, 2024
c72b215
add reference-fmus/3.0/Dahlquist.lua
arun3688 Dec 19, 2024
f5f5177
add reference-fmus/3.0/Resource.lua
arun3688 Dec 19, 2024
6e5c87e
implement fmi3 initial attribute table
arun3688 Jan 3, 2025
2cdbdbf
attempts to fix memory leaks
arun3688 Jan 4, 2025
320f82f
do not free memory multiple times
arun3688 Jan 4, 2025
6e07b64
fix memory leaks in parseModelStructureElement()
arun3688 Jan 8, 2025
4acc028
expected output
arun3688 Jan 8, 2025
331353e
update 3rdParty
arun3688 Jan 13, 2025
41ff063
fix variable indexing
arun3688 Jan 13, 2025
7acd243
update fmi4c library
arun3688 Jan 13, 2025
270ed45
fix fmi2_getVariableByIndex
arun3688 Jan 13, 2025
f61cdc1
fix deleting directory error messages
arun3688 Jan 15, 2025
4642c5c
update fmi4c
arun3688 Jan 15, 2025
4383454
update fmi4c
arun3688 Jan 15, 2025
98e3831
update fmi4c
arun3688 Jan 15, 2025
42e4fd4
unpack the fmu in temp directory and load fmi handle from unpacked lo…
arun3688 Jan 15, 2025
6d2cd8c
fix memory leaks in parseModelStructureElementFMI3()
arun3688 Jan 15, 2025
e390b5d
fix function call
arun3688 Jan 15, 2025
9a28dad
fix fmiVersion
arun3688 Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions include/OMSimulator/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ typedef enum {
typedef enum {
oms_component_none,
oms_component_fmu, ///< FMU
oms_component_fmu3, ///< FMU3
oms_component_table, ///< lookup table
oms_component_external ///< external model
} oms_component_enu_t;
Expand All @@ -113,6 +114,19 @@ typedef enum {
oms_signal_type_bus
} oms_signal_type_enu_t;

typedef enum {
oms_signal_numeric_type_FLOAT32, // Represents fmi3Float32
oms_signal_numeric_type_FLOAT64, // Represents fmi3Float64
oms_signal_numeric_type_INT8, // Represents fmi3Int8
oms_signal_numeric_type_UINT8, // Represents fmi3UInt8
oms_signal_numeric_type_INT16, // Represents fmi3Int16
oms_signal_numeric_type_UINT16, // Represents fmi3UInt16
oms_signal_numeric_type_INT32, // Represents fmi3Int32
oms_signal_numeric_type_UINT32, // Represents fmi3UInt32
oms_signal_numeric_type_INT64, // Represents fmi3Int64
oms_signal_numeric_type_UINT64 // Represents fmi3UInt64
} oms_signal_numeric_type_enu_t;

/**
* \brief Connection type
*/
Expand Down
1 change: 1 addition & 0 deletions src/OMSimulatorLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ set(OMSIMULATORLIB_SOURCES
Clocks.cpp
Component.cpp
ComponentFMUCS.cpp
ComponentFMU3CS.cpp
ComponentFMUME.cpp
ComponentTable.cpp
ComRef.cpp
Expand Down
33 changes: 33 additions & 0 deletions src/OMSimulatorLib/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,39 @@ void oms::fmi2logger(fmi2ComponentEnvironment env, fmi2String instanceName, fmi2
}
}

void oms::fmi3logger(fmi3InstanceEnvironment env, fmi3Status status, fmi3String category, fmi3String message)
{
if (status == fmi3OK && !logDebugEnabled())
{
// When frequently called for debug logging during simulation, avoid costly formatting.
return;
}

std::string msg = message; // Directly use the message as a string.

switch (status)
{
case fmi3OK:
logDebug("[fmi3OK] " + std::string(category) + ": " + msg);
break;
case fmi3Warning:
logWarning("[fmi3Warning] " + std::string(category) + ": " + msg);
break;
case fmi3Discard:
logError("[fmi3Discard] " + std::string(category) + ": " + msg);
break;
case fmi3Error:
logError("[fmi3Error] " + std::string(category) + ": " + msg);
break;
case fmi3Fatal:
logError("[fmi3Fatal] " + std::string(category) + ": " + msg);
break;
default:
logError("[unknown] " + std::string(category) + ": " + msg);
break;
}
}

oms::Component::Component(const ComRef& cref, oms_component_enu_t type, System* parentSystem, const std::string& path)
: element(oms_element_component, cref), cref(cref), type(type), parentSystem(parentSystem), path(path)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OMSimulatorLib/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace oms
class Variable;

void fmi2logger(fmi2ComponentEnvironment env, fmi2String instanceName, fmi2Status status, fmi2String category, fmi2String message, ...);

void fmi3logger(fmi3InstanceEnvironment env, fmi3Status status, fmi3String category, fmi3String message);
class Component
{
public:
Expand Down
Loading