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 support for import export string connector #1292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/OMSimulatorLib/Connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ oms::Connector* oms::Connector::NewConnector(const pugi::xml_node& node, const s
type = oms_signal_type_integer;
else if (typeString == "Boolean")
type = oms_signal_type_boolean;
else if (typeString == "String")
type = oms_signal_type_string;
else if (typeString == "Enumeration")
type = oms_signal_type_enum;
// TODO handle "Binary" type for FMI-2.1 see specification
Expand Down
97 changes: 97 additions & 0 deletions testsuite/simulation/str_hello_world.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ print("info: a: " .. oms_getString("model.root.fmu.a"))
print("info: b: " .. oms_getString("model.root.fmu.b"))
print("info: c: " .. oms_getString("model.root.fmu.c"))

src = oms_exportSnapshot("model")
print(src)

oms_terminate("model")
oms_delete("model")

Expand All @@ -42,4 +45,98 @@ oms_delete("model")
-- info: a: Hello
-- info: b: OMSimulator
-- info: c: Hello OMSimulator!
-- <?xml version="1.0"?>
-- <oms:snapshot
-- xmlns:oms="https://raw.githubusercontent.com/OpenModelica/OMSimulator/master/schema/oms.xsd"
-- partial="false">
-- <oms:file
-- name="SystemStructure.ssd">
-- <ssd:SystemStructureDescription
-- xmlns:ssc="http://ssp-standard.org/SSP1/SystemStructureCommon"
-- xmlns:ssd="http://ssp-standard.org/SSP1/SystemStructureDescription"
-- xmlns:ssv="http://ssp-standard.org/SSP1/SystemStructureParameterValues"
-- xmlns:ssm="http://ssp-standard.org/SSP1/SystemStructureParameterMapping"
-- xmlns:ssb="http://ssp-standard.org/SSP1/SystemStructureSignalDictionary"
-- xmlns:oms="https://raw.githubusercontent.com/OpenModelica/OMSimulator/master/schema/oms.xsd"
-- name="model"
-- version="1.0">
-- <ssd:System
-- name="root">
-- <ssd:Elements>
-- <ssd:Component
-- name="fmu"
-- type="application/x-fmu-sharedlibrary"
-- source="resources/0001_fmu.fmu">
-- <ssd:Connectors>
-- <ssd:Connector
-- name="a"
-- kind="parameter">
-- <ssc:String />
-- </ssd:Connector>
-- <ssd:Connector
-- name="b"
-- kind="parameter">
-- <ssc:String />
-- </ssd:Connector>
-- <ssd:Connector
-- name="c"
-- kind="calculatedParameter">
-- <ssc:String />
-- </ssd:Connector>
-- </ssd:Connectors>
-- </ssd:Component>
-- </ssd:Elements>
-- <ssd:Annotations>
-- <ssc:Annotation
-- type="org.openmodelica">
-- <oms:Annotations>
-- <oms:SimulationInformation>
-- <oms:FixedStepMaster
-- description="oms-ma"
-- stepSize="0.001000"
-- absoluteTolerance="0.000100"
-- relativeTolerance="0.000100" />
-- </oms:SimulationInformation>
-- </oms:Annotations>
-- </ssc:Annotation>
-- </ssd:Annotations>
-- </ssd:System>
-- <ssd:DefaultExperiment
-- startTime="0.000000"
-- stopTime="1.000000">
-- <ssd:Annotations>
-- <ssc:Annotation
-- type="org.openmodelica">
-- <oms:Annotations>
-- <oms:SimulationInformation
-- resultFile=""
-- loggingInterval="0.000000"
-- bufferSize="1"
-- signalFilter="resources/signalFilter.xml" />
-- </oms:Annotations>
-- </ssc:Annotation>
-- </ssd:Annotations>
-- </ssd:DefaultExperiment>
-- </ssd:SystemStructureDescription>
-- </oms:file>
-- <oms:file
-- name="resources/signalFilter.xml">
-- <oms:SignalFilter
-- version="1.0">
-- <oms:Variable
-- name="model.root.fmu.a"
-- type="String"
-- kind="parameter" />
-- <oms:Variable
-- name="model.root.fmu.b"
-- type="String"
-- kind="parameter" />
-- <oms:Variable
-- name="model.root.fmu.c"
-- type="String"
-- kind="calculatedParameter" />
-- </oms:SignalFilter>
-- </oms:file>
-- </oms:snapshot>
--
-- endResult