1+ "class fmuModelInst\n"
2+ " extends ExternalObject;\n"
3+ " function constructor\n"
4+ " input fmuFunctions in_fmufun;\n"
5+ " input String in_instName;\n"
6+ " input String guid;\n"
7+ " input fmuCallbackFuns functions;\n"
8+ " input Boolean logFlag;\n"
9+ " output fmuModelInst inst;\n"
10+ " external \"C\" inst = fmiInstantiate(in_fmufun,in_instName,guid,functions,logFlag) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
11+ " end constructor;\n"
12+ " function destructor\n"
13+ " input fmuModelInst in_inst;\n"
14+ " external \"C\" fmiFreeDummy(in_inst) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
15+ " end destructor;\n"
16+ " end fmuModelInst;\n"
17+ " \n"
18+ " class fmuLoadDll \"load dll from FMU\"\n"
19+ " extends ExternalObject;\n"
20+ " function constructor\n"
21+ " input fmuFunctions in_fmufun;\n"
22+ " input String in_dllPath;\n"
23+ " output fmuLoadDll dummy;\n"
24+ " external \"C\" dummy = loadFMUDll(in_fmufun,in_dllPath) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
25+ " end constructor;\n"
26+ " function destructor\n"
27+ " external \"C\" freeFMUDll() annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
28+ " end destructor;\n"
29+ " end fmuLoadDll;\n"
30+ " \n"
31+ " class fmuFunctions \"List of interface functions defined in FMI 1.0\"\n"
32+ " extends ExternalObject;\n"
33+ " function constructor\n"
34+ " input String mid;\n"
35+ " input String dllPath;\n"
36+ " output fmuFunctions fmufun;\n"
37+ " external \"C\" fmufun = instantiateFMIFun(mid,dllPath) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
38+ " end constructor;\n"
39+ " function destructor\n"
40+ " input fmuFunctions fmufun;\n"
41+ " external \"C\" fmiFreeDummy(fmufun) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
42+ " end destructor;\n"
43+ " end fmuFunctions;\n"
44+ " \n"
45+ " class fmuCallbackFuns \"Construct for callbacks defined in FMU\"\n"
46+ " extends ExternalObject;\n"
47+ " function constructor\n"
48+ " output fmuCallbackFuns functions;\n"
49+ " external \"C\" functions = fmiCallbackFuns() annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
50+ " end constructor;\n"
51+ " function destructor\n"
52+ " input fmuCallbackFuns functions;\n"
53+ " external \"C\" fmiFreeDummy(functions) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
54+ " end destructor;\n"
55+ " end fmuCallbackFuns;\n"
56+ " \n"
57+ " function fmuSetTime\n"
58+ " input fmuFunctions fmufun;\n"
59+ " input fmuModelInst inst;\n"
60+ " input Real in_time;\n"
61+ " external \"C\" fmiSetT(fmufun,inst,in_time) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
62+ " end fmuSetTime;\n"
63+ " \n"
64+ " function fmuSetContStates \"set values of continuous states\"\n"
65+ " input fmuFunctions fmufun;\n"
66+ " input fmuModelInst in_inst;\n"
67+ " input Integer nx;\n"
68+ " input Real x[nx];\n"
69+ " external \"C\" fmiSetContStates(fmufun,in_inst,x,nx) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
70+ " end fmuSetContStates;\n"
71+ " \n"
72+ " function fmuSetRealVR \"set values of real variables via value references\"\n"
73+ " input fmuFunctions fmufun;\n"
74+ " input fmuModelInst in_inst;\n"
75+ " input Integer nr;\n"
76+ " input Integer in_vr[nr];\n"
77+ " input Real in_rv[nr];\n"
78+ " external \"C\" fmiSetRealVR(fmufun,in_inst,in_vr,in_rv,nr) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
79+ " end fmuSetRealVR;\n"
80+ " \n"
81+ " function fmuSetIntegerVR \"set values of integer variables via value references\"\n"
82+ " input fmuFunctions fmufun;\n"
83+ " input fmuModelInst in_inst;\n"
84+ " input Integer ni;\n"
85+ " input Integer in_vr[ni];\n"
86+ " input Integer in_iv[ni];\n"
87+ " external \"C\" fmiSetIntegerVR(fmufun,in_inst,in_vr,in_iv,ni) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
88+ " end fmuSetIntegerVR;\n"
89+ " \n"
90+ " function fmuSetStringVR \"set values of string variables via value references\"\n"
91+ " input fmuFunctions fmufun;\n"
92+ " input fmuModelInst in_inst;\n"
93+ " input Integer ns;\n"
94+ " input Integer in_vr[ns];\n"
95+ " input String in_sv[ns];\n"
96+ " external \"C\" fmiSetStringVR(fmufun,in_inst,in_vr,in_sv,ns) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
97+ " end fmuSetStringVR;\n"
98+ " \n"
99+ " function fmuSetBooleanVR \"set values of boolean variables via value references\"\n"
100+ " input fmuFunctions fmufun;\n"
101+ " input fmuModelInst in_inst;\n"
102+ " input Integer nb;\n"
103+ " input Integer in_vr[nb];\n"
104+ " input Boolean in_bv[nb];\n"
105+ " external \"C\" fmiSetBooleanVR(fmufun,in_inst,in_vr,in_bv,nb) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
106+ " end fmuSetBooleanVR;\n"
107+ " \n"
108+ " function fmuGetContStates \"get values of continuous states\"\n"
109+ " input fmuFunctions fmufun;\n"
110+ " input fmuModelInst in_inst;\n"
111+ " input Integer nx;\n"
112+ " output Real in_x[nx];\n"
113+ " external \"C\" fmiGetContStates(fmufun,in_inst,in_x,nx) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
114+ " end fmuGetContStates;\n"
115+ " \n"
116+ " function fmuGetRealVR \"get values of real variables via value references\"\n"
117+ " input fmuFunctions fmufun;\n"
118+ " input fmuModelInst in_inst;\n"
119+ " input Integer nr;\n"
120+ " input Integer in_vr[nr];\n"
121+ " output Real rv[nr];\n"
122+ " external \"C\" fmiGetRealVR(fmufun,in_inst,in_vr,rv,nr) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
123+ " end fmuGetRealVR;\n"
124+ " \n"
125+ " function fmuGetIntegerVR \"get values of integer variables via value references\"\n"
126+ " input fmuFunctions fmufun;\n"
127+ " input fmuModelInst in_inst;\n"
128+ " input Integer ni;\n"
129+ " input Integer in_vr[ni];\n"
130+ " output Integer iv[ni];\n"
131+ " external \"C\" fmiGetIntegerVR(fmufun,in_inst,in_vr,iv,ni) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
132+ " end fmuGetIntegerVR;\n"
133+ " \n"
134+ " function fmuGetStringVR \"get values of string variables via value references\"\n"
135+ " input fmuFunctions fmufun;\n"
136+ " input fmuModelInst in_inst;\n"
137+ " input Integer ns;\n"
138+ " input Integer in_vr[ns];\n"
139+ " output String sv[ns];\n"
140+ " external \"C\" fmiGetStringVR(fmufun,in_inst,in_vr,sv,ns) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
141+ " end fmuGetStringVR;\n"
142+ " \n"
143+ " function fmuGetBooleanVR \"get values of boolean variables via value references\"\n"
144+ " input fmuFunctions fmufun;\n"
145+ " input fmuModelInst in_inst;\n"
146+ " input Integer nb;\n"
147+ " input Integer in_vr[nb];\n"
148+ " output Boolean bv[nb];\n"
149+ " external \"C\" fmiGetBooleanVR(fmufun,in_inst,in_vr,bv,nb) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
150+ " end fmuGetBooleanVR;\n"
151+ " \n"
152+ " function fmuGetDer \"function to calculate the derivatives\"\n"
153+ " input fmuFunctions fmufun;\n"
154+ " input fmuModelInst inst;\n"
155+ " input Integer nx;\n"
156+ " input Real x[nx];\n"
157+ " output Real der_x_out[nx];\n"
158+ " external \"C\" fmiGetDer(fmufun,inst,der_x_out,nx,x) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
159+ " end fmuGetDer;\n"
160+ " \n"
161+ " class fmuEventInfo\n"
162+ " extends ExternalObject;\n"
163+ " function constructor\n"
164+ " output fmuEventInfo evtInfo;\n"
165+ " external \"C\" evtInfo = fmiEvtInfo() annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
166+ " end constructor;\n"
167+ " function destructor\n"
168+ " input fmuEventInfo evtInfo;\n"
169+ " external \"C\" freefmiEvtInfo(evtInfo) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
170+ " end destructor;\n"
171+ " end fmuEventInfo;\n"
172+ " \n"
173+ " class fmuBoolean\n"
174+ " extends ExternalObject;\n"
175+ " function constructor\n"
176+ " input Integer default;\n"
177+ " output fmuBoolean fmuBool;\n"
178+ " external \"C\" fmuBool = fmuBooleanInst(default) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\");\n"
179+ " end constructor;\n"
180+ " function destructor\n"
181+ " input fmuBoolean in_bool;\n"
182+ " external \"C\" freefmuBooleanInst(in_bool) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
183+ " end destructor;\n"
184+ " end fmuBoolean;\n"
185+ " \n"
186+ " function fmuInit\n"
187+ " input fmuFunctions fmufun;\n"
188+ " input fmuModelInst inst;\n"
189+ " input Boolean tolControl;\n"
190+ " input Real relTol;\n"
191+ " input fmuEventInfo evtInfo;\n"
192+ " external \"C\" fmiInit(fmufun,inst,tolControl,relTol,evtInfo) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
193+ " end fmuInit;\n"
194+ " \n"
195+ " function fmuCompIntStep\n"
196+ " input fmuFunctions fmufun;\n"
197+ " input fmuModelInst inst;\n"
198+ " input fmuBoolean stepEvt;\n"
199+ " external \"C\" fmiCompIntStep(fmufun,inst,stepEvt) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
200+ " end fmuCompIntStep;\n"
201+ " \n"
202+ " function fmuGetTimeEvt\n"
203+ " input fmuEventInfo in_evtInfo;\n"
204+ " input Real in_time;\n"
205+ " input Real in_pretime;\n"
206+ " input fmuBoolean in_timeEvt;\n"
207+ " output Real out_nextTime;\n"
208+ " external \"C\" fmiGetTimeEvent(in_evtInfo,in_time,in_pretime,in_timeEvt,out_nextTime) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
209+ " end fmuGetTimeEvt;\n"
210+ " \n"
211+ " function fmuGetEventInd\n"
212+ " input fmuFunctions fmufun;\n"
213+ " input fmuModelInst inst;\n"
214+ " input Integer nz;\n"
215+ " output Real z[nz];\n"
216+ " external \"C\" fmiGetEventInd(fmufun,inst,z,nz) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
217+ " end fmuGetEventInd;\n"
218+ " \n"
219+ " function fmuStateEvtCheck\n"
220+ " input fmuBoolean stateEvt;\n"
221+ " input Integer nz;\n"
222+ " input Real z[nz];\n"
223+ " input Real prez[nz];\n"
224+ " external \"C\" fmuStateEventCheck(stateEvt,nz,z,prez) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
225+ " end fmuStateEvtCheck;\n"
226+ " \n"
227+ " function fmuEvtUpdate\n"
228+ " input fmuFunctions in_fmufun;\n"
229+ " input fmuModelInst in_inst;\n"
230+ " input fmuEventInfo in_evtInfo;\n"
231+ " input fmuBoolean timeEvt;\n"
232+ " input fmuBoolean stepEvt;\n"
233+ " input fmuBoolean stateEvt;\n"
234+ " input fmuBoolean interMediateRes;\n"
235+ " external \"C\" fmuEventUpdate(in_fmufun,in_inst,in_evtInfo,timeEvt,stepEvt,stateEvt,interMediateRes) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
236+ " end fmuEvtUpdate;\n"
237+ " \n"
238+ " function fmuFreeAll \n"
239+ " input fmuFunctions in_fmufun;\n"
240+ " input fmuModelInst in_inst;\n"
241+ " input fmuCallbackFuns functions;\n"
242+ " output fmuBoolean dummy;\n"
243+ " external \"C\" fmuFreeAll(in_fmufun,in_inst,functions,dummy) annotation(Include = \"#include <fmuWrapper.h>\", Library = \"fmuWrapper.o\");\n"
244+ " end fmuFreeAll;\n"
245+ " \n"
246+ " function PrintState\n"
247+ " input fmuModelInst in_fmu;\n"
248+ " input Real in_time;\n"
249+ " external \"C\" PrintModelStates(in_fmu,in_time) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
250+ " end PrintState;\n"
251+ " \n"
252+ " function printVariable\n"
253+ " input Real var[:];\n"
254+ " input Integer n;\n"
255+ " input String varName;\n"
256+ " external \"C\" printVariables(var,n,varName) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
257+ " end printVariable;\n"
258+ " \n"
259+ " function printIntVariable\n"
260+ " input Integer var[:];\n"
261+ " input Integer n;\n"
262+ " input String varName;\n"
263+ " external \"C\" printIntVariables(var,n,varName) annotation(Include=\"#include <fmuWrapper.h>\",Library = \"fmuWrapper.o\"); \n"
264+ " end printIntVariable;\n"
265+ " \n"
266+ " function Bool2Int\n"
267+ " input Integer dim;\n"
268+ " input Boolean in_bv[dim];\n"
269+ " output Integer out_iv[dim];\n"
270+ " algorithm \n"
271+ " for i in 1:dim loop\n"
272+ " out_iv[i]:=if in_bv[i] then 1 else 0;\n"
273+ " end for;\n"
274+ " end Bool2Int;\n"
275+ " \n"
276+ " function Int2Bool\n"
277+ " input Integer dim;\n"
278+ " input Integer in_iv[dim];\n"
279+ " output Boolean out_bv[dim];\n"
280+ " algorithm \n"
281+ " for i in 1:dim loop\n"
282+ " out_bv[i]:=if in_iv[i] == 1 then true else false;\n"
283+ " end for;\n"
284+ " end Int2Bool;\n"
285+ " \n"
0 commit comments