-
Notifications
You must be signed in to change notification settings - Fork 0
/
OMSimulator.mo
540 lines (465 loc) · 17.9 KB
/
OMSimulator.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
encapsulated package OMSimulator
" file: OMSimulator.mo
package: OMSimulator
description: This file contains OMSimulator wrapper functions which are implemented in C and Linked through DLL.
"
function oms_addBus
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_addBus(cref) annotation(Library = "omcruntime");
end oms_addBus;
function oms_addConnection
input String crefA;
input String crefB;
output Integer status;
external "C" status = OMSimulator_oms_addConnection(crefA,crefB) annotation(Library = "omcruntime");
end oms_addConnection;
function oms_addConnector
input String cref;
input Integer causality;
input Integer type_;
output Integer status;
external "C" status = OMSimulator_oms_addConnector(cref,causality,type_) annotation(Library = "omcruntime");
end oms_addConnector;
function oms_addConnectorToBus
input String busCref;
input String connectorCref;
output Integer status;
external "C" status = OMSimulator_oms_addConnectorToBus(busCref,connectorCref) annotation(Library = "omcruntime");
end oms_addConnectorToBus;
function oms_addConnectorToTLMBus
input String busCref;
input String connectorCref;
input String type_;
output Integer status;
external "C" status = OMSimulator_oms_addConnectorToTLMBus(busCref,connectorCref,type_) annotation(Library = "omcruntime");
end oms_addConnectorToTLMBus;
function oms_addDynamicValueIndicator
input String signal;
input String lower;
input String upper;
input Real stepSize;
output Integer status;
external "C" status = OMSimulator_oms_addDynamicValueIndicator(signal,lower,upper,stepSize) annotation(Library = "omcruntime");
end oms_addDynamicValueIndicator;
function oms_addEventIndicator
input String signal;
output Integer status;
external "C" status = OMSimulator_oms_addEventIndicator(signal) annotation(Library = "omcruntime");
end oms_addEventIndicator;
function oms_addExternalModel
input String cref;
input String path;
input String startscript;
output Integer status;
external "C" status = OMSimulator_oms_addExternalModel(cref,path,startscript) annotation(Library = "omcruntime");
end oms_addExternalModel;
function oms_addSignalsToResults
input String cref;
input String regex;
output Integer status;
external "C" status = OMSimulator_oms_addSignalsToResults(cref,regex) annotation(Library = "omcruntime");
end oms_addSignalsToResults;
function oms_addStaticValueIndicator
input String signal;
input Real lower;
input Real upper;
input Real stepSize;
output Integer status;
external "C" status = OMSimulator_oms_addStaticValueIndicator(signal,lower,upper,stepSize) annotation(Library = "omcruntime");
end oms_addStaticValueIndicator;
function oms_addSubModel
input String cref;
input String fmuPath;
output Integer status;
external "C" status = OMSimulator_oms_addSubModel(cref,fmuPath) annotation(Library = "omcruntime");
end oms_addSubModel;
function oms_addSystem
input String cref;
input Integer type_;
output Integer status;
external "C" status = OMSimulator_oms_addSystem(cref,type_) annotation(Library = "omcruntime");
end oms_addSystem;
function oms_addTimeIndicator
input String signal;
output Integer status;
external "C" status = OMSimulator_oms_addTimeIndicator(signal) annotation(Library = "omcruntime");
end oms_addTimeIndicator;
function oms_addTLMBus
input String cref;
input Integer domain;
input const int dimensions;
input const oms_tlm_interpolation_t interpolation;
output Integer status;
external "C" status = OMSimulator_oms_addTLMBus(cref,domain,dimensions,interpolation) annotation(Library = "omcruntime");
end oms_addTLMBus;
function oms_addTLMConnection
input String crefA;
input String crefB;
input Real delay;
input Real alpha;
input Real linearimpedance;
input Real angularimpedance;
output Integer status;
external "C" status = OMSimulator_oms_addTLMConnection(crefA,crefB,delay,alpha,linearimpedance,angularimpedance) annotation(Library = "omcruntime");
end oms_addTLMConnection;
function oms_cancelSimulation_asynchronous
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_cancelSimulation_asynchronous(cref) annotation(Library = "omcruntime");
end oms_cancelSimulation_asynchronous;
function oms_compareSimulationResults
input String filenameA;
input String filenameB;
input String var;
input Real relTol;
input Real absTol;
output Integer status;
external "C" status = OMSimulator_oms_compareSimulationResults(filenameA,filenameB,var,relTol,absTol) annotation(Library = "omcruntime");
end oms_compareSimulationResults;
function oms_copySystem
input String source;
input String target;
output Integer status;
external "C" status = OMSimulator_oms_copySystem(source,target) annotation(Library = "omcruntime");
end oms_copySystem;
function oms_delete
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_delete(cref) annotation(Library = "omcruntime");
end oms_delete;
function oms_deleteConnection
input String crefA;
input String crefB;
output Integer status;
external "C" status = OMSimulator_oms_deleteConnection(crefA,crefB) annotation(Library = "omcruntime");
end oms_deleteConnection;
function oms_deleteConnectorFromBus
input String busCref;
input String connectorCref;
output Integer status;
external "C" status = OMSimulator_oms_deleteConnectorFromBus(busCref,connectorCref) annotation(Library = "omcruntime");
end oms_deleteConnectorFromBus;
function oms_deleteConnectorFromTLMBus
input String busCref;
input String connectorCref;
output Integer status;
external "C" status = OMSimulator_oms_deleteConnectorFromTLMBus(busCref,connectorCref) annotation(Library = "omcruntime");
end oms_deleteConnectorFromTLMBus;
function oms_export
input String cref;
input String filename;
output Integer status;
external "C" status = OMSimulator_oms_export(cref,filename) annotation(Library = "omcruntime");
end oms_export;
function oms_exportDependencyGraphs
input String cref;
input String initialization;
input String simulation;
output Integer status;
external "C" status = OMSimulator_oms_exportDependencyGraphs(cref,initialization,simulation) annotation(Library = "omcruntime");
end oms_exportDependencyGraphs;
function oms_extractFMIKind
input String filename;
input Integer kind;
output Integer status;
external "C" status = OMSimulator_oms_extractFMIKind(filename,kind) annotation(Library = "omcruntime");
end oms_extractFMIKind;
function oms_getBoolean
input String cref;
input bool* value;
output Integer status;
external "C" status = OMSimulator_oms_getBoolean(cref,value) annotation(Library = "omcruntime");
end oms_getBoolean;
function oms_getFixedStepSize
input String cref;
input Real stepSize;
output Integer status;
external "C" status = OMSimulator_oms_getFixedStepSize(cref,stepSize) annotation(Library = "omcruntime");
end oms_getFixedStepSize;
function oms_getInteger
input String cref;
input Integer value;
output Integer status;
external "C" status = OMSimulator_oms_getInteger(cref,value) annotation(Library = "omcruntime");
end oms_getInteger;
function oms_getModelState
input String cref;
input oms_modelState_enu_t* modelState;
output Integer status;
external "C" status = OMSimulator_oms_getModelState(cref,modelState) annotation(Library = "omcruntime");
end oms_getModelState;
function oms_getReal
input String cref;
input Real value;
output Integer status;
external "C" status = OMSimulator_oms_getReal(cref,value) annotation(Library = "omcruntime");
end oms_getReal;
function oms_getSolver
input String cref;
input oms_solver_enu_t* solver;
output Integer status;
external "C" status = OMSimulator_oms_getSolver(cref,solver) annotation(Library = "omcruntime");
end oms_getSolver;
function oms_getStartTime
input String cref;
input Real startTime;
output Integer status;
external "C" status = OMSimulator_oms_getStartTime(cref,startTime) annotation(Library = "omcruntime");
end oms_getStartTime;
function oms_getStopTime
input String cref;
input Real stopTime;
output Integer status;
external "C" status = OMSimulator_oms_getStopTime(cref,stopTime) annotation(Library = "omcruntime");
end oms_getStopTime;
function oms_getSubModelPath
input String cref;
input String path;
output Integer status;
external "C" status = OMSimulator_oms_getSubModelPath(cref,path) annotation(Library = "omcruntime");
end oms_getSubModelPath;
function oms_getSystemType
input String cref;
input oms_system_enu_t* type_;
output Integer status;
external "C" status = OMSimulator_oms_getSystemType(cref,type_) annotation(Library = "omcruntime");
end oms_getSystemType;
function oms_getTolerance
input String cref;
input Real absoluteTolerance;
input Real relativeTolerance;
output Integer status;
external "C" status = OMSimulator_oms_getTolerance(cref,absoluteTolerance,relativeTolerance) annotation(Library = "omcruntime");
end oms_getTolerance;
function oms_getVariableStepSize
input String cref;
input Real initialStepSize;
input Real minimumStepSize;
input Real maximumStepSize;
output Integer status;
external "C" status = OMSimulator_oms_getVariableStepSize(cref,initialStepSize,minimumStepSize,maximumStepSize) annotation(Library = "omcruntime");
end oms_getVariableStepSize;
function oms_faultInjection
input String signal;
input Integer faultType;
input Real faultValue;
output Integer status;
external "C" status = OMSimulator_oms_faultInjection(signal,faultType,faultValue) annotation(Library = "omcruntime");
end oms_faultInjection;
function oms_importFile
input String filename;
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_importFile(filename,cref) annotation(Library = "omcruntime");
end oms_importFile;
function oms_initialize
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_initialize(cref) annotation(Library = "omcruntime");
end oms_initialize;
function oms_instantiate
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_instantiate(cref) annotation(Library = "omcruntime");
end oms_instantiate;
function oms_list
input String cref;
input String contents;
output Integer status;
external "C" status = OMSimulator_oms_list(cref,contents) annotation(Library = "omcruntime");
end oms_list;
function oms_listUnconnectedConnectors
input String cref;
input String contents;
output Integer status;
external "C" status = OMSimulator_oms_listUnconnectedConnectors(cref,contents) annotation(Library = "omcruntime");
end oms_listUnconnectedConnectors;
function oms_loadSnapshot
input String cref;
input String snapshot;
output Integer status;
external "C" status = OMSimulator_oms_loadSnapshot(cref,snapshot) annotation(Library = "omcruntime");
end oms_loadSnapshot;
function oms_newModel
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_newModel(cref) annotation(Library = "omcruntime");
end oms_newModel;
function oms_parseModelName
input String contents;
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_parseModelName(contents,cref) annotation(Library = "omcruntime");
end oms_parseModelName;
function oms_removeSignalsFromResults
input String cref;
input String regex;
output Integer status;
external "C" status = OMSimulator_oms_removeSignalsFromResults(cref,regex) annotation(Library = "omcruntime");
end oms_removeSignalsFromResults;
function oms_rename
input String cref;
input String newCref;
output Integer status;
external "C" status = OMSimulator_oms_rename(cref,newCref) annotation(Library = "omcruntime");
end oms_rename;
function oms_reset
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_reset(cref) annotation(Library = "omcruntime");
end oms_reset;
function oms_RunFile
input String filename;
output Integer status;
external "C" status = OMSimulator_oms_RunFile(filename) annotation(Library = "omcruntime");
end oms_RunFile;
function oms_setBoolean
input String cref;
input bool value;
output Integer status;
external "C" status = OMSimulator_oms_setBoolean(cref,value) annotation(Library = "omcruntime");
end oms_setBoolean;
function oms_setCommandLineOption
input String cmd;
output Integer status;
external "C" status = OMSimulator_oms_setCommandLineOption(cmd) annotation(Library = "omcruntime");
end oms_setCommandLineOption;
function oms_setFixedStepSize
input String cref;
input Real stepSize;
output Integer status;
external "C" status = OMSimulator_oms_setFixedStepSize(cref,stepSize) annotation(Library = "omcruntime");
end oms_setFixedStepSize;
function oms_setInteger
input String cref;
input Integer value;
output Integer status;
external "C" status = OMSimulator_oms_setInteger(cref,value) annotation(Library = "omcruntime");
end oms_setInteger;
function oms_setLogFile
input String filename;
output Integer status;
external "C" status = OMSimulator_oms_setLogFile(filename) annotation(Library = "omcruntime");
end oms_setLogFile;
function oms_setLoggingInterval
input String cref;
input Real loggingInterval;
output Integer status;
external "C" status = OMSimulator_oms_setLoggingInterval(cref,loggingInterval) annotation(Library = "omcruntime");
end oms_setLoggingInterval;
function oms_setLoggingLevel
input Integer logLevel;
output Integer status;
external "C" status = OMSimulator_oms_setLoggingLevel(logLevel) annotation(Library = "omcruntime");
end oms_setLoggingLevel;
function oms_setReal
input String cref;
input Real value;
output Integer status;
external "C" status = OMSimulator_oms_setReal(cref,value) annotation(Library = "omcruntime");
end oms_setReal;
function oms_setRealInputDerivative
input String cref;
input Real value;
output Integer status;
external "C" status = OMSimulator_oms_setRealInputDerivative(cref,value) annotation(Library = "omcruntime");
end oms_setRealInputDerivative;
function oms_setResultFile
input String cref;
input String filename;
input Integer bufferSize;
output Integer status;
external "C" status = OMSimulator_oms_setResultFile(cref,filename,bufferSize) annotation(Library = "omcruntime");
end oms_setResultFile;
function oms_setSignalFilter
input String cref;
input String regex;
output Integer status;
external "C" status = OMSimulator_oms_setSignalFilter(cref,regex) annotation(Library = "omcruntime");
end oms_setSignalFilter;
function oms_setSolver
input String cref;
input Integer solver;
output Integer status;
external "C" status = OMSimulator_oms_setSolver(cref,solver) annotation(Library = "omcruntime");
end oms_setSolver;
function oms_setStartTime
input String cref;
input Real startTime;
output Integer status;
external "C" status = OMSimulator_oms_setStartTime(cref,startTime) annotation(Library = "omcruntime");
end oms_setStartTime;
function oms_setStopTime
input String cref;
input Real stopTime;
output Integer status;
external "C" status = OMSimulator_oms_setStopTime(cref,stopTime) annotation(Library = "omcruntime");
end oms_setStopTime;
function oms_setTempDirectory
input String newTempDir;
output Integer status;
external "C" status = OMSimulator_oms_setTempDirectory(newTempDir) annotation(Library = "omcruntime");
end oms_setTempDirectory;
function oms_setTLMPositionAndOrientation
input String cref;
input Real x1;
input Real x2;
input Real x3;
input Real A11;
input Real A12;
input Real A13;
input Real A21;
input Real A22;
input Real A23;
input Real A31;
input Real A32;
input Real A33;
output Integer status;
external "C" status = OMSimulator_oms_setTLMPositionAndOrientation(cref,x1,x2,x3,A11,A12,A13,A21,A22,A23,A31,A32,A33) annotation(Library = "omcruntime");
end oms_setTLMPositionAndOrientation;
function oms_setTLMSocketData
input String cref;
input String address;
input Integer managerPort;
input Integer monitorPort;
output Integer status;
external "C" status = OMSimulator_oms_setTLMSocketData(cref,address,managerPort,monitorPort) annotation(Library = "omcruntime");
end oms_setTLMSocketData;
function oms_setTolerance
input String cref;
input Real absoluteTolerance;
input Real relativeTolerance;
output Integer status;
external "C" status = OMSimulator_oms_setTolerance(cref,absoluteTolerance,relativeTolerance) annotation(Library = "omcruntime");
end oms_setTolerance;
function oms_setVariableStepSize
input String cref;
input Real initialStepSize;
input Real minimumStepSize;
input Real maximumStepSize;
output Integer status;
external "C" status = OMSimulator_oms_setVariableStepSize(cref,initialStepSize,minimumStepSize,maximumStepSize) annotation(Library = "omcruntime");
end oms_setVariableStepSize;
function oms_setWorkingDirectory
input String newWorkingDir;
output Integer status;
external "C" status = OMSimulator_oms_setWorkingDirectory(newWorkingDir) annotation(Library = "omcruntime");
end oms_setWorkingDirectory;
function oms_simulate
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_simulate(cref) annotation(Library = "omcruntime");
end oms_simulate;
function oms_stepUntil
input String cref;
input Real stopTime;
output Integer status;
external "C" status = OMSimulator_oms_stepUntil(cref,stopTime) annotation(Library = "omcruntime");
end oms_stepUntil;
function oms_terminate
input String cref;
output Integer status;
external "C" status = OMSimulator_oms_terminate(cref) annotation(Library = "omcruntime");
end oms_terminate;
end OMSimulator;