Skip to content
Open
1 change: 1 addition & 0 deletions include/OMSimulator/OMSimulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ OMSAPI oms_status_enu_t OMSCALL oms_setConnectorGeometry(const char* cref, const
OMSAPI oms_status_enu_t OMSCALL oms_setConnectorNumericType(const char* cref, const oms_signal_numeric_type_enu_t numericType);
OMSAPI oms_status_enu_t OMSCALL oms_setElementGeometry(const char* cref, const ssd_element_geometry_t* geometry);
OMSAPI oms_status_enu_t OMSCALL oms_setFixedStepSize(const char* cref, double stepSize);
OMSAPI oms_status_enu_t OMSCALL oms_setDcpPorts(const char* cref, int masterPort, int slavePort);
OMSAPI oms_status_enu_t OMSCALL oms_setInteger(const char* cref, int value);
OMSAPI oms_status_enu_t OMSCALL oms_setLogFile(const char* filename);
OMSAPI void OMSCALL oms_setLoggingCallback(void (*cb)(oms_message_type_enu_t type, const char* message));
Expand Down
74 changes: 73 additions & 1 deletion include/OMSimulator/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ typedef enum {
typedef enum {
oms_component_none,
oms_component_fmu, ///< FMU
oms_component_fmu3, ///< FMU3
oms_component_fmu3, ///< FMU3
oms_component_dcp, ///< DCP
oms_component_table, ///< lookup table
oms_component_external ///< external model
} oms_component_enu_t;
Expand Down Expand Up @@ -514,6 +515,77 @@ typedef struct {
unsigned int maxOutputDerivativeOrder;
} oms_fmu_info_t;

typedef struct {
/**
* The DCP major version that was used to generate the DCPX file
* and accompanying DCP slave.
*/
int dcpMajorVersion;
/**
* The DCP minor version that was used to generate the DCPX file
* and accompanying DCP slave.
*/
int dcpMinorVersion;
/**
* The name of the complete DCP slave.
*/
char* dcpSlaveName;
/**
* The universally unique identifier is a string that is used to uniquely
* identify a DCP slave in a global environment. The uuid acts as
* a fingerprint of relevant information. Typically, the uuid is assigned
* when the DCP slave description file is generated. It is used
* for verification during the registration process of a DCP slave.
*/
char* uuid;
/**
* Optional string that contains a brief description of the complete
*DCP slave.
*/
char* description;
/**
* Optional string that contains name and organization of the DCP
* slave author.
*/
char* author;
/**
* Optional development version number of the DCP slave.
*/
char* version;
/**
* Optional information on the intellectual property copyright for this
* DCP slave.
*/
char* copyright;
/**
* Optional information on the intellectual property licensing for this
* DCP slave.
*/
char* license;
/**
* Optional information about the tool the DCPX file was generated
* with.
*/
char* generationTool;
/**
* Optional date and time when the DCPX file was generated. The
* format is a subset of “xs:dateTime” and should be: “YYYY-MMDDThh:
* mm:ssZ" (with one “T” between date and time; “Z” characterizes
* the Zulu time zone, in other words Greenwich meantime).
*/
char* generationDateAndTime;
/**
* Defines whether the variable names in Variables/Variable/name
* and in TypeDefinitions/SimpleType/name follow a particular
* convention.
*/
int variableNamingConvention;
/**
* Absolute path to the DCP file.
*/
char* path;
} oms_dcp_info_t;

/*
* FMU default experiment settings from modeldescription.xml
*/
Expand Down
29 changes: 27 additions & 2 deletions src/OMSimulatorLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ set(OMSIMULATORLIB_SOURCES
Clock.cpp
Clocks.cpp
Component.cpp
ComponentDCP.cpp
ComponentFMU3CS.cpp
ComponentFMUCS.cpp
ComponentFMU3ME.cpp
Expand All @@ -58,6 +59,7 @@ set(OMSIMULATORLIB_SOURCES
Connector.cpp
CSVReader.cpp
CSVWriter.cpp
DCPInfo.cpp
DirectedGraph.cpp
Element.cpp
Flags.cpp
Expand Down Expand Up @@ -93,6 +95,20 @@ list(APPEND OMSIMULATORLIB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/Version.cpp")
add_library(OMSimulatorLib SHARED ${OMSIMULATORLIB_SOURCES})
set_target_properties(OMSimulatorLib PROPERTIES OUTPUT_NAME OMSimulator)

add_library(dcplib INTERFACE)
# DCPLib headers live in the top-level 3rdParty directory
target_include_directories(dcplib
INTERFACE
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/core
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/ethernet
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/master
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/slave
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/xml
${CMAKE_SOURCE_DIR}/3rdParty/DCPLib/include/zip
${CMAKE_SOURCE_DIR}/3rdParty/asio/include)
target_link_libraries(OMSimulatorLib PRIVATE dcplib)
target_link_libraries(OMSimulatorLib PUBLIC ws2_32)

target_include_directories(OMSimulatorLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(OMSimulatorLib
Expand All @@ -105,7 +121,9 @@ target_link_libraries(OMSimulatorLib
oms::3rd::zlib
oms::3rd::pugixml::header
oms::3rd::json::header
oms::3rd::ctpl::header)
oms::3rd::ctpl::header
oms::3rd::xerces
oms::3rd::libzip)

target_link_libraries(OMSimulatorLib PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})

Expand Down Expand Up @@ -135,10 +153,17 @@ target_link_libraries(OMSimulatorLib_static
oms::3rd::zlib
oms::3rd::pugixml::header
oms::3rd::json::header
oms::3rd::ctpl::header)
oms::3rd::ctpl::header
oms::3rd::xerces
oms::3rd::ctpl::header
oms::3rd::libzip)

target_link_libraries(OMSimulatorLib_static PRIVATE dcplib)

target_link_libraries(OMSimulatorLib_static PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})

target_link_libraries(OMSimulatorLib_static PUBLIC ws2_32)

if(MINGW)
target_link_libraries(OMSimulatorLib_static PUBLIC shlwapi)
endif()
Expand Down
13 changes: 13 additions & 0 deletions src/OMSimulatorLib/ComRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@ oms::ComRef oms::ComRef::front() const
return *this;
}

oms::ComRef oms::ComRef::back() const
{
for (int i=size()-1; i>=0; --i)
{
if (cref[i] == '.')
return oms::ComRef(cref+i+1);
else if (cref[i] == ':')
break;
}

return *this;
}

oms::ComRef oms::ComRef::pop_front()
{
for (int i=0; cref[i]; ++i)
Expand Down
1 change: 1 addition & 0 deletions src/OMSimulatorLib/ComRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace oms
bool isRootOf(ComRef child) const;

ComRef front() const; ///< returns the first part of the ComRef (including suffix if its the only part)
ComRef back() const; ///< returns the last part of the ComRef (including suffix if its the only part)
ComRef pop_front(); ///< returns the first part of the ComRef and removed it from the current object

std::string suffix() const; ///< returns the suffix as string
Expand Down
5 changes: 3 additions & 2 deletions src/OMSimulatorLib/Component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ oms::Model& oms::Component::getModel() const

oms::Connector* oms::Component::getConnector(const ComRef& cref)
{
for (auto &connector : connectors)
if (connector && connector->getName() == cref)
for (auto &connector : connectors) {
if (connector && connector->getName() == cref)
return connector;
}

return NULL;
}
Expand Down
Loading
Loading