OMCompiler/Compiler/Script/CevalScriptOMSimulator.mo
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of OpenModelica. | ||
| 3 | * | ||
| 4 | * Copyright (c) 1998-2026, Open Source Modelica Consortium (OSMC), | ||
| 5 | * c/o Linköpings universitet, Department of Computer and Information Science, | ||
| 6 | * SE-58183 Linköping, Sweden. | ||
| 7 | * | ||
| 8 | * All rights reserved. | ||
| 9 | * | ||
| 10 | * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF AGPL VERSION 3 LICENSE OR | ||
| 11 | * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8. | ||
| 12 | * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES | ||
| 13 | * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL | ||
| 14 | * VERSION 3, ACCORDING TO RECIPIENTS CHOICE. | ||
| 15 | * | ||
| 16 | * The OpenModelica software and the OSMC (Open Source Modelica Consortium) | ||
| 17 | * Public License (OSMC-PL) are obtained from OSMC, either from the above | ||
| 18 | * address, from the URLs: | ||
| 19 | * http://www.openmodelica.org or | ||
| 20 | * https://github.com/OpenModelica/ or | ||
| 21 | * http://www.ida.liu.se/projects/OpenModelica, | ||
| 22 | * and in the OpenModelica distribution. | ||
| 23 | * | ||
| 24 | * GNU AGPL version 3 is obtained from: | ||
| 25 | * https://www.gnu.org/licenses/licenses.html#GPL | ||
| 26 | * | ||
| 27 | * This program is distributed WITHOUT ANY WARRANTY; without | ||
| 28 | * even the implied warranty of MERCHANTABILITY or FITNESS | ||
| 29 | * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
| 30 | * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL. | ||
| 31 | * | ||
| 32 | * See the full OSMC Public License conditions for more details. | ||
| 33 | * | ||
| 34 | */ | ||
| 35 | |||
| 36 | encapsulated package CevalScriptOMSimulator | ||
| 37 | " file: CevalScript.mo | ||
| 38 | package: CevalScript | ||
| 39 | description: Constant propagation of expressions | ||
| 40 | This module handles scripting. | ||
| 41 | Input: | ||
| 42 | String: Function Name | ||
| 43 | Value: Function arguments | ||
| 44 | Output: | ||
| 45 | Value: The evaluated value." | ||
| 46 | |||
| 47 | import Values; | ||
| 48 | import OMSimulatorExt; | ||
| 49 | |||
| 50 | public function ceval | ||
| 51 | input String inFunctionName; | ||
| 52 | input list<Values.Value> inVals; | ||
| 53 | output Values.Value outValue; | ||
| 54 | algorithm | ||
| 55 | outValue := match (inFunctionName,inVals) | ||
| 56 | local | ||
| 57 | String cref,crefA,crefB,busCref,connectorCref,stype_,signal,s_lower,s_upper,path,startscript,regex,fmuPath,filenameA,filenameB,var,source,target,filename,initialization,event,simulation,contents,snapshot,newCref,cmd,newTempDir,address,newWorkingDir,version; | ||
| 58 | Real stepSize,lower,upper,delay,alpha,linearimpedance,angularimpedance,relTol,absTol,faultValue,loggingInterval,rvalue,startTime,stopTime,x1,x2,x3,A11,A12,A13,A21,A22,A23,A31,A32,A33,absoluteTolerance,relativeTolerance,initialStepSize,minimumStepSize,maximumStepSize; | ||
| 59 | Integer status,causality,type_,domain,kind,faultType,ivalue,logLevel,bufferSize,solver,dimensions,interpolation,managerPort,monitorPort; | ||
| 60 | Boolean b; | ||
| 61 | |||
| 62 | case ("loadOMSimulator",{}) | ||
| 63 | algorithm | ||
| 64 | 3 | status := OMSimulatorExt.loadOMSimulator(); | |
| 65 | 3 | then | |
| 66 | Values.INTEGER(status); | ||
| 67 | |||
| 68 | case ("unloadOMSimulator",{}) | ||
| 69 | algorithm | ||
| 70 | 3 | status := OMSimulatorExt.unloadOMSimulator(); | |
| 71 | 3 | then | |
| 72 | Values.INTEGER(status); | ||
| 73 | |||
| 74 | case("oms_addBus",{Values.STRING(cref)}) | ||
| 75 | algorithm | ||
| 76 | ✗ | status := OMSimulatorExt.oms_addBus(cref); | |
| 77 | ✗ | then | |
| 78 | Values.INTEGER(status); | ||
| 79 | |||
| 80 | case("oms_addConnection",{Values.STRING(crefA), Values.STRING(crefB)}) | ||
| 81 | algorithm | ||
| 82 | 5 | status := OMSimulatorExt.oms_addConnection(crefA,crefB); | |
| 83 | 5 | then | |
| 84 | Values.INTEGER(status); | ||
| 85 | |||
| 86 | case("oms_addConnector",{Values.STRING(cref), Values.ENUM_LITERAL(index=causality), Values.ENUM_LITERAL(index=type_)}) | ||
| 87 | algorithm | ||
| 88 | ✗ | status := OMSimulatorExt.oms_addConnector(cref,causality-1,type_-1); | |
| 89 | ✗ | then | |
| 90 | Values.INTEGER(status); | ||
| 91 | |||
| 92 | case("oms_addConnectorToBus",{Values.STRING(busCref), Values.STRING(connectorCref)}) | ||
| 93 | algorithm | ||
| 94 | ✗ | status := OMSimulatorExt.oms_addConnectorToBus(busCref,connectorCref); | |
| 95 | ✗ | then | |
| 96 | Values.INTEGER(status); | ||
| 97 | |||
| 98 | case("oms_addConnectorToTLMBus",{Values.STRING(busCref), Values.STRING(connectorCref), Values.STRING(stype_)}) | ||
| 99 | algorithm | ||
| 100 | ✗ | status := OMSimulatorExt.oms_addConnectorToTLMBus(busCref,connectorCref,stype_); | |
| 101 | ✗ | then | |
| 102 | Values.INTEGER(status); | ||
| 103 | |||
| 104 | case("oms_addDynamicValueIndicator",{Values.STRING(signal), Values.STRING(s_lower), Values.STRING(s_upper), Values.REAL(stepSize)}) | ||
| 105 | algorithm | ||
| 106 | ✗ | status := OMSimulatorExt.oms_addDynamicValueIndicator(signal,s_lower,s_upper,stepSize); | |
| 107 | ✗ | then | |
| 108 | Values.INTEGER(status); | ||
| 109 | |||
| 110 | case("oms_addEventIndicator",{Values.STRING(signal)}) | ||
| 111 | algorithm | ||
| 112 | ✗ | status := OMSimulatorExt.oms_addEventIndicator(signal); | |
| 113 | ✗ | then | |
| 114 | Values.INTEGER(status); | ||
| 115 | |||
| 116 | case("oms_addExternalModel",{Values.STRING(cref), Values.STRING(path), Values.STRING(startscript)}) | ||
| 117 | algorithm | ||
| 118 | ✗ | status := OMSimulatorExt.oms_addExternalModel(cref,path,startscript); | |
| 119 | ✗ | then | |
| 120 | Values.INTEGER(status); | ||
| 121 | |||
| 122 | case("oms_addSignalsToResults",{Values.STRING(cref), Values.STRING(regex)}) | ||
| 123 | algorithm | ||
| 124 | ✗ | status := OMSimulatorExt.oms_addSignalsToResults(cref,regex); | |
| 125 | ✗ | then | |
| 126 | Values.INTEGER(status); | ||
| 127 | |||
| 128 | case("oms_addStaticValueIndicator",{Values.STRING(signal), Values.REAL(lower), Values.REAL(upper), Values.REAL(stepSize)}) | ||
| 129 | algorithm | ||
| 130 | ✗ | status := OMSimulatorExt.oms_addStaticValueIndicator(signal,lower,upper,stepSize); | |
| 131 | ✗ | then | |
| 132 | Values.INTEGER(status); | ||
| 133 | |||
| 134 | case("oms_addSubModel",{Values.STRING(cref), Values.STRING(fmuPath)}) | ||
| 135 | algorithm | ||
| 136 | 5 | status := OMSimulatorExt.oms_addSubModel(cref,fmuPath); | |
| 137 | 5 | then | |
| 138 | Values.INTEGER(status); | ||
| 139 | |||
| 140 | case("oms_addSystem",{Values.STRING(cref), Values.ENUM_LITERAL(index=type_)}) | ||
| 141 | algorithm | ||
| 142 | 3 | status := OMSimulatorExt.oms_addSystem(cref,type_-1); | |
| 143 | 3 | then | |
| 144 | Values.INTEGER(status); | ||
| 145 | |||
| 146 | case("oms_addTimeIndicator",{Values.STRING(signal)}) | ||
| 147 | algorithm | ||
| 148 | ✗ | status := OMSimulatorExt.oms_addTimeIndicator(signal); | |
| 149 | ✗ | then | |
| 150 | Values.INTEGER(status); | ||
| 151 | |||
| 152 | case("oms_addTLMBus",{Values.STRING(cref), Values.ENUM_LITERAL(index=domain), Values.INTEGER(dimensions),Values.ENUM_LITERAL(index=interpolation)}) | ||
| 153 | algorithm | ||
| 154 | ✗ | status := OMSimulatorExt.oms_addTLMBus(cref,(domain-1),dimensions,(interpolation-1)); | |
| 155 | ✗ | then | |
| 156 | Values.INTEGER(status); | ||
| 157 | |||
| 158 | case("oms_addTLMConnection",{Values.STRING(crefA), Values.STRING(crefB), Values.REAL(delay), Values.REAL(alpha), Values.REAL(linearimpedance), Values.REAL(angularimpedance)}) | ||
| 159 | algorithm | ||
| 160 | ✗ | status := OMSimulatorExt.oms_addTLMConnection(crefA,crefB,delay,alpha,linearimpedance,angularimpedance); | |
| 161 | ✗ | then | |
| 162 | Values.INTEGER(status); | ||
| 163 | |||
| 164 | case("oms_compareSimulationResults",{Values.STRING(filenameA), Values.STRING(filenameB), Values.STRING(var), Values.REAL(relTol), Values.REAL(absTol)}) | ||
| 165 | algorithm | ||
| 166 | ✗ | status := OMSimulatorExt.oms_compareSimulationResults(filenameA,filenameB,var,relTol,absTol); | |
| 167 | ✗ | then | |
| 168 | Values.INTEGER(status); | ||
| 169 | |||
| 170 | case("oms_copySystem",{Values.STRING(source), Values.STRING(target)}) | ||
| 171 | algorithm | ||
| 172 | ✗ | status := OMSimulatorExt.oms_copySystem(source,target); | |
| 173 | ✗ | then | |
| 174 | Values.INTEGER(status); | ||
| 175 | |||
| 176 | case("oms_delete",{Values.STRING(cref)}) | ||
| 177 | algorithm | ||
| 178 | 3 | status := OMSimulatorExt.oms_delete(cref); | |
| 179 | 3 | then | |
| 180 | Values.INTEGER(status); | ||
| 181 | |||
| 182 | case("oms_deleteConnection",{Values.STRING(crefA), Values.STRING(crefB)}) | ||
| 183 | algorithm | ||
| 184 | ✗ | status := OMSimulatorExt.oms_deleteConnection(crefA,crefB); | |
| 185 | ✗ | then | |
| 186 | Values.INTEGER(status); | ||
| 187 | |||
| 188 | case("oms_deleteConnectorFromBus",{Values.STRING(busCref), Values.STRING(connectorCref)}) | ||
| 189 | algorithm | ||
| 190 | ✗ | status := OMSimulatorExt.oms_deleteConnectorFromBus(busCref,connectorCref); | |
| 191 | ✗ | then | |
| 192 | Values.INTEGER(status); | ||
| 193 | |||
| 194 | case("oms_deleteConnectorFromTLMBus",{Values.STRING(busCref), Values.STRING(connectorCref)}) | ||
| 195 | algorithm | ||
| 196 | ✗ | status := OMSimulatorExt.oms_deleteConnectorFromTLMBus(busCref,connectorCref); | |
| 197 | ✗ | then | |
| 198 | Values.INTEGER(status); | ||
| 199 | |||
| 200 | case("oms_export",{Values.STRING(cref), Values.STRING(filename)}) | ||
| 201 | algorithm | ||
| 202 | ✗ | status := OMSimulatorExt.oms_export(cref,filename); | |
| 203 | ✗ | then | |
| 204 | Values.INTEGER(status); | ||
| 205 | |||
| 206 | case("oms_exportDependencyGraphs",{Values.STRING(cref), Values.STRING(initialization), Values.STRING(event), Values.STRING(simulation)}) | ||
| 207 | algorithm | ||
| 208 | ✗ | status := OMSimulatorExt.oms_exportDependencyGraphs(cref,initialization,event,simulation); | |
| 209 | ✗ | then | |
| 210 | Values.INTEGER(status); | ||
| 211 | |||
| 212 | case("oms_exportSnapshot",{Values.STRING(cref)}) | ||
| 213 | algorithm | ||
| 214 | ✗ | (contents,status) := OMSimulatorExt.oms_exportSnapshot(cref); | |
| 215 | ✗ | then | |
| 216 | Values.TUPLE({Values.STRING(contents),Values.INTEGER(status)}); | ||
| 217 | |||
| 218 | case("oms_extractFMIKind",{Values.STRING(filename)}) | ||
| 219 | algorithm | ||
| 220 | ✗ | (kind,status) := OMSimulatorExt.oms_extractFMIKind(filename); | |
| 221 | ✗ | then | |
| 222 | Values.TUPLE({Values.INTEGER(kind),Values.INTEGER(status)}); | ||
| 223 | |||
| 224 | case("oms_getBoolean",{Values.STRING(cref)}) | ||
| 225 | algorithm | ||
| 226 | ✗ | (b,status) := OMSimulatorExt.oms_getBoolean(cref); | |
| 227 | ✗ | then | |
| 228 | Values.TUPLE({Values.BOOL(b),Values.INTEGER(status)}); | ||
| 229 | |||
| 230 | case("oms_getFixedStepSize",{Values.STRING(cref)}) | ||
| 231 | algorithm | ||
| 232 | ✗ | (rvalue,status) := OMSimulatorExt.oms_getFixedStepSize(cref); | |
| 233 | ✗ | then | |
| 234 | Values.TUPLE({Values.REAL(rvalue),Values.INTEGER(status)}); | ||
| 235 | |||
| 236 | case("oms_getInteger",{Values.STRING(cref)}) | ||
| 237 | algorithm | ||
| 238 | ✗ | (ivalue,status) := OMSimulatorExt.oms_getInteger(cref); | |
| 239 | ✗ | then | |
| 240 | Values.TUPLE({Values.INTEGER(ivalue),Values.INTEGER(status)}); | ||
| 241 | |||
| 242 | case("oms_getModelState",{Values.STRING(cref)}) | ||
| 243 | algorithm | ||
| 244 | ✗ | (ivalue,status) := OMSimulatorExt.oms_getModelState(cref); | |
| 245 | ✗ | then | |
| 246 | Values.TUPLE({Values.INTEGER(ivalue),Values.INTEGER(status)}); | ||
| 247 | |||
| 248 | case("oms_getReal",{Values.STRING(cref)}) | ||
| 249 | algorithm | ||
| 250 | 14 | (rvalue,status) := OMSimulatorExt.oms_getReal(cref); | |
| 251 | 28 | then | |
| 252 | Values.TUPLE({Values.REAL(rvalue),Values.INTEGER(status)}); | ||
| 253 | |||
| 254 | case("oms_getSolver",{Values.STRING(cref)}) | ||
| 255 | algorithm | ||
| 256 | ✗ | (ivalue,status) := OMSimulatorExt.oms_getSolver(cref); | |
| 257 | ✗ | then | |
| 258 | Values.TUPLE({Values.INTEGER(ivalue),Values.INTEGER(status)}); | ||
| 259 | |||
| 260 | case("oms_getStartTime",{Values.STRING(cref)}) | ||
| 261 | algorithm | ||
| 262 | ✗ | (rvalue,status) := OMSimulatorExt.oms_getStartTime(cref); | |
| 263 | ✗ | then | |
| 264 | Values.TUPLE({Values.REAL(rvalue),Values.INTEGER(status)}); | ||
| 265 | |||
| 266 | case("oms_getStopTime",{Values.STRING(cref)}) | ||
| 267 | algorithm | ||
| 268 | ✗ | (rvalue,status) := OMSimulatorExt.oms_getStopTime(cref); | |
| 269 | ✗ | then | |
| 270 | Values.TUPLE({Values.REAL(rvalue),Values.INTEGER(status)}); | ||
| 271 | |||
| 272 | case("oms_getSubModelPath",{Values.STRING(cref)}) | ||
| 273 | algorithm | ||
| 274 | ✗ | (path,status) := OMSimulatorExt.oms_getSubModelPath(cref); | |
| 275 | ✗ | then | |
| 276 | Values.TUPLE({Values.STRING(path),Values.INTEGER(status)}); | ||
| 277 | |||
| 278 | case("oms_getSystemType",{Values.STRING(cref)}) | ||
| 279 | algorithm | ||
| 280 | ✗ | (ivalue,status) := OMSimulatorExt.oms_getSystemType(cref); | |
| 281 | ✗ | then | |
| 282 | Values.TUPLE({Values.INTEGER(ivalue),Values.INTEGER(status)}); | ||
| 283 | |||
| 284 | case("oms_getTolerance",{Values.STRING(cref)}) | ||
| 285 | algorithm | ||
| 286 | ✗ | (absoluteTolerance,relativeTolerance,status) := OMSimulatorExt.oms_getTolerance(cref); | |
| 287 | ✗ | then | |
| 288 | Values.TUPLE({Values.REAL(absoluteTolerance),Values.REAL(relativeTolerance),Values.INTEGER(status)}); | ||
| 289 | |||
| 290 | case("oms_getVariableStepSize",{Values.STRING(cref)}) | ||
| 291 | algorithm | ||
| 292 | ✗ | (initialStepSize,minimumStepSize,maximumStepSize,status) := OMSimulatorExt.oms_getVariableStepSize(cref); | |
| 293 | ✗ | then | |
| 294 | Values.TUPLE({Values.REAL(initialStepSize),Values.REAL(minimumStepSize),Values.REAL(maximumStepSize),Values.INTEGER(status)}); | ||
| 295 | |||
| 296 | case("oms_faultInjection",{Values.STRING(signal), Values.ENUM_LITERAL(index=faultType), Values.REAL(faultValue)}) | ||
| 297 | algorithm | ||
| 298 | ✗ | status := OMSimulatorExt.oms_faultInjection(signal,faultType-1,faultValue); | |
| 299 | ✗ | then | |
| 300 | Values.INTEGER(status); | ||
| 301 | |||
| 302 | case("oms_importFile",{Values.STRING(filename)}) | ||
| 303 | algorithm | ||
| 304 | ✗ | (cref,status) := OMSimulatorExt.oms_importFile(filename); | |
| 305 | ✗ | then | |
| 306 | Values.TUPLE({Values.STRING(cref),Values.INTEGER(status)}); | ||
| 307 | |||
| 308 | case("oms_importSnapshot",{Values.STRING(cref), Values.STRING(snapshot)}) | ||
| 309 | algorithm | ||
| 310 | ✗ | status := OMSimulatorExt.oms_importSnapshot(cref,snapshot); | |
| 311 | ✗ | then | |
| 312 | Values.INTEGER(status); | ||
| 313 | |||
| 314 | case("oms_initialize",{Values.STRING(cref)}) | ||
| 315 | algorithm | ||
| 316 | 3 | status := OMSimulatorExt.oms_initialize(cref); | |
| 317 | 3 | then | |
| 318 | Values.INTEGER(status); | ||
| 319 | |||
| 320 | case("oms_instantiate",{Values.STRING(cref)}) | ||
| 321 | algorithm | ||
| 322 | 3 | status := OMSimulatorExt.oms_instantiate(cref); | |
| 323 | 3 | then | |
| 324 | Values.INTEGER(status); | ||
| 325 | |||
| 326 | case("oms_list",{Values.STRING(cref)}) | ||
| 327 | algorithm | ||
| 328 | ✗ | (contents,status) := OMSimulatorExt.oms_list(cref); | |
| 329 | ✗ | then | |
| 330 | Values.TUPLE({Values.STRING(contents),Values.INTEGER(status)}); | ||
| 331 | |||
| 332 | case("oms_listUnconnectedConnectors",{Values.STRING(cref)}) | ||
| 333 | algorithm | ||
| 334 | ✗ | (contents,status) := OMSimulatorExt.oms_listUnconnectedConnectors(cref); | |
| 335 | ✗ | then | |
| 336 | Values.TUPLE({Values.STRING(contents),Values.INTEGER(status)}); | ||
| 337 | |||
| 338 | case("oms_loadSnapshot",{Values.STRING(cref), Values.STRING(snapshot)}) | ||
| 339 | algorithm | ||
| 340 | ✗ | (newCref,status) := OMSimulatorExt.oms_loadSnapshot(cref,snapshot); | |
| 341 | ✗ | then | |
| 342 | Values.TUPLE({Values.STRING(newCref),Values.INTEGER(status)}); | ||
| 343 | |||
| 344 | case("oms_newModel",{Values.STRING(cref)}) | ||
| 345 | algorithm | ||
| 346 | 3 | status := OMSimulatorExt.oms_newModel(cref); | |
| 347 | 3 | then | |
| 348 | Values.INTEGER(status); | ||
| 349 | |||
| 350 | case("oms_removeSignalsFromResults",{Values.STRING(cref), Values.STRING(regex)}) | ||
| 351 | algorithm | ||
| 352 | ✗ | status := OMSimulatorExt.oms_removeSignalsFromResults(cref,regex); | |
| 353 | ✗ | then | |
| 354 | Values.INTEGER(status); | ||
| 355 | |||
| 356 | case("oms_rename",{Values.STRING(cref), Values.STRING(newCref)}) | ||
| 357 | algorithm | ||
| 358 | ✗ | status := OMSimulatorExt.oms_rename(cref,newCref); | |
| 359 | ✗ | then | |
| 360 | Values.INTEGER(status); | ||
| 361 | |||
| 362 | case("oms_reset",{Values.STRING(cref)}) | ||
| 363 | algorithm | ||
| 364 | ✗ | status := OMSimulatorExt.oms_reset(cref); | |
| 365 | ✗ | then | |
| 366 | Values.INTEGER(status); | ||
| 367 | |||
| 368 | case("oms_RunFile",{Values.STRING(filename)}) | ||
| 369 | algorithm | ||
| 370 | ✗ | status := OMSimulatorExt.oms_RunFile(filename); | |
| 371 | ✗ | then | |
| 372 | Values.INTEGER(status); | ||
| 373 | |||
| 374 | case("oms_setBoolean",{Values.STRING(cref),Values.BOOL(b)}) | ||
| 375 | algorithm | ||
| 376 | ✗ | status := OMSimulatorExt.oms_setBoolean(cref,b); | |
| 377 | ✗ | then | |
| 378 | Values.INTEGER(status); | ||
| 379 | |||
| 380 | case("oms_setCommandLineOption",{Values.STRING(cmd)}) | ||
| 381 | algorithm | ||
| 382 | 3 | status := OMSimulatorExt.oms_setCommandLineOption(cmd); | |
| 383 | 3 | then | |
| 384 | Values.INTEGER(status); | ||
| 385 | |||
| 386 | case("oms_setFixedStepSize",{Values.STRING(cref), Values.REAL(stepSize)}) | ||
| 387 | algorithm | ||
| 388 | ✗ | status := OMSimulatorExt.oms_setFixedStepSize(cref,stepSize); | |
| 389 | ✗ | then | |
| 390 | Values.INTEGER(status); | ||
| 391 | |||
| 392 | case("oms_setInteger",{Values.STRING(cref), Values.INTEGER(ivalue)}) | ||
| 393 | algorithm | ||
| 394 | ✗ | status := OMSimulatorExt.oms_setInteger(cref,ivalue); | |
| 395 | ✗ | then | |
| 396 | Values.INTEGER(status); | ||
| 397 | |||
| 398 | case("oms_setLogFile",{Values.STRING(filename)}) | ||
| 399 | algorithm | ||
| 400 | 2 | status := OMSimulatorExt.oms_setLogFile(filename); | |
| 401 | 2 | then | |
| 402 | Values.INTEGER(status); | ||
| 403 | |||
| 404 | case("oms_setLoggingInterval",{Values.STRING(cref), Values.REAL(loggingInterval)}) | ||
| 405 | algorithm | ||
| 406 | ✗ | status := OMSimulatorExt.oms_setLoggingInterval(cref,loggingInterval); | |
| 407 | ✗ | then | |
| 408 | Values.INTEGER(status); | ||
| 409 | |||
| 410 | case("oms_setLoggingLevel",{Values.INTEGER(logLevel)}) | ||
| 411 | algorithm | ||
| 412 | ✗ | status := OMSimulatorExt.oms_setLoggingLevel(logLevel); | |
| 413 | ✗ | then | |
| 414 | Values.INTEGER(status); | ||
| 415 | |||
| 416 | case("oms_setReal",{Values.STRING(cref), Values.REAL(rvalue)}) | ||
| 417 | algorithm | ||
| 418 | 3 | status := OMSimulatorExt.oms_setReal(cref,rvalue); | |
| 419 | 3 | then | |
| 420 | Values.INTEGER(status); | ||
| 421 | |||
| 422 | case("oms_setRealInputDerivative",{Values.STRING(cref), Values.REAL(rvalue)}) | ||
| 423 | algorithm | ||
| 424 | ✗ | status := OMSimulatorExt.oms_setRealInputDerivative(cref,rvalue); | |
| 425 | ✗ | then | |
| 426 | Values.INTEGER(status); | ||
| 427 | |||
| 428 | case("oms_setResultFile",{Values.STRING(cref), Values.STRING(filename), Values.INTEGER(bufferSize)}) | ||
| 429 | algorithm | ||
| 430 | 1 | status := OMSimulatorExt.oms_setResultFile(cref,filename,bufferSize); | |
| 431 | 1 | then | |
| 432 | Values.INTEGER(status); | ||
| 433 | |||
| 434 | case("oms_setSignalFilter",{Values.STRING(cref), Values.STRING(regex)}) | ||
| 435 | algorithm | ||
| 436 | ✗ | status := OMSimulatorExt.oms_setSignalFilter(cref,regex); | |
| 437 | ✗ | then | |
| 438 | Values.INTEGER(status); | ||
| 439 | |||
| 440 | case("oms_setSolver",{Values.STRING(cref), Values.ENUM_LITERAL(index=solver)}) | ||
| 441 | algorithm | ||
| 442 | ✗ | status := OMSimulatorExt.oms_setSolver(cref,solver-1); | |
| 443 | ✗ | then | |
| 444 | Values.INTEGER(status); | ||
| 445 | |||
| 446 | case("oms_setStartTime",{Values.STRING(cref), Values.REAL(startTime)}) | ||
| 447 | algorithm | ||
| 448 | ✗ | status := OMSimulatorExt.oms_setStartTime(cref,startTime); | |
| 449 | ✗ | then | |
| 450 | Values.INTEGER(status); | ||
| 451 | |||
| 452 | case("oms_setStopTime",{Values.STRING(cref), Values.REAL(stopTime)}) | ||
| 453 | algorithm | ||
| 454 | 1 | status := OMSimulatorExt.oms_setStopTime(cref,stopTime); | |
| 455 | 1 | then | |
| 456 | Values.INTEGER(status); | ||
| 457 | |||
| 458 | case("oms_setTempDirectory",{Values.STRING(newTempDir)}) | ||
| 459 | algorithm | ||
| 460 | 3 | status := OMSimulatorExt.oms_setTempDirectory(newTempDir); | |
| 461 | 3 | then | |
| 462 | Values.INTEGER(status); | ||
| 463 | |||
| 464 | case("oms_setTLMPositionAndOrientation",{Values.STRING(cref), Values.REAL(x1), Values.REAL(x2), Values.REAL(x3), Values.REAL(A11), Values.REAL(A12), Values.REAL(A13), Values.REAL(A21), Values.REAL(A22), Values.REAL(A23), Values.REAL(A31), Values.REAL(A32), Values.REAL(A33)}) | ||
| 465 | algorithm | ||
| 466 | ✗ | status := OMSimulatorExt.oms_setTLMPositionAndOrientation(cref,x1,x2,x3,A11,A12,A13,A21,A22,A23,A31,A32,A33); | |
| 467 | ✗ | then | |
| 468 | Values.INTEGER(status); | ||
| 469 | |||
| 470 | case("oms_setTLMSocketData",{Values.STRING(cref), Values.STRING(address), Values.INTEGER(managerPort), Values.INTEGER(monitorPort)}) | ||
| 471 | algorithm | ||
| 472 | ✗ | status := OMSimulatorExt.oms_setTLMSocketData(cref,address,managerPort,monitorPort); | |
| 473 | ✗ | then | |
| 474 | Values.INTEGER(status); | ||
| 475 | |||
| 476 | case("oms_setTolerance",{Values.STRING(cref), Values.REAL(absoluteTolerance), Values.REAL(relativeTolerance)}) | ||
| 477 | algorithm | ||
| 478 | ✗ | status := OMSimulatorExt.oms_setTolerance(cref,absoluteTolerance,relativeTolerance); | |
| 479 | ✗ | then | |
| 480 | Values.INTEGER(status); | ||
| 481 | |||
| 482 | case("oms_setVariableStepSize",{Values.STRING(cref), Values.REAL(initialStepSize), Values.REAL(minimumStepSize), Values.REAL(maximumStepSize)}) | ||
| 483 | algorithm | ||
| 484 | 1 | status := OMSimulatorExt.oms_setVariableStepSize(cref,initialStepSize,minimumStepSize,maximumStepSize); | |
| 485 | 1 | then | |
| 486 | Values.INTEGER(status); | ||
| 487 | |||
| 488 | case("oms_setWorkingDirectory",{Values.STRING(newWorkingDir)}) | ||
| 489 | algorithm | ||
| 490 | ✗ | status := OMSimulatorExt.oms_setWorkingDirectory(newWorkingDir); | |
| 491 | ✗ | then | |
| 492 | Values.INTEGER(status); | ||
| 493 | |||
| 494 | case("oms_simulate",{Values.STRING(cref)}) | ||
| 495 | algorithm | ||
| 496 | 3 | status := OMSimulatorExt.oms_simulate(cref); | |
| 497 | 3 | then | |
| 498 | Values.INTEGER(status); | ||
| 499 | |||
| 500 | case("oms_stepUntil",{Values.STRING(cref), Values.REAL(stopTime)}) | ||
| 501 | algorithm | ||
| 502 | ✗ | status := OMSimulatorExt.oms_stepUntil(cref,stopTime); | |
| 503 | ✗ | then | |
| 504 | Values.INTEGER(status); | ||
| 505 | |||
| 506 | case("oms_terminate",{Values.STRING(cref)}) | ||
| 507 | algorithm | ||
| 508 | 3 | status := OMSimulatorExt.oms_terminate(cref); | |
| 509 | 3 | then | |
| 510 | Values.INTEGER(status); | ||
| 511 | |||
| 512 | case ("oms_getVersion",{}) | ||
| 513 | algorithm | ||
| 514 | ✗ | version := OMSimulatorExt.oms_getVersion(); | |
| 515 | ✗ | then | |
| 516 | Values.STRING(version); | ||
| 517 | end match; | ||
| 518 | end ceval; | ||
| 519 | annotation(__OpenModelica_Interface="backend_tools"); | ||
| 520 | end CevalScriptOMSimulator; | ||
| 521 |