Changeset 84a90a33 in OpenModelica
- Timestamp:
- 2019-01-18T10:06:13+01:00 (5 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
- Children:
- 6307dbc
- Parents:
- d663c40
- git-author:
- Lennart Ochel <lennart.ochel@…> (01/18/19 10:06:13)
- git-committer:
- hudson <openmodelica@…> (01/18/19 10:06:13)
- Location:
- omsimulator
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
omsimulator/DualMassOscillator_me.mos
r7df27713 r84a90a33 9 9 10 10 writeFile("DualMassOscillator_me.lua", " 11 oms 3_setCommandLineOption(\"--suppressPath=true\")12 oms 3_setTempDirectory(\"./temp-DualMassOscillator_me/\")11 oms_setCommandLineOption(\"--suppressPath=true\") 12 oms_setTempDirectory(\"./temp-DualMassOscillator_me/\") 13 13 14 oms 3_newModel(\"DualMassOscillator\")15 oms 3_addSystem(\"DualMassOscillator.root\", oms_system_sc)16 oms 3_addSubModel(\"DualMassOscillator.root.system1\", \"DualMassOscillator.System1.fmu\")17 oms 3_addSubModel(\"DualMassOscillator.root.system2\", \"DualMassOscillator.System2.fmu\")14 oms_newModel(\"DualMassOscillator\") 15 oms_addSystem(\"DualMassOscillator.root\", oms_system_sc) 16 oms_addSubModel(\"DualMassOscillator.root.system1\", \"DualMassOscillator.System1.fmu\") 17 oms_addSubModel(\"DualMassOscillator.root.system2\", \"DualMassOscillator.System2.fmu\") 18 18 19 oms 3_addConnection(\"DualMassOscillator.root.system1.F\", \"DualMassOscillator.root.system2.F\")20 oms 3_addConnection(\"DualMassOscillator.root.system1.s1\", \"DualMassOscillator.root.system2.s1\")21 oms 3_addConnection(\"DualMassOscillator.root.system1.v1\", \"DualMassOscillator.root.system2.v1\")22 oms 3_addConnection(\"DualMassOscillator.root.system1.a1\", \"DualMassOscillator.root.system2.a1\")19 oms_addConnection(\"DualMassOscillator.root.system1.F\", \"DualMassOscillator.root.system2.F\") 20 oms_addConnection(\"DualMassOscillator.root.system1.s1\", \"DualMassOscillator.root.system2.s1\") 21 oms_addConnection(\"DualMassOscillator.root.system1.v1\", \"DualMassOscillator.root.system2.v1\") 22 oms_addConnection(\"DualMassOscillator.root.system1.a1\", \"DualMassOscillator.root.system2.a1\") 23 23 24 oms 3_setResultFile(\"DualMassOscillator\", \"\")25 oms 3_setStopTime(\"DualMassOscillator\", 0.1)26 oms 3_setFixedStepSize(\"DualMassOscillator.root\", 1e-4)27 oms 3_setTolerance(\"DualMassOscillator.root\", 1e-6)24 oms_setResultFile(\"DualMassOscillator\", \"\") 25 oms_setStopTime(\"DualMassOscillator\", 0.1) 26 oms_setFixedStepSize(\"DualMassOscillator.root\", 1e-4) 27 oms_setTolerance(\"DualMassOscillator.root\", 1e-6) 28 28 29 oms 3_instantiate(\"DualMassOscillator\")30 oms 3_setReal(\"DualMassOscillator.root.system2.s2_start\", 2.5)29 oms_instantiate(\"DualMassOscillator\") 30 oms_setReal(\"DualMassOscillator.root.system2.s2_start\", 2.5) 31 31 32 oms 3_initialize(\"DualMassOscillator\")32 oms_initialize(\"DualMassOscillator\") 33 33 print(\"info: Initialization\") 34 print(\"info: system1.s1: \" .. oms 3_getReal(\"DualMassOscillator.root.system1.s1\"))35 print(\"info: system2.s2: \" .. oms 3_getReal(\"DualMassOscillator.root.system2.s2\"))34 print(\"info: system1.s1: \" .. oms_getReal(\"DualMassOscillator.root.system1.s1\")) 35 print(\"info: system2.s2: \" .. oms_getReal(\"DualMassOscillator.root.system2.s2\")) 36 36 37 oms 3_simulate(\"DualMassOscillator\")37 oms_simulate(\"DualMassOscillator\") 38 38 print(\"info: Simulation\") 39 print(\"info: system1.s1: \" .. oms 3_getReal(\"DualMassOscillator.root.system1.s1\"))40 print(\"info: system2.s2: \" .. oms 3_getReal(\"DualMassOscillator.root.system2.s2\"))39 print(\"info: system1.s1: \" .. oms_getReal(\"DualMassOscillator.root.system1.s1\")) 40 print(\"info: system2.s2: \" .. oms_getReal(\"DualMassOscillator.root.system2.s2\")) 41 41 42 oms 3_terminate(\"DualMassOscillator\")43 oms 3_delete(\"DualMassOscillator\")42 oms_terminate(\"DualMassOscillator\") 43 oms_delete(\"DualMassOscillator\") 44 44 "); getErrorString(); 45 45 -
omsimulator/initialization.mos
r539eebd r84a90a33 20 20 21 21 writeFile("initialization.lua", " 22 oms 3_setCommandLineOption(\"--suppressPath=true\")23 oms 3_setTempDirectory(\"./temp-initialization/\")22 oms_setCommandLineOption(\"--suppressPath=true\") 23 oms_setTempDirectory(\"./temp-initialization/\") 24 24 25 oms 3_newModel(\"test\")26 oms 3_addSystem(\"test.root\", oms_system_sc)27 oms 3_addSubModel(\"test.root.A\", \"initialization.fmu\")28 oms 3_setResultFile(\"test\", \"\")25 oms_newModel(\"test\") 26 oms_addSystem(\"test.root\", oms_system_sc) 27 oms_addSubModel(\"test.root.A\", \"initialization.fmu\") 28 oms_setResultFile(\"test\", \"\") 29 29 30 oms 3_instantiate(\"test\")31 oms 3_setReal(\"test.root.A.x_start\", 1.5)30 oms_instantiate(\"test\") 31 oms_setReal(\"test.root.A.x_start\", 1.5) 32 32 33 oms 3_initialize(\"test\")33 oms_initialize(\"test\") 34 34 print(\"info: Initialization\") 35 print(\"info: A.x_start: \" .. oms 3_getReal(\"test.root.A.x_start\"))36 print(\"info: A.x: \" .. oms 3_getReal(\"test.root.A.x\"))37 print(\"info: A.w: \" .. oms 3_getReal(\"test.root.A.w\"))35 print(\"info: A.x_start: \" .. oms_getReal(\"test.root.A.x_start\")) 36 print(\"info: A.x: \" .. oms_getReal(\"test.root.A.x\")) 37 print(\"info: A.w: \" .. oms_getReal(\"test.root.A.w\")) 38 38 39 oms 3_simulate(\"test\")39 oms_simulate(\"test\") 40 40 print(\"info: Simulation\") 41 print(\"info: A.x_start: \" .. oms 3_getReal(\"test.root.A.x_start\"))42 print(\"info: A.x: \" .. oms 3_getReal(\"test.root.A.x\"))43 print(\"info: A.w: \" .. oms 3_getReal(\"test.root.A.w\"))41 print(\"info: A.x_start: \" .. oms_getReal(\"test.root.A.x_start\")) 42 print(\"info: A.x: \" .. oms_getReal(\"test.root.A.x\")) 43 print(\"info: A.w: \" .. oms_getReal(\"test.root.A.w\")) 44 44 45 oms 3_terminate(\"test\")46 oms 3_delete(\"test\")45 oms_terminate(\"test\") 46 oms_delete(\"test\") 47 47 "); getErrorString(); 48 48 -
omsimulator/initialization2.mos
r539eebd r84a90a33 22 22 23 23 writeFile("initialization2.lua", " 24 oms 3_setCommandLineOption(\"--suppressPath=true\")25 oms 3_setTempDirectory(\"./temp-initialization2/\")24 oms_setCommandLineOption(\"--suppressPath=true\") 25 oms_setTempDirectory(\"./temp-initialization2/\") 26 26 27 oms 3_newModel(\"test\")28 oms 3_addSystem(\"test.root\", oms_system_sc)29 oms 3_addSubModel(\"test.root.A\", \"input.csv\")30 oms 3_addSubModel(\"test.root.B\", \"initialization2.fmu\")31 oms 3_addConnection(\"test.root.A.y\", \"test.root.B.u\")32 oms 3_setResultFile(\"test\", \"\")27 oms_newModel(\"test\") 28 oms_addSystem(\"test.root\", oms_system_sc) 29 oms_addSubModel(\"test.root.A\", \"input.csv\") 30 oms_addSubModel(\"test.root.B\", \"initialization2.fmu\") 31 oms_addConnection(\"test.root.A.y\", \"test.root.B.u\") 32 oms_setResultFile(\"test\", \"\") 33 33 34 oms 3_instantiate(\"test\")35 oms 3_initialize(\"test\")34 oms_instantiate(\"test\") 35 oms_initialize(\"test\") 36 36 print(\"info: Initialization\") 37 print(\"info: A.y: \" .. oms 3_getReal(\"test.root.A.y\"))38 print(\"info: B.x: \" .. oms 3_getReal(\"test.root.B.x\"))39 print(\"info: B.y: \" .. oms 3_getReal(\"test.root.B.y\"))40 print(\"info: B.u: \" .. oms 3_getReal(\"test.root.B.u\"))37 print(\"info: A.y: \" .. oms_getReal(\"test.root.A.y\")) 38 print(\"info: B.x: \" .. oms_getReal(\"test.root.B.x\")) 39 print(\"info: B.y: \" .. oms_getReal(\"test.root.B.y\")) 40 print(\"info: B.u: \" .. oms_getReal(\"test.root.B.u\")) 41 41 42 oms 3_terminate(\"test\")43 oms 3_delete(\"test\")42 oms_terminate(\"test\") 43 oms_delete(\"test\") 44 44 "); getErrorString(); 45 45
Note: See TracChangeset
for help on using the changeset viewer.