-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
46 lines (39 loc) · 1.11 KB
/
main.c
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
#include "defs_fmi.h"
/***** Initialize the infrastructure pointer for the whole scope *****/
__Infrastructure__* state;
// Additional Functions
/***** Optional: initialize the values of the ModelData struct *****/
void setStartValues(ModelData *comp) {
comp->terminateSimulation = false;
// Parameters
M(var0_float) = 0.0;
M(var1_boolean) = false;
M(var2_string) = "";
M(var3_int) = 0;
M(var4_boolean) = false;
M(var5_boolean) = false;
}
/***** Init and tick functions (no need for changes) *****/
void init(ModelData* comp) { //Replace for the main function
setStartValues(comp); // Optional
printf("Initializing the RoboSim ... module\n");
update_fmi_data(comp);
state = (__Infrastructure__*)malloc(sizeof(__Infrastructure__));
__initialiseProgrammingEnvironment__();
__initialiseConcurrencyInfrastructure__(state);
}
ModelData* tick(ModelData* comp){
update_fmi_data(comp);
{
bool terminate__ = false;
if ((!comp->terminateSimulation) || (!terminate__)) {
terminate__ = __step__(state);
}
}
return comp;
}
void release(){
printf("Terminating modules\n");
__clean__(state);
exit(0);
}