示例#1
0
                                  "effort")
printStatus(status, 0)

status = oms.addTLMBus("model.tlm.wc2.bus2", oms.tlm_domain_output, 1,
                       oms.default)
printStatus(status, 0)

status = oms.addConnectorToTLMBus("model.tlm.wc2.bus2", "model.tlm.wc2.y",
                                  "value")
printStatus(status, 0)

status = oms.addTLMConnection("model.tlm.wc1.bus1", "model.tlm.wc2.bus2",
                              0.001, 0.3, 100, 0)
printStatus(status, 0)

src, status = oms.list("model.tlm")
print src

status = oms.deleteConnectorFromTLMBus("model.tlm.wc1.bus2", "model.tlm.wc1.x")
printStatus(status, 0)

status, src = oms.list("model.tlm")
print src

status = oms.delete("model")
printStatus(status, 0)

## Result:
## status:  [correct] ok
## status:  [correct] ok
## error:   [addConnectorToTLMBus] Connector "z" not found in system "model.tlm.wc1"
示例#2
0
status = oms.addConnection("model.wc.sc1.u1", "model.wc.sc2.y1")
printStatus(status, 0)

## Connecting input to input (illegal)
status = oms.addConnection("model.wc.sc1.y", "model.wc.sc2.y3")
printStatus(status, 3)

## Connecting Real to Integer (illegal)
status = oms.addConnection("model.wc.sc1.u2", "model.wc.sc2.y2")
printStatus(status, 3)

## Connecting to already connected connector (illegal)
status = oms.addConnection("model.wc.sc1.u1", "model.wc.sc2.y3")
printStatus(status, 3)

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

status = oms.deleteConnection("model.wc.sc1.u1", "model.wc.sc2.y1")
printStatus(status, 0)

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

status = oms.delete("model")
printStatus(status, 0)

## Result:
## status:  [correct] ok
## status:  [correct] ok
## status:  [correct] ok
示例#3
0
  if 0 == status:
    status = "ok"
  elif 1 == status:
    status = "warning"
  elif 3 == status:
    status = "error"
  print("status:  [%s] %s" % (cmp, status), flush=True)



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")
示例#4
0
        status = "warning"
    elif 3 == status:
        status = "error"
    print("status:  [%s] %s" % (cmp, status), flush=True)


status = oms.newModel("model")
printStatus(status, 0)

status = oms.addSystem("model.sc", oms.system_sc)
printStatus(status, 0)

status = oms.setSignalFilter("model", "[AB]")
printStatus(status, 0)

(src, status) = oms.list("model")
printStatus(status, 0)
print(src, flush=True)

status = oms.removeSignalsFromResults("model", "A")
printStatus(status, 0)

status = oms.addSignalsToResults("model", "Y")
printStatus(status, 0)

(src, status) = oms.list("model")
printStatus(status, 0)
print(src, flush=True)

status = oms.export("model", "model.ssp")
printStatus(status, 0)
    if 0 == status:
        status = "ok"
    elif 1 == status:
        status = "warning"
    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">
示例#6
0
printStatus(status, 0)

status = oms.addTLMConnection("test.eoo.foo.tlm", "test.eoo.foo2.tlm", 0.001,
                              0.3, 100, 0)
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)
示例#7
0
status = oms.addConnection("model.wc.sc1.u1", "model.wc.sc2.y1")
printStatus(status, 0)

## Connecting input to input (illegal)
status = oms.addConnection("model.wc.sc1.y", "model.wc.sc2.y3")
printStatus(status, 3)

## Connecting Real to Integer (illegal)
status = oms.addConnection("model.wc.sc1.u2", "model.wc.sc2.y2")
printStatus(status, 3)

## Connecting to already connected connector (illegal)
status = oms.addConnection("model.wc.sc1.u1", "model.wc.sc2.y3")
printStatus(status, 3)

status, src = oms.list("model.wc")
print(src)

status = oms.deleteConnection("model.wc.sc1.u1", "model.wc.sc2.y1")
printStatus(status, 0)

status, src = oms.list("model.wc")
print(src)

status = oms.delete("model")
printStatus(status, 0)

## Result:
## status:  [correct] ok
## status:  [correct] ok
## status:  [correct] ok
示例#8
0
status = oms.newModel("test")
printStatus(status, 0)

status = oms.addSystem("test", oms.system_tlm)
printStatus(status, 3)

status = oms.addSystem("test.foo", oms.system_wc)
printStatus(status, 0)

status = oms.addSystem("test.foo.goo", oms.system_sc)
printStatus(status, 0)

status = oms.addSystem("test.foo.hoo", oms.system_wc)
printStatus(status, 3)

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

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

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

status = oms.newModel("test")
printStatus(status, 3)

status = oms.rename("test", "foo")
printStatus(status, 0)

status = oms.newModel("test")
示例#9
0
    if 0 == status:
        status = "ok"
    elif 1 == status:
        status = "warning"
    elif 3 == status:
        status = "error"
    print("status:  [%s] %s" % (cmp, status), flush=True)


oms.newModel("test03py")
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)
示例#10
0
status = oms.newModel("test")
printStatus(status, 0)

status = oms.addSystem("test", oms.system_tlm)
printStatus(status, 3)

status = oms.addSystem("test.foo", oms.system_wc)
printStatus(status, 0)

status = oms.addSystem("test.foo.goo", oms.system_sc)
printStatus(status, 0)

status = oms.addSystem("test.foo.hoo", oms.system_wc)
printStatus(status, 3)

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

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

status, src = oms.list("test.foo.goo")
print(src)

status = oms.newModel("test")
printStatus(status, 3)

status = oms.rename("test", "foo")
printStatus(status, 0)

status = oms.newModel("test")