printStatus(status, 0) status = oms.addConnection("test.eoo.foo.y1", "test.eoo.foo2.u1") printStatus(status, 0) status = oms.addConnection("test.eoo.foo.y2", "test.eoo.foo2.u2") printStatus(status, 0) status = oms.addConnection("test.eoo.foo.bus", "test.eoo.foo2.bus") printStatus(status, 0) status, src = oms.list("test") printStatus(status, 0) print(src) status = oms.export("test", "test-py.ssp") printStatus(status, 0) status = oms.delete("test") printStatus(status, 0) status, model = oms.importFile("test-py.ssp") printStatus(status, 0) status, src = oms.list(model) printStatus(status, 0) print(src) status = oms.delete(model) printStatus(status, 0)
elif 3 == status: status = "error" print "status: [%s] %s" % (cmp, status) status = oms.newModel("model") printStatus(status, 0) status = oms.addSystem("model.sc", oms.system_sc) printStatus(status, 0) src, status = oms.list("model") printStatus(status, 0) print(src) status = oms.export("model", "model.ssp") printStatus(status, 0) status = oms.export("model", "model.ssp") printStatus(status, 0) ## Result: ## status: [correct] ok ## status: [correct] ok ## status: [wrong] <?xml version="1.0"?> ## <ssd:SystemStructureDescription name="model" version="Draft20180219"> ## <ssd:System name="sc"> ## <ssd:SimulationInformation> ## <VariableStepSolver description="cvode" absoluteTolerance="0.000100" relativeTolerance="0.000100" minimumStepSize="0.000100" maximumStepSize="0.100000" initialStepSize="0.000100" /> ## </ssd:SimulationInformation> ## <ssd:Elements />
oms.addConnector("addExternalResources.root.system1.C2", oms.input, oms.signal_type_real) ## add resources to subsystem oms.newResources("addExternalResources.root.system1:system1.ssv") oms.setReal("addExternalResources.root.system1.C1", -10) oms.addSubModel("addExternalResources.root.Gain", "../../resources/Modelica.Blocks.Math.Gain.fmu") ## add resources to submodule oms.newResources("addExternalResources.root.Gain:gain.ssv") oms.setReal("addExternalResources.root.Gain.k", 27) oms.setResultFile("addExternalResources", "addExternalResources1.mat", 10) oms.export("addExternalResources", "addExternalResources3.ssp") oms.terminate("addExternalResources") oms.delete("addExternalResources") oms.importFile("addExternalResources3.ssp") ## old Resources and references src, status = oms.exportSnapshot("addExternalResources") print(src, flush=True) ## add list of external resources from filesystem to ssp oms.addResources("addExternalResources", "../../resources/externalRoot.ssv") oms.addResources("addExternalResources:externalSystem.ssv", "../../resources/externalSystem1.ssv") oms.addResources("addExternalResources", "../../resources/externalGain.ssv")