Skip to content

Commit e52118b

Browse files
authored
Add model.export() to python bindings (#1437)
1 parent b52dfaf commit e52118b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/OMSimulatorLib/Connector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ oms::Connector* oms::Connector::NewConnector(const pugi::xml_node& node, const s
137137
causality = oms_causality_calculatedParameter;
138138
else
139139
{
140-
logError("Failed to import connector \"" + std::string(cref) + "\" with causality \"" + causalityString + "\"");
140+
logWarning("Failed to import connector \"" + std::string(cref) + "\" with causality \"" + causalityString + "\"");
141141
return NULL;
142142
}
143143

@@ -155,7 +155,7 @@ oms::Connector* oms::Connector::NewConnector(const pugi::xml_node& node, const s
155155
// TODO handle "Binary" type for FMI-2.1 see specification
156156
else
157157
{
158-
logError("Failed to import connector \"" + std::string(cref) + "\" with type \"" + typeString + "\"");
158+
logWarning("Failed to import connector \"" + std::string(cref) + "\" with type \"" + typeString + "\"");
159159
return NULL;
160160
}
161161

src/OMSimulatorPython/Model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ def setLoggingInterval(self, loggingInterval: float) -> None:
135135
if Types.Status(status) != Types.Status.OK:
136136
raise Exception('error {}'.format(Types.Status(status)))
137137

138+
def export(self, filename: str) -> None:
139+
status = Scope._capi.export(self.cref, filename)
140+
if Types.Status(status) != Types.Status.OK:
141+
raise Exception('error {}'.format(Types.Status(status)))
142+
138143
@property
139144
def cref(self):
140145
return self._cref

0 commit comments

Comments
 (0)