예제 #1
0
oms.newModel("test")
oms.addSystem("test.eoo", oms.system_wc)
oms.addSubModel("test.eoo.source", "../resources/Modelica.Blocks.Sources.Sine.fmu")

## save snapshot
src, status = oms.list("test")
print(src, flush=True)

## change model
oms.addSystem("test.eoo.goo", oms.system_sc)
oms.delete("test.eoo.source")
oms.addSubModel("test.eoo.source", "../resources/Modelica.Blocks.Sources.Constant.fmu")

## restore model from snapshot
status = oms.loadSnapshot("test", src)
printStatus(status, 0)

src, status = oms.list("test")
print(src, flush=True)

oms.instantiate("test")
oms.initialize("test")
oms.simulate("test")
oms.terminate("test")

oms.delete("test")


## Result:
## <?xml version="1.0"?>
예제 #2
0
oms.addSystem("test03py.eoo", oms.system_wc)
oms.addSubModel("test03py.eoo.source",
                "../resources/Modelica.Blocks.Sources.Sine.fmu")

## save snapshot
src, status = oms.list("test03py")
print(src, flush=True)

## change model
oms.addSystem("test03py.eoo.goo", oms.system_sc)
oms.delete("test03py.eoo.source")
oms.addSubModel("test03py.eoo.source",
                "../resources/Modelica.Blocks.Sources.Constant.fmu")

## restore model from snapshot
newCref, status = oms.loadSnapshot("test03py", src)
printStatus(status, 0)

src, status = oms.list("test03py")
print(src, flush=True)

oms.instantiate("test03py")
oms.initialize("test03py")
oms.simulate("test03py")
oms.terminate("test03py")

oms.delete("test03py")

## Result:
## <?xml version="1.0"?>
## <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="test03py" version="1.0">