Browse Source

Merge branch 'master' of http://msdl.uantwerpen.be/git/claudio/HybridCosimulation

# Conflicts:
#	SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/Debug/sim_support.o
#	SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/FMI_power_sa.o
Joachim Denil 4 years ago
parent
commit
0a51931738
92 changed files with 313 additions and 10193 deletions
  1. 6 0
      .gitignore
  2. 39 20
      DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy.sa
  3. 48 8
      DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy_sa_commented.sa
  4. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/PowerSystem.zip
  5. 55 0
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/plot_csv.py
  6. 0 1001
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_Control_sa.csv
  7. 0 1001
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_ENV.csv
  8. 0 1001
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_power_sa.csv
  9. 49 24
      SemanticAdaptationForFMI/Experiments/power_window_case_study/case/src/pw_case.c
  10. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/Debug/FMI_Environment.o
  11. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/Debug/libFMI_Environment.dll
  12. 15 15
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/FMI_Environment.c
  13. 0 124
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/.cproject
  14. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/Debug/FMI_SEL.o
  15. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/Debug/libFMI_SEL.dll
  16. 0 542
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/FMI_SEL.c
  17. 0 51
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/FMI_SEL.h
  18. 0 247
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2FunctionTypes.h
  19. 0 339
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2Functions.h
  20. 0 115
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2TypesPlatform.h
  21. 0 124
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/.cproject
  22. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/FMI_SEL.o
  23. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/FMI_TD.o
  24. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/libFMI_TD.dll
  25. 0 464
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/FMI_TD.c
  26. 0 51
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/FMI_TD.h
  27. 0 247
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/fmi2/fmi2FunctionTypes.h
  28. 0 339
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/fmi2/fmi2Functions.h
  29. 0 115
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/fmi2/fmi2TypesPlatform.h
  30. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/FMI_CM.o
  31. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/FMI_GM.o
  32. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/FMI_SEL.o
  33. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/FMI_Window_sa.o
  34. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/FMI_power_sa.o
  35. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/libFMI_Window_sa.dll
  36. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/Debug/sim_support.o
  37. 21 12
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Window_sa/FMI_Window_sa.c
  38. 0 125
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/.cproject
  39. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/Debug/FMI_CM.o
  40. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/Debug/FMI_SEL.o
  41. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/Debug/libFMI_control_master.dll
  42. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/Debug/sim_support.o
  43. 0 535
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/FMI_CM.c
  44. 0 52
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/FMI_CM.h
  45. 0 72
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/fmi2/fmi2.h
  46. 0 247
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/fmi2/fmi2FunctionTypes.h
  47. 0 339
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/fmi2/fmi2Functions.h
  48. 0 115
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/fmi2/fmi2TypesPlatform.h
  49. 0 593
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/sim_support.c
  50. 0 44
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_control_master/sim_support.h
  51. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/Debug/FMI_CM.o
  52. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/Debug/FMI_GM.o
  53. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/Debug/FMI_SEL.o
  54. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/Debug/libFMI_controller_sa.dll
  55. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/Debug/sim_support.o
  56. 3 0
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_algorithm/FMI_GM.c
  57. 0 125
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/.cproject
  58. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/FMI_CM.o
  59. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/FMI_GM.o
  60. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/FMI_SEL.o
  61. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/libFMI_SEL.dll
  62. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/libFMI_control_master.dll
  63. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/libFMI_generic_master.dll
  64. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/Debug/sim_support.o
  65. 0 602
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/FMI_GM.c
  66. 0 52
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/FMI_GM.h
  67. 0 72
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/fmi2/fmi2.h
  68. 0 247
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/fmi2/fmi2FunctionTypes.h
  69. 0 339
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/fmi2/fmi2Functions.h
  70. 0 115
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/fmi2/fmi2TypesPlatform.h
  71. 0 594
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/sim_support.c
  72. 0 44
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_generic_master/sim_support.h
  73. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/Debug/FMI_CM.o
  74. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/Debug/FMI_GM.o
  75. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/Debug/FMI_SEL.o
  76. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/Debug/FMI_power_sa.o
  77. 25 12
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_loop_sa/FMI_loop_sa.c
  78. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa - Copy (2)/Debug/FMI_CM.o
  79. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa - Copy (2)/Debug/FMI_GM.o
  80. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa - Copy (2)/Debug/FMI_SEL.o
  81. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa - Copy (2)/Debug/FMI_power_sa.o
  82. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa - Copy (2)/Debug/sim_support.o
  83. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/FMI_CM.o
  84. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/FMI_GM.o
  85. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/FMI_SEL.o
  86. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/FMI_power_sa.o
  87. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/libFMI_power_sa.dll
  88. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/Debug/sim_support.o
  89. 41 28
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_power_sa/FMI_power_sa.c
  90. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/PW_Controller/src/Debug/PW_Controller.o
  91. BIN
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/PW_Controller/src/Debug/libpw_controller.dll
  92. 11 1
      SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/PW_Controller/src/PW_Controller.c

+ 6 - 0
.gitignore

@@ -37,3 +37,9 @@ xtend-gen/
 .DS_Store
 /DSL_SemanticAdaptation/copy.bat
 /DSL_SemanticAdaptation/copyfiles.bat
+/SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_Control_sa.html
+/SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_ENV.html
+/SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_power_sa.html
+*.o
+*.o
+*.o

+ 39 - 20
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy.sa

@@ -6,16 +6,33 @@ at "./path/to/LazySA.fmu"
 	with input ports obj_detected, passenger_up, passenger_down, passenger_stop, driver_up, driver_down, driver_stop
 	with output ports up, down, stop
 
-input ports obj_detected -> controller.obj_detected
+input ports obj_detected -> controller.obj_detected,
+			passenger_up -> controller.passenger_up,
+			passenger_down -> controller.passenger_down,
+			passenger_stop -> controller.passenger_stop,
+			driver_up -> controller.driver_up,
+			driver_down -> controller.driver_down,
+			driver_stop -> controller.driver_stop
 
 output ports up, down, stop
 
-param 	INIT_UP := 0.0,
-		INIT_DOWN := 0.0,
-		INIT_STOP := 0.0;
+param 	INIT_OBJ_DETECTED := false,
+		INIT_PASSENGER_UP := false,
+		INIT_PASSENGER_DOWN := false,
+		INIT_PASSENGER_STOP := false,
+		INIT_DRIVER_UP := false,
+		INIT_DRIVER_DOWN := false,
+		INIT_DRIVER_STOP := false;
 
 control var	tn := -1.0,
-			tl := -1.0;
+			tl := -1.0,
+			prev_obj_detected := INIT_OBJ_DETECTED,
+			prev_passenger_up := INIT_PASSENGER_UP,
+			prev_passenger_down := INIT_PASSENGER_DOWN,
+			prev_passenger_stop := INIT_PASSENGER_STOP,
+			prev_driver_up := INIT_DRIVER_UP,
+			prev_driver_down := INIT_DRIVER_DOWN,
+			prev_driver_stop := INIT_DRIVER_STOP;
 
 control rules {
 	if (tl < 0.0){
@@ -23,7 +40,15 @@ control rules {
 	}
 	
 	var step_size := min(H, tn - t); 
-	if (lazy_sa.obj_detected or (t+H) >= tn){
+	if (lazy_sa.obj_detected != prev_obj_detected or
+		lazy_sa.passenger_up != prev_passenger_up or
+		lazy_sa.passenger_down != prev_passenger_down or
+		lazy_sa.passenger_stop != prev_passenger_stop or
+		lazy_sa.driver_up != prev_driver_up or
+		lazy_sa.driver_down != prev_driver_down or
+		lazy_sa.driver_stop != prev_driver_stop or
+		(t+H) >= tn
+	){
 		var step_to_be_done := (t+H-tl);
 		var step_done := do_step(controller, t, step_to_be_done); 
 		tn := tl + step_done + get_next_time_step(controller); 
@@ -31,20 +56,14 @@ control rules {
 		tl := tl + step_done; 
 	}
 	
+	prev_obj_detected := lazy_sa.obj_detected;
+	prev_passenger_up := lazy_sa.passenger_up;
+	prev_passenger_down := lazy_sa.passenger_down;
+	prev_passenger_stop := lazy_sa.passenger_stop;
+	prev_driver_up := lazy_sa.driver_up;
+	prev_driver_down := lazy_sa.driver_down;
+	prev_driver_stop := lazy_sa.driver_stop;
+	
 	return step_size;
 }
 
-out var	stored_up := INIT_UP,
-		stored_down := INIT_DOWN,
-		stored_stop := INIT_STOP;
-out rules{
-	 true -> {
-		stored_up := controller.up;
-		stored_down := controller.down;
-		stored_stop := controller.stop;
-	} --> {
-		lazy_sa.up := stored_up;
-		lazy_sa.down := stored_down;
-		lazy_sa.stop := stored_stop;
-	};
-}

+ 48 - 8
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy_sa_commented.sa

@@ -1,5 +1,10 @@
 module Lazy_SA
 
+/*
+ * The purpose of this adaptation is to only run the internal FMU 
+ * 	when any of its inputs changes, or when it requests to be explicitly run.
+ */
+
 semantic adaptation reactive moore LazySA lazy_sa
 at "./path/to/LazySA.fmu"
 
@@ -9,20 +14,35 @@ at "./path/to/LazySA.fmu"
 	with output ports up, down, stop
 
 /*
- * We only need to declare one input port: the one we are interested in.
- * The others (both input and output ports) are bound by assumption.
  * In addition, we do not need to do anything about the outputs of the inner FMU, because they are zero order holded by default.
  */
-input ports obj_detected -> controller.obj_detected
+input ports obj_detected -> controller.obj_detected,
+			passenger_up -> controller.passenger_up,
+			passenger_down -> controller.passenger_down,
+			passenger_stop -> controller.passenger_stop,
+			driver_up -> controller.driver_up,
+			driver_down -> controller.driver_down,
+			driver_stop -> controller.driver_stop
 
 output ports up, down, stop
 
-param 	INIT_UP := 0.0,
-		INIT_DOWN := 0.0,
-		INIT_STOP := 0.0;
+param 	INIT_OBJ_DETECTED := false,
+		INIT_PASSENGER_UP := false,
+		INIT_PASSENGER_DOWN := false,
+		INIT_PASSENGER_STOP := false,
+		INIT_DRIVER_UP := false,
+		INIT_DRIVER_DOWN := false,
+		INIT_DRIVER_STOP := false;
 
 control var	tn := -1.0,
-			tl := -1.0;
+			tl := -1.0,
+			prev_obj_detected := INIT_OBJ_DETECTED,
+			prev_passenger_up := INIT_PASSENGER_UP,
+			prev_passenger_down := INIT_PASSENGER_DOWN,
+			prev_passenger_stop := INIT_PASSENGER_STOP,
+			prev_driver_up := INIT_DRIVER_UP,
+			prev_driver_down := INIT_DRIVER_DOWN,
+			prev_driver_stop := INIT_DRIVER_STOP;
 
 control rules {
 	// This initialisation covers simulations that start at a non-zero time.
@@ -32,7 +52,15 @@ control rules {
 	
 	var step_size := min(H, tn - t); // In case tn < t, this ensures that the controller will be run at the right time.
 	// Note that the expression lazy_sa.obj_detected gets replaced by the corresponding storage var in the canonical version.
-	if (lazy_sa.obj_detected or (t+H) >= tn){
+	if (lazy_sa.obj_detected != prev_obj_detected or
+		lazy_sa.passenger_up != prev_passenger_up or
+		lazy_sa.passenger_down != prev_passenger_down or
+		lazy_sa.passenger_stop != prev_passenger_stop or
+		lazy_sa.driver_up != prev_driver_up or
+		lazy_sa.driver_down != prev_driver_down or
+		lazy_sa.driver_stop != prev_driver_stop or
+		(t+H) >= tn
+	){
 		var step_to_be_done := (t+H-tl);
 		var step_done := do_step(controller, t, step_to_be_done); // calls the mapIn function that will take care of forwarding the values of the input ports to the internal FMU.
 		// We calculate these as if step_done == step_to_be_done. If that is not the case, a rollback will be done anyway.
@@ -49,9 +77,20 @@ control rules {
 		tl := tl + step_done; // assert tl == t+H
 	}
 	
+	// Store the previous values of the inputs
+	prev_obj_detected := lazy_sa.obj_detected;
+	prev_passenger_up := lazy_sa.passenger_up;
+	prev_passenger_down := lazy_sa.passenger_down;
+	prev_passenger_stop := lazy_sa.passenger_stop;
+	prev_driver_up := lazy_sa.driver_up;
+	prev_driver_down := lazy_sa.driver_down;
+	prev_driver_stop := lazy_sa.driver_stop;
+	
 	return step_size;
 }
 
+/*
+The following code is not needed because the outputs are zero order hold'ed by default:
 out var	stored_up := INIT_UP,
 		stored_down := INIT_DOWN,
 		stored_stop := INIT_STOP;
@@ -66,3 +105,4 @@ out rules{
 		lazy_sa.stop := stored_stop;
 	};
 }
+ */

BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/PowerSystem.zip


+ 55 - 0
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/plot_csv.py

@@ -0,0 +1,55 @@
+import csv
+from bokeh.plotting import figure, output_file, show
+
+color_pallete = [
+                "#e41a1c",
+                "#377eb8",
+                "#4daf4a",
+                "#984ea3",
+                "#ff7f00",
+                "#ffff33",
+                "#a65628",
+                "#f781bf",
+                "#CDD460",
+                "#265C70",
+                "#622876",
+                "#B37737"
+                 ]
+
+def plot_csv(filename):
+    with open(filename, 'rb') as csvfile:
+        rows = csv.reader(csvfile, delimiter=',')
+        
+        # read all rows at once
+        matrixRows = []
+        for row in rows:
+            matrixRows.append(row)
+        
+        firstRow = matrixRows[0]
+        numVars = len(firstRow) -1 # discount time
+        times = []
+        vars = []
+        for i in range(numVars):
+            vars.append([])
+        
+        for rowIdx in range(len(matrixRows)):
+            row = matrixRows[rowIdx]
+            times.append(float(row[0]))
+            for varIdx in range(1, numVars):
+                col = row[varIdx]
+                vars[varIdx].append(float(col))
+        
+        plot_file = filename.replace(".csv", ".html")
+        output_file(plot_file, title="Results")
+        
+        p = figure(title="Plot", x_axis_label='time', y_axis_label='', width=1300, height=900)
+        
+        varName = "v{0}"
+        for i in range(numVars):
+            p.line(x=times, y=vars[i], legend=varName.format(i), color=color_pallete[i])
+    
+        show(p)
+        
+plot_csv('result_power_sa.csv')
+plot_csv('result_ENV.csv')
+plot_csv('result_Control_sa.csv')

File diff suppressed because it is too large
+ 0 - 1001
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_Control_sa.csv


File diff suppressed because it is too large
+ 0 - 1001
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_ENV.csv


File diff suppressed because it is too large
+ 0 - 1001
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/result_power_sa.csv


+ 49 - 24
SemanticAdaptationForFMI/Experiments/power_window_case_study/case/src/pw_case.c

@@ -14,8 +14,8 @@
 #include "fmi2.h"
 
 #define START_TIME 0.0
-#define STOP_TIME 10.0
-#define STEP_SIZE 0.01
+#define STOP_TIME 3.0
+#define STEP_SIZE 0.00001
 
 FMU fmu_env, fmu_control_sa, fmu_power_sa, fmu_loop_sa;
 
@@ -27,6 +27,9 @@ int main(void) {
 	fp_fmu_control_sa = fopen("result_Control_sa.csv", "w");
 	FILE *fp_fmu_power_sa;
 	fp_fmu_power_sa = fopen("result_power_sa.csv","w");
+	FILE *fp_fmu_loop_sa;
+	fp_fmu_loop_sa = fopen("result_loop_sa.csv", "w");
+
 
 	puts("Loading Dlls\n"); /* prints Hello World */
 	/* loading */
@@ -116,15 +119,21 @@ int main(void) {
     fmi2ValueReference vr_in_control_sa_from_env[8]={0,1,2,3,4,5,6,7};
     fmi2ValueReference vr_in_control_sa_from_window[1] = {0};
     fmi2ValueReference vr_out_control_sa[2]={9,10};
-    fmi2ValueReference vr_in_power_sa_u_d_tau[3] = {3,4,5};
-    fmi2Real r_in_power[3];
+    fmi2ValueReference vr_in_power_sa_u_d[2] = {3,5};
+    fmi2ValueReference vr_in_power_sa_tau[1] = {4};
+    fmi2ValueReference vr_out_loop_sa[1] = {0};
+    fmi2Real r_in_power_from_control[2] = {0,0};
+    fmi2Real r_in_power_from_loop[1]={0};
     fmi2ValueReference vr_out_power_sa[3] = {0,1,2};
     fmi2Real r_out_power[3];
+    fmi2Real r_out_loop_sa[1];
 
     fmi2Boolean b_out_control_sa[2];
     double currentTime = START_TIME;
     const fmi2StatusKind lst = fmi2LastSuccessfulTime;
 
+
+
     while(currentTime <= STOP_TIME){
     	printf("\n----master new loop, ct:%f, h:%f\n",currentTime,STEP_SIZE);
     	double next_step_size = STEP_SIZE;
@@ -133,13 +142,26 @@ int main(void) {
     	fmu_env.getFMUstate(c_env,&ctemp_env);
     	fmu_control_sa.getFMUstate(c_control_sa, &ctemp_control_sa);
     	/* do step*/
+
+    	fmi2Flag[2] = fmu_power_sa.setReal(c_power_sa,vr_in_power_sa_u_d,2, &r_in_power_from_control[0]);
+    	if(fmi2Flag[1] != fmi2OK){
+    		return 1;
+    	}
+    	fmi2Flag[2] = fmu_power_sa.setReal(c_power_sa,vr_in_power_sa_tau,1, &r_in_power_from_loop[0]);
+    	if(fmi2Flag[1] != fmi2OK){
+    		return 1;
+    	}
+
+    	fmi2Flag[2] = fmu_power_sa.doStep(c_power_sa, currentTime, STEP_SIZE, fmi2True);
+
+    	if (fmu_power_sa.getReal(c_power_sa, vr_out_power_sa, 3, &r_out_power[0]) != fmi2OK){
+    		return 1;
+    	}
+    	fflush(stdout);
     	fmi2Flag[0] = fmu_env.doStep(c_env, currentTime, STEP_SIZE, fmi2True);
     	if (fmu_env.getBoolean(c_env, vr_out_env, 9, &b_out_env[0]) != fmi2OK){
-    	            return 1;
+    		return 1;
     	}
-    	if (fmu_power_sa.getReal(c_power_sa, vr_out_power_sa, 3, &r_out_power[0]) != fmi2OK){
-    	    	            return 1;
-    	    	}
 
     	fprintf(fp_fmu_env,"%f,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
     			currentTime,
@@ -161,7 +183,7 @@ int main(void) {
     	if(fmi2Flag[1] != fmi2OK){
     	    		return 1;
     	}
-
+    	fflush(stdout);
     	fmi2Flag[1] = fmu_control_sa.doStep(c_control_sa, currentTime, STEP_SIZE, fmi2True);
 
     	if (fmu_control_sa.getBoolean(c_control_sa, vr_out_control_sa, 2, &b_out_control_sa[0]) != fmi2OK){
@@ -172,21 +194,9 @@ int main(void) {
 				b_out_control_sa[0],
 				b_out_control_sa[1]);
 
-    	r_in_power[0] = b_out_control_sa[1];
-    	r_in_power[1] = 0;
-    	r_in_power[2] = b_out_control_sa[2];
-
-    	fmi2Flag[2] = fmu_power_sa.setReal(c_power_sa,vr_in_power_sa_u_d_tau,3, &r_in_power[0]);
-    	if(fmi2Flag[1] != fmi2OK){
-    		return 1;
-    	}
-
-    	fmi2Flag[2] = fmu_power_sa.doStep(c_power_sa, currentTime, STEP_SIZE, fmi2True);
-
-    	if (fmu_power_sa.setReal(c_power_sa, vr_out_power_sa, 3, &r_out_power[0]) != fmi2OK){
-    	    	            return 1;
-    	    	}
-
+    	r_in_power_from_control[0] = (int)b_out_control_sa[0];
+    	r_in_power_from_control[1] = (int)b_out_control_sa[1];
+    	fflush(stdout);
     	fprintf(fp_fmu_power_sa,"%f,%f,%f,%f\n",
     	    			currentTime,
     					r_out_power[0],
@@ -203,6 +213,19 @@ int main(void) {
     	    	    	            return 1;
     	    	    	}
     	fmi2Flag[3] = fmu_loop_sa.doStep(c_loop_sa, currentTime, STEP_SIZE, fmi2True);
+    	fflush(stdout);
+    	if (fmu_loop_sa.getReal(c_loop_sa, vr_out_loop_sa, 1, &r_out_loop_sa[0]) != fmi2OK){
+    	    	    	            return 1;
+    	    	    	}
+
+    	fprintf(fp_fmu_loop_sa,"%f,%f\n",
+    	    	    			currentTime,
+    	    					r_out_loop_sa[0]
+    	    					);
+
+    	r_in_power_from_loop[0] = r_out_loop_sa[0];
+
+    	//r_in_power_from_loop[0] = -7000;
 
     	int redoStep  = 0;
     	for(int i=0; i<2; i++)
@@ -224,6 +247,8 @@ int main(void) {
     		currentTime += STEP_SIZE;
     	}
 
+    	fflush(stdout);
+
     }
     fclose(fp_fmu_env);
     fclose(fp_fmu_power_sa);

BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/Debug/FMI_Environment.o


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/Debug/libFMI_Environment.dll


+ 15 - 15
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_Environment/FMI_Environment.c

@@ -243,7 +243,7 @@ fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real com
 	fmi2Status simStatus = fmi2OK;
     printf("%s in fmiDoStep()\n",fi->instanceName);
 
-    if(currentCommPoint < 0.5){
+    if(currentCommPoint < 0.01){
     	fi->b[_out_driver_up] = 0;
     	fi->b[_out_driver_up_stop] = 0;
 		fi->b[_out_driver_down] = 0;
@@ -253,7 +253,7 @@ fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real com
 		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
-    }else if(currentCommPoint < 1){
+    }else if(currentCommPoint < 4.59){
     	fi->b[_out_driver_up] = 1;
     	fi->b[_out_driver_up_stop] = 0;
 		fi->b[_out_driver_down] = 0;
@@ -263,17 +263,17 @@ fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real com
 		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
-    }else if(currentCommPoint < 1.5){
-    	fi->b[_out_driver_up] = 1;
-    	fi->b[_out_driver_up_stop] = 0;
+    }else if(currentCommPoint < 5){
+    	fi->b[_out_driver_up] = 0;
+    	fi->b[_out_driver_up_stop] = 1;
 		fi->b[_out_driver_down] = 0;
 		fi->b[_out_driver_down_stop] = 0;
 		fi->b[_out_passenger_up] = 0;
 		fi->b[_out_passenger_up_stop] = 0;
 		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
-		fi->b[_out_object] = 1;
-    }else if(currentCommPoint < 1.7){
+		fi->b[_out_object] = 0;
+    }else if(currentCommPoint < 5.01){
     	fi->b[_out_driver_up] = 0;
     	fi->b[_out_driver_up_stop] = 0;
 		fi->b[_out_driver_down] = 0;
@@ -283,7 +283,7 @@ fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real com
 		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
-    }else if(currentCommPoint < 2.7){
+    }else if(currentCommPoint < 6.7){
     	fi->b[_out_driver_up] = 0;
     	fi->b[_out_driver_up_stop] = 0;
 		fi->b[_out_driver_down] = 0;
@@ -293,25 +293,25 @@ fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real com
 		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
-    }else if(currentCommPoint < 3.1){
-    	fi->b[_out_driver_up] = 1;
+    }else if(currentCommPoint < 7.1){
+    	fi->b[_out_driver_up] = 0;
     	fi->b[_out_driver_up_stop] = 0;
-		fi->b[_out_driver_down] = 0;
+		fi->b[_out_driver_down] = 1;
 		fi->b[_out_driver_down_stop] = 0;
 		fi->b[_out_passenger_up] = 0;
 		fi->b[_out_passenger_up_stop] = 0;
-		fi->b[_out_passenger_down] = 1;
+		fi->b[_out_passenger_down] = 0;
 		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
-    }else if(currentCommPoint < 3.5){
+    }else if(currentCommPoint < 8.5){
     	fi->b[_out_driver_up] = 0;
-    	fi->b[_out_driver_up_stop] = 1;
+    	fi->b[_out_driver_up_stop] = 0;
 		fi->b[_out_driver_down] = 0;
 		fi->b[_out_driver_down_stop] = 0;
 		fi->b[_out_passenger_up] = 0;
 		fi->b[_out_passenger_up_stop] = 0;
 		fi->b[_out_passenger_down] = 0;
-		fi->b[_out_passenger_down_stop] = 1;
+		fi->b[_out_passenger_down_stop] = 0;
 		fi->b[_out_object] = 0;
     }
 

File diff suppressed because it is too large
+ 0 - 124
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/.cproject


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/Debug/FMI_SEL.o


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/Debug/libFMI_SEL.dll


+ 0 - 542
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/FMI_SEL.c

@@ -1,542 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU - a power window controller
- * The code is generated from a Yakindu SC
- * ---------------------------------------------------------------------------*/
-/*
-Template for a sc FMU
-*/
-
-#define MODEL_IDENTIFIER SEL
-#define MODEL_GUID "{41f87101-edf2-4eef-90f3-42db56d4565f}"
-#define FMI2_FUNCTION_PREFIX PW_SEL
-
-
-#include <stdio.h>
-#include "string.h"
-#include "fmi2Functions.h"
-#include <float.h>
-#include "FMI_SEL.h"
-#include <math.h>
-
-
-#define NUMBER_OF_REALS 2
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_BOOLEANS 17
-#define NUMBER_OF_INTEGERS 0
-/*
- * The input Signals (Real)
- */
-#define _in_armature_current 0
-
-/*
- * The input events
- */
-#define _in_driver_up 0
-#define _in_driver_up_stop 1
-#define _in_driver_down 2
-#define _in_driver_down_stop 3
-#define _in_passenger_up 4
-#define _in_passenger_up_stop 5
-#define _in_passenger_down 6
-#define _in_passenger_down_stop 7
-
-/*
- * The store
- */
-#define _stored_armature_current 1
-
-/*
- * The output events:
- * */
-
-#define _out_obj_detected 8
-#define _out_driver_up 9
-#define _out_driver_up_stop 10
-#define _out_driver_down 11
-#define _out_driver_down_stop 12
-#define _out_passenger_up 13
-#define _out_passenger_up_stop 14
-#define _out_passenger_down 15
-#define _out_passenger_down_stop 16
-/*
- * Control Signal
- */
-#define _out_control 17
-
-/*
- * Helper function for relative error
- */
- double relativeError(double a, double b){
-	return fabs((a - b) / a);
-}
-
-/*
- * Helper function for absolute error
- */
- double absoluteError(double a, double b){
-	return fabs(a - b);
-}
-
-/*
- * is_close function for double comparison
- */
- int is_close(double a, double b, double REL_TOL, double ABS_TOL){
-	return ((absoluteError(a,b)<ABS_TOL) && (relativeError(a,b)<REL_TOL));
-}
-
-
-fmi2Status fmi2SetDebugLogging(fmi2Component fc, fmi2Boolean loggingOn, size_t nCategories, const fmi2String categories[])
-{
-    return fmi2OK;
-}
-
-fmi2Status fmi2SetString(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2String value[])
-{
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetString(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2String value[])
-{
-    return fmi2Error;
-}
-
-fmi2Status fmi2SetReal(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Real value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-		int i;
-	    for (i = 0; i < nvr; i++)
-		{
-	    	if(vr[i]>=5){
-	    		printf("Value reference: %d, cannot be set, it is a store element\n", vr[i]);
-	    	}else{
-	    		 printf("Value reference: %d\n", vr[i]);
-	    		 comp->r[vr[i]] = value[i];
-	    	}
-
-	        //setExposedReal(vr[i], value[i]);
-	        //comp->r[vr[i]] = value[i];
-	    }
-	    return fmi2OK;
-}
-
-fmi2Status fmi2GetReal(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Real value[])
-{
-
-    FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-    for (i = 0; i < nvr; i++)
-	{
-        value[i] = comp->r[(vr[i])];
-    }
-    return fmi2OK;
-}
-
-fmi2Status fmi2SetBoolean(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Boolean value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-	for (i = 0; i < nvr; i++)
-	{
-		comp->b[vr[i]] = value[i];
-	}
-    return fmi2OK;
-}
-
-fmi2Status fmi2GetBoolean(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Boolean value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-	for (i = 0; i < nvr; i++)
-	{
-		value[i] = comp->b[vr[i]];
-	}
-    return fmi2OK;
-}
-
-fmi2Component fmi2Instantiate(fmi2String instanceName, fmi2Type fmuType, fmi2String fmuGUID, fmi2String fmuLocation, const fmi2CallbackFunctions* functions, fmi2Boolean visible, fmi2Boolean loggingOn)
-{
-
-	//Declare data structure for fmu instance
-    FMUInstance* fi;
-	printf("%s in fmiInstantiate\n",instanceName);
-
-    //Perform checks on passed callback functions
-    if (loggingOn) {
-
-        if (!functions->logger);
-        //return NULL;
-	}
-    //Check for instanceName
-    if (!instanceName || strlen(instanceName)==0) {
-
-        // print (and/or log) instanceName is missing
-        //return NULL;
-    }
-    //Check passed GUID to defined model GUID
-    if (strcmp(fmuGUID, MODEL_GUID))
-	{
-        // print (and/or log) GUID doesn't match
-        //return NULL;
-    }
-
-    //Allocate fmu instance Memory
-    // TODO check if "canNotUseMemoryManagementFunctions == true/false". If false memory allocation not possible
-    fi = (FMUInstance *)functions->allocateMemory(1, sizeof(FMUInstance));
-    fi->functions = functions;
-    if (fi) {
-        // Think about what to do with variable values. Using these structs and pointers slows down simulation computations. Maybe only necessary for input, output and tunable parameters??
-        fi->r = functions->allocateMemory(NUMBER_OF_REALS, sizeof(fmi2Real));
-        fi->i = functions->allocateMemory(NUMBER_OF_INTEGERS, sizeof(fmi2Integer));
-        fi->b = functions->allocateMemory(NUMBER_OF_BOOLEANS, sizeof(fmi2Boolean));
-        fi->s = functions->allocateMemory(NUMBER_OF_STRINGS,  sizeof(fmi2String));
-    } // variables in predefined arrays (performance issue) --> makes multiple instances of fmu impossible
-
-
-    fi->instanceName = functions->allocateMemory(1 + strlen(instanceName), sizeof(char));
-    fi->GUID = functions->allocateMemory(1 + strlen(fmuGUID), sizeof(char));
-
-    strcpy((char*)fi->instanceName, instanceName);
-    strcpy((char*)fi->GUID, fmuGUID);
-    fi->functions = functions;
-    fi->loggingOn = loggingOn;
-    fi->isVisible = visible;
-    fi->state = fmuInstantiated;
-    return fi;
-}
-
-fmi2Status fmi2SetupExperiment(fmi2Component fc, fmi2Boolean toleranceDefined, fmi2Real tolerance,
-                            fmi2Real startTime, fmi2Boolean stopTimeDefined, fmi2Real stopTime) {
-
-
-    FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiSetupExperiment\n",fi->instanceName);
-	if (fi->state != fmuInstantiated)
-	{
-		printf("fmu: %s was not instatiated before calling fmiSetupExperiment\n", fi->instanceName);
-		return fmi2Error;
-	}
-	fi->currentTime = startTime;
-	fi->stopTimeDefined = stopTimeDefined;
-	fi->toleranceDefined = toleranceDefined;
-	if (stopTimeDefined)
-	{
-		fi->stopTime = stopTime;
-	}
-
-	if (toleranceDefined)
-	{
-		fi->tolerance = tolerance;
-	}
-	//TODO
-	//fi->stepSize = getStepSize();
-	fi->state = fmuExperimentSettedUp;
-    return fmi2OK;
-}
-
-fmi2Status fmi2EnterInitializationMode(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiEnterInitializationMode\n",fi->instanceName);
-	if (fi->state != fmuExperimentSettedUp)
-	{
-		printf("fmu: %s experiment was not set-up before calling fmiEnterInitializationMode\n", fi->instanceName);
-		return fmi2Error;
-	}
-
-    fi->state = fmuInitMode;
-    return fmi2OK;
-}
-
-fmi2Status fmi2ExitInitializationMode(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance*) fc;
-	fmi2Status initStatus = fmi2OK;
-	printf("%s in fmiExitInitializationMode\n",fi->instanceName);
-	if (fi->state != fmuInitMode)
-	{
-		printf("fmu: %s did not enter Initialization Mode before calling fmiExitInitializationMode\n", fi->instanceName);
-		return fmi2Error;
-	}
-	// TODO
-	//initStatus = calculateInitialUnknownValues();
-	//initialize();
-    fi->state = fmuInitialized;
-    return initStatus;
-}
-
-fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real commStepSize, fmi2Boolean noPrevFMUState)
-{
-	FMUInstance* fi = (FMUInstance *)fc;
-	fmi2Status simStatus = fmi2OK;
-    printf("%s in fmiDoStep()\n",fi->instanceName);
-
-    /*
-     * true -> {
-		obj_detected := ""; // or null value or something else
-		if (not
-			(not is_close(stored_armature_current, 5, REL_TOL, ABS_TOL) and stored_armature_current > 5)
-					and (not is_close(armature_current, 5, REL_TOL, ABS_TOL) and armature_current > 5)) {
-			var negative_value := stored_armature_current - 5;
-			var positive_value := armature_current - 5;
-			var new_step_size := (h * (- negative_value)) / (positive_value - negative_value);
-			discard(new_step_size);
-		} else {
-			if (not (not is_close(stored_armature_current, 5, REL_TOL, ABS_TOL) and stored_armature_current > 5)
-						and is_close(armature_current, 5, REL_TOL, ABS_TOL)) { // crossing found
-				obj_detected := "obj";
-			}
-		}
-		stored_armature_current := armature_current; // as there exists a target port obj_detected, the source port armature_current is used. If ports would have the same name (and thus same type), the value resulting from the crossing would be stored
-	} --> {
-	};*/
-    fi->b[_out_obj_detected] = 0;
-    if(!(! is_close(fi->r[_stored_armature_current], 5 , 0.0001, 1e-8) && fi->r[_stored_armature_current] > 5)
-    		&& (!is_close(fi->r[_in_armature_current],5, 0.0001, 1e-8) && fi->r[_in_armature_current] > 5)){ // should this be <
-    		double negative_value = fi->r[_stored_armature_current] - 5;
-    		double positive_value = fi->r[_in_armature_current] - 5;
-    		double new_step_size = (commStepSize * (-negative_value)) / (positive_value - negative_value);
-    		fi->currentTime = currentCommPoint + new_step_size;
-    		simStatus = fmi2Discard;
-
-    }else{
-    	if(!(! is_close(fi->r[_stored_armature_current],5,0.0001,1e-8) && fi->r[_stored_armature_current] > 5)
-    			&& is_close(fi->r[_in_armature_current],5, 0.0001, 1e-8)){
-    			fi->b[_out_obj_detected] = 1;
-    	}
-    }
-    /* Set out:*/
-    fi->b[_out_driver_down] = fi->b[_in_driver_down];
-    fi->b[_out_driver_down_stop] = fi->b[_in_driver_down_stop];
-    fi->b[_out_driver_up] = fi->b[_in_driver_up];
-    fi->b[_out_driver_up_stop] = fi->b[_in_driver_up_stop];
-    fi->b[_out_passenger_down] = fi->b[_in_passenger_down];
-    fi->b[_out_passenger_down_stop] = fi->b[_in_passenger_down_stop];
-    fi->b[_out_passenger_up] = fi->b[_in_passenger_up];
-    fi->b[_out_passenger_up_stop] = fi->b[_in_passenger_up_stop];
-
-    /*Control signal*/
-    if(fi->b[_out_driver_down] || fi->b[_out_driver_down_stop]|| fi->b[_out_driver_up] ||
-    		 fi->b[_out_driver_up_stop] || fi->b[_out_obj_detected] ||
-			 fi->b[_out_passenger_down] || fi->b[_out_passenger_down_stop] ||
-			 fi->b[_out_passenger_up] || fi->b[_out_passenger_up_stop]){
-    	fi->b[_out_control] = 1;
-    }
-	return simStatus;
-}
-
-fmi2Status fmi2Terminate(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance *)fc;
-	printf("%s in fmiTerminate\n",fi->instanceName);
-	// do check if fi may be terminated
-	fi->state = fmuTerminated;
-    return fmi2OK;
-}
-
-
-void fmi2FreeInstance(fmi2Component fc)
-{
-
-	FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiFreeInstance\n",fi->instanceName);
-
-    if (fi) {
-
-        fi->functions->freeMemory(fi->r);
-        fi->functions->freeMemory(fi->i);
-        fi->functions->freeMemory(fi->b);
-        fi->functions->freeMemory(fi->s);// TODO has to be done with loop
-		fi->functions->freeMemory((void*)fi->instanceName);
-		fi->functions->freeMemory((void*)fi->GUID);
-		fi->functions->freeMemory((void*)fi);
-
-    }
-}
-
-//To be implemented
-
-const char* fmi2GetVersion() {
-	printf("Function fmiGetVersion not supported\n");
-    return NULL;
-}
-
-const char* fmi2GetTypesPlatform() {
-	printf("Function fmiGetTypesPlatform not supported\n");
-    return NULL;
-}
-
-fmi2Status fmi2Reset(fmi2Component fc)
-{
-	printf("Function fmiReset not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2SetInteger(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer value[])
-{
-    printf("Function fmiSetInteger not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetInteger(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Integer value[])
-{
-    printf("Function fmiGetInteger not supported\n");
-    return fmi2Error;
-}
-
-
-/*******OWN IMPLEMENTATION OF Get/Set FMU state*******/
-fmi2Status fmi2GetFMUstate (fmi2Component c, fmi2FMUstate* FMUstate) {
-    FMUInstance* orig = (FMUInstance*)c;
-    FMUInstance* fi = (FMUInstance *)FMUstate;
-    fi = orig->functions->allocateMemory(1, sizeof(FMUInstance));
-    *FMUstate = fi;
-    if (fi) {
-        // Think about what to do with variable values. Using these structs and pointers slows down simulation computations. Maybe only necessary for input, output and tunable parameters??
-        fi->r = orig->functions->allocateMemory(NUMBER_OF_REALS, sizeof(fmi2Real));
-        fi->i = orig->functions->allocateMemory(NUMBER_OF_INTEGERS, sizeof(fmi2Integer));
-        fi->b = orig->functions->allocateMemory(NUMBER_OF_BOOLEANS, sizeof(fmi2Boolean));
-        fi->s = orig->functions->allocateMemory(NUMBER_OF_STRINGS,  sizeof(fmi2String));
-
-    } // variables in predefined arrays (performance issue) --> makes multiple instances of fmu impossible
-    fi->instanceName = orig->functions->allocateMemory(1 + strlen(orig->instanceName), sizeof(char));
-    fi->GUID = orig->functions->allocateMemory(1 + strlen(orig->GUID), sizeof(char));
-
-    strcpy((char *)fi->instanceName, (char *)orig->instanceName);
-    strcpy((char *)fi->GUID, (char *)orig->GUID);
-    fi->functions = orig->functions;
-    fi->loggingOn = orig->loggingOn;
-    fi->isVisible = orig->isVisible;
-    fi->state = orig->state;
-    fi->stepSize = orig->stepSize;
-    fi->startTime = orig->startTime;
-    fi->stopTime = orig->stopTime;
-	fi->currentTime = orig->currentTime;
-	//copy r
-	int i=0;
-	for (i=0; i< NUMBER_OF_REALS;i++){
-	    printf("Setting real: %i %f\n", i, orig->r[i]);
-        fi->r[i] = orig->r[i];
-        printf("Setted real: %i %f\n", i, fi->r[i]);
-	}
-	//copy s
-	for (i=0; i< NUMBER_OF_STRINGS;i++){
-        fi->s[i] = orig->s[i];
-	}
-	//copy i
-    for (i=0; i< NUMBER_OF_INTEGERS;i++){
-        fi->i[i] = orig->i[i];
-	}
-	//copy b
-	for (i=0; i< NUMBER_OF_BOOLEANS;i++){
-        fi->b[i] = orig->b[i];
-	}
-    return fmi2OK;
-}
-
-
-fmi2Status fmi2SetFMUstate (fmi2Component c, fmi2FMUstate FMUstate) {
-    FMUInstance* orig = (FMUInstance*)FMUstate;
-    FMUInstance* fi = (FMUInstance*)c;
-    //set time etc correct, name and GUID should still be ok ;-)
-    printf("setting time values from %f to %f\n", fi->currentTime, orig->currentTime);
-    fi->state = orig->state;
-    fi->stepSize = orig->stepSize;
-    fi->startTime = orig->startTime;
-    fi->stopTime = orig->stopTime;
-	fi->currentTime = orig->currentTime;
-	printf("setting real values\n");
-	//copy r
-	int i=0;
-	for (i=0; i< NUMBER_OF_REALS;i++){
-        fi->r[i] = orig->r[i];
-	}
-	printf("setting string values\n");
-	//copy s
-	for (i=0; i< NUMBER_OF_STRINGS;i++){
-
-        fi->s[i] = orig->s[i];
-	}
-	//copy i
-    for (i=0; i< NUMBER_OF_INTEGERS;i++){
-        fi->i[i] = orig->i[i];
-	}
-	//copy b
-	for (i=0; i< NUMBER_OF_BOOLEANS;i++){
-        fi->b[i] = orig->b[i];
-	}
-    return fmi2OK;
-
-
-}
-/****************************************************/
-
-fmi2Status fmi2FreeFMUstate(fmi2Component c, fmi2FMUstate* FMUstate) {
-    printf("Function fmiFreeFMUstate not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2SerializedFMUstateSize(fmi2Component c, fmi2FMUstate FMUstate, size_t *size) {
-    printf("Function fmiSerializedFMUstateSize not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2SerializeFMUstate (fmi2Component c, fmi2FMUstate FMUstate, fmi2Byte serializedState[], size_t size) {
-    printf("Function fmiSerializeFMUstate not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2DeSerializeFMUstate (fmi2Component c, const fmi2Byte serializedState[], size_t size, fmi2FMUstate* FMUstate) {
-    printf("Function fmiDeSerializeFMUstate not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetDirectionalDerivative(fmi2Component c, const fmi2ValueReference vUnknown_ref[], size_t nUnknown,
-                const fmi2ValueReference vKnown_ref[] , size_t nKnown, const fmi2Real dvKnown[], fmi2Real dvUnknown[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-
-fmi2Status fmi2SetRealInputDerivatives(fmi2Component c, const fmi2ValueReference vr[], size_t nvr,
-                                     const fmi2Integer order[], const fmi2Real value[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetRealOutputDerivatives(fmi2Component c, const fmi2ValueReference vr[], size_t nvr,
-                                      const fmi2Integer order[], fmi2Real value[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2CancelStep(fmi2Component c) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetStatus(fmi2Component c, const fmi2StatusKind s, fmi2Status *value) {
-    printf("Function fmiGetStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetRealStatus(fmi2Component c, const fmi2StatusKind s, fmi2Real *value) {
-    if(s == fmi2LastSuccessfulTime){
-        FMUInstance* comp = (FMUInstance*) c;
-        *value = comp->currentTime;
-        return fmi2OK;
-    }
-    printf("Function fmiGetRealStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetIntegerStatus(fmi2Component c, const fmi2StatusKind s, fmi2Integer *value) {
-    printf("Function fmiGetIntegerStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetBooleanStatus(fmi2Component c, const fmi2StatusKind s, fmi2Boolean *value) {
-    printf("Function fmiGetBooleanStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetStringStatus(fmi2Component c, const fmi2StatusKind s, fmi2String *value) {
-    printf("Function fmiGetStringStatus not supported\n");
-    return fmi2Error;
-}

+ 0 - 51
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/FMI_SEL.h

@@ -1,51 +0,0 @@
-/*
- * PW_Controller.h
- *
- *  Created on: Jan 25, 2017
- *      Author: Joachim
- */
-
-#ifndef FMI_SEL_H_
-#define FMI_SEL_H_
-
-
- double relativeError(double a, double b);
- double absoluteError(double a, double b);
- int is_close(double a, double b, double REL_TOL, double ABS_TOL);
-
-
-typedef enum {
-    fmuInstantiated = 0,
-    fmuInitMode  = 1,
-	fmuInitialized = 2,
-    fmuTerminated   = 3,
-    fmuError        = 4,
-    fmuExperimentSettedUp = 5
-} FMUState;
-
-
-
-typedef struct {
-	fmi2Real    *r;
-    fmi2Integer *i;
-    fmi2Boolean *b;
-    fmi2String  *s;
-    fmi2Boolean isVisible;
-    fmi2String instanceName;
-    fmi2String GUID;
-    const fmi2CallbackFunctions* functions;
-    fmi2Boolean loggingOn;
-    FMUState state;
-	fmi2Real stepSize;
-    fmi2Real startTime;
-    fmi2Real stopTime;
-	fmi2Real currentTime;
-    fmi2Boolean stopTimeDefined;
-    fmi2Real tolerance;
-    fmi2Boolean toleranceDefined;
-} FMUInstance; // At the moment, most of the variables not really used since multiple instances of an FMU are not supported at the moment (performance issues)
-
-
-
-
-#endif /* FMI_SEL_H_ */

+ 0 - 247
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2FunctionTypes.h

@@ -1,247 +0,0 @@
-#ifndef fmi2FunctionTypes_h
-#define fmi2FunctionTypes_h
-
-#include "fmi2TypesPlatform.h"
-
-/* This header file must be utilized when compiling an FMU or an FMI master.
-   It declares data and function types for FMI 2.0
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Apr.  3, 2014: Added #include <stddef.h> for size_t definition
-   - Mar. 27, 2014: Added #include "fmiTypesPlatform.h" (#179)
-   - Mar. 26, 2014: Introduced function argument "void" for the functions (#171)
-                      fmiGetTypesPlatformTYPE and fmiGetVersionTYPE
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModelTYPE , fmiInstantiateSlaveTYPE  -> fmiInstantiateTYPE
-                      fmiFreeModelInstanceTYPE, fmiFreeSlaveInstanceTYPE -> fmiFreeInstanceTYPE
-                      fmiEnterModelInitializationModeTYPE, fmiEnterSlaveInitializationModeTYPE -> fmiEnterInitializationModeTYPE
-                      fmiExitModelInitializationModeTYPE , fmiExitSlaveInitializationModeTYPE  -> fmiExitInitializationModeTYPE
-                      fmiTerminateModelTYPE , fmiTerminateSlaveTYPE  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed
-                      fmiUpdateDiscreteStatesTYPE -> fmiNewDiscreteStatesTYPE
-                    Renamed elements of the enumeration fmiEventInfo
-                      upcomingTimeEvent             -> nextEventTimeDefined // due to generic naming scheme: varDefined + var
-                      newUpdateDiscreteStatesNeeded -> newDiscreteStatesNeeded;
-   - June 13, 2013: Changed type fmiEventInfo
-                    Functions removed:
-                       fmiInitializeModelTYPE
-                       fmiEventUpdateTYPE
-                       fmiCompletedEventIterationTYPE
-                       fmiInitializeSlaveTYPE
-                    Functions added:
-                       fmiEnterModelInitializationModeTYPE
-                       fmiExitModelInitializationModeTYPE
-                       fmiEnterEventModeTYPE
-                       fmiUpdateDiscreteStatesTYPE
-                       fmiEnterContinuousTimeModeTYPE
-                       fmiEnterSlaveInitializationModeTYPE;
-                       fmiExitSlaveInitializationModeTYPE;
-   - Feb. 17, 2013: Added third argument to fmiCompletedIntegratorStepTYPE
-                    Changed function name "fmiTerminateType" to "fmiTerminateModelType" (due to #113)
-                    Changed function name "fmiGetNominalContinuousStateTYPE" to
-                                          "fmiGetNominalsOfContinuousStatesTYPE"
-                    Removed fmiGetStateValueReferencesTYPE.
-   - Nov. 14, 2011: First public Version
-
-
-   Copyright (C) 2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* make sure all compiler use the same alignment policies for structures */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(push,8)
-#endif
-
-/* Include stddef.h, in order that size_t etc. is defined */
-#include <stddef.h>
-
-
-/* Type definitions */
-typedef enum {
-    fmi2OK,
-    fmi2Warning,
-    fmi2Discard,
-    fmi2Error,
-    fmi2Fatal,
-    fmi2Pending
-} fmi2Status;
-
-typedef enum {
-    fmi2ModelExchange,
-    fmi2CoSimulation
-} fmi2Type;
-
-typedef enum {
-    fmi2DoStepStatus,
-    fmi2PendingStatus,
-    fmi2LastSuccessfulTime,
-    fmi2Terminated
-} fmi2StatusKind;
-
-typedef void      (*fmi2CallbackLogger)        (fmi2ComponentEnvironment, fmi2String, fmi2Status, fmi2String, fmi2String, ...);
-typedef void*     (*fmi2CallbackAllocateMemory)(size_t, size_t);
-typedef void      (*fmi2CallbackFreeMemory)    (void*);
-typedef void      (*fmi2StepFinished)          (fmi2ComponentEnvironment, fmi2Status);
-
-typedef struct {
-   const fmi2CallbackLogger         logger;
-   const fmi2CallbackAllocateMemory allocateMemory;
-   const fmi2CallbackFreeMemory     freeMemory;
-   const fmi2StepFinished           stepFinished;
-   const fmi2ComponentEnvironment   componentEnvironment;
-} fmi2CallbackFunctions;
-
-typedef struct {
-   fmi2Boolean newDiscreteStatesNeeded;
-   fmi2Boolean terminateSimulation;
-   fmi2Boolean nominalsOfContinuousStatesChanged;
-   fmi2Boolean valuesOfContinuousStatesChanged;
-   fmi2Boolean nextEventTimeDefined;
-   fmi2Real    nextEventTime;
-} fmi2EventInfo;
-
-
-/* reset alignment policy to the one set before reading this file */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(pop)
-#endif
-
-
-/* Define fmi2 function pointer types to simplify dynamic loading */
-
-/***************************************************
-Types for Common Functions
-****************************************************/
-
-/* Inquire version numbers of header files and setting logging status */
-   typedef const char* fmi2GetTypesPlatformTYPE(void);
-   typedef const char* fmi2GetVersionTYPE(void);
-   typedef fmi2Status  fmi2SetDebugLoggingTYPE(fmi2Component, fmi2Boolean, size_t, const fmi2String[]);
-
-/* Creation and destruction of FMU instances and setting debug status */
-   typedef fmi2Component fmi2InstantiateTYPE (fmi2String, fmi2Type, fmi2String, fmi2String, const fmi2CallbackFunctions*, fmi2Boolean, fmi2Boolean);
-   typedef void          fmi2FreeInstanceTYPE(fmi2Component);
-
-/* Enter and exit initialization mode, terminate and reset */
-   typedef fmi2Status fmi2SetupExperimentTYPE        (fmi2Component, fmi2Boolean, fmi2Real, fmi2Real, fmi2Boolean, fmi2Real);
-   typedef fmi2Status fmi2EnterInitializationModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2ExitInitializationModeTYPE (fmi2Component);
-   typedef fmi2Status fmi2TerminateTYPE              (fmi2Component);
-   typedef fmi2Status fmi2ResetTYPE                  (fmi2Component);
-
-/* Getting and setting variable values */
-   typedef fmi2Status fmi2GetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, fmi2Real   []);
-   typedef fmi2Status fmi2GetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Integer[]);
-   typedef fmi2Status fmi2GetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Boolean[]);
-   typedef fmi2Status fmi2GetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, fmi2String []);
-
-   typedef fmi2Status fmi2SetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, const fmi2Real   []);
-   typedef fmi2Status fmi2SetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Integer[]);
-   typedef fmi2Status fmi2SetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Boolean[]);
-   typedef fmi2Status fmi2SetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, const fmi2String []);
-
-/* Getting and setting the internal FMU state */
-   typedef fmi2Status fmi2GetFMUstateTYPE           (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SetFMUstateTYPE           (fmi2Component, fmi2FMUstate);
-   typedef fmi2Status fmi2FreeFMUstateTYPE          (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SerializedFMUstateSizeTYPE(fmi2Component, fmi2FMUstate, size_t*);
-   typedef fmi2Status fmi2SerializeFMUstateTYPE     (fmi2Component, fmi2FMUstate, fmi2Byte[], size_t);
-   typedef fmi2Status fmi2DeSerializeFMUstateTYPE   (fmi2Component, const fmi2Byte[], size_t, fmi2FMUstate*);
-
-/* Getting partial derivatives */
-   typedef fmi2Status fmi2GetDirectionalDerivativeTYPE(fmi2Component, const fmi2ValueReference[], size_t,
-                                                                   const fmi2ValueReference[], size_t,
-                                                                   const fmi2Real[], fmi2Real[]);
-
-/***************************************************
-Types for Functions for FMI2 for Model Exchange
-****************************************************/
-
-/* Enter and exit the different modes */
-   typedef fmi2Status fmi2EnterEventModeTYPE         (fmi2Component);
-   typedef fmi2Status fmi2NewDiscreteStatesTYPE      (fmi2Component, fmi2EventInfo*);
-   typedef fmi2Status fmi2EnterContinuousTimeModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2CompletedIntegratorStepTYPE(fmi2Component, fmi2Boolean, fmi2Boolean*, fmi2Boolean*);
-
-/* Providing independent variables and re-initialization of caching */
-   typedef fmi2Status fmi2SetTimeTYPE            (fmi2Component, fmi2Real);
-   typedef fmi2Status fmi2SetContinuousStatesTYPE(fmi2Component, const fmi2Real[], size_t);
-
-/* Evaluation of the model equations */
-   typedef fmi2Status fmi2GetDerivativesTYPE               (fmi2Component, fmi2Real[], size_t);
-#ifdef FMU_EXPERIMENTAL
-   typedef fmi2Status fmi2GetSpecificDerivativesTYPE       (fmi2Component, fmi2Real[], const fmi2ValueReference [], size_t);
-#endif
-
-   typedef fmi2Status fmi2GetEventIndicatorsTYPE           (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetContinuousStatesTYPE          (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetNominalsOfContinuousStatesTYPE(fmi2Component, fmi2Real[], size_t);
-
-
-/***************************************************
-Types for Functions for FMI2 for Co-Simulation
-****************************************************/
-
-/* Simulating the slave */
-   typedef fmi2Status fmi2SetRealInputDerivativesTYPE (fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], const fmi2Real []);
-   typedef fmi2Status fmi2GetRealOutputDerivativesTYPE(fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], fmi2Real []);
-
-   typedef fmi2Status fmi2DoStepTYPE     (fmi2Component, fmi2Real, fmi2Real, fmi2Boolean);
-   typedef fmi2Status fmi2CancelStepTYPE (fmi2Component);
-
-/* Inquire slave status */
-   typedef fmi2Status fmi2GetStatusTYPE       (fmi2Component, const fmi2StatusKind, fmi2Status* );
-   typedef fmi2Status fmi2GetRealStatusTYPE   (fmi2Component, const fmi2StatusKind, fmi2Real*   );
-   typedef fmi2Status fmi2GetIntegerStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Integer*);
-   typedef fmi2Status fmi2GetBooleanStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Boolean*);
-   typedef fmi2Status fmi2GetStringStatusTYPE (fmi2Component, const fmi2StatusKind, fmi2String* );
-
-
-#ifdef __cplusplus
-}  /* end of extern "C" { */
-#endif
-
-#endif /* fmi2FunctionTypes_h */

+ 0 - 339
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2Functions.h

@@ -1,339 +0,0 @@
-#ifndef fmi2Functions_h
-#define fmi2Functions_h
-
-/* This header file must be utilized when compiling a FMU.
-   It defines all functions of the
-         FMI 2.0 Model Exchange and Co-Simulation Interface.
-
-   In order to have unique function names even if several FMUs
-   are compiled together (e.g. for embedded systems), every "real" function name
-   is constructed by prepending the function name by "FMI2_FUNCTION_PREFIX".
-   Therefore, the typical usage is:
-
-      #define FMI2_FUNCTION_PREFIX MyModel_
-      #include "fmi2Functions.h"
-
-   As a result, a function that is defined as "fmi2GetDerivatives" in this header file,
-   is actually getting the name "MyModel_fmi2GetDerivatives".
-
-   This only holds if the FMU is shipped in C source code, or is compiled in a
-   static link library. For FMUs compiled in a DLL/sharedObject, the "actual" function
-   names are used and "FMI2_FUNCTION_PREFIX" must not be defined.
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Mar. 26, 2014: FMI_Export set to empty value if FMI_Export and FMI_FUNCTION_PREFIX
-                    are not defined (#173)
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModel , fmiInstantiateSlave  -> fmiInstantiate
-                      fmiFreeModelInstance, fmiFreeSlaveInstance -> fmiFreeInstance
-                      fmiEnterModelInitializationMode, fmiEnterSlaveInitializationMode -> fmiEnterInitializationMode
-                      fmiExitModelInitializationMode , fmiExitSlaveInitializationMode  -> fmiExitInitializationMode
-                      fmiTerminateModel, fmiTerminateSlave  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed:
-                      fmiUpdateDiscreteStates -> fmiNewDiscreteStates
-   - June 13, 2013: Functions removed:
-                       fmiInitializeModel
-                       fmiEventUpdate
-                       fmiCompletedEventIteration
-                       fmiInitializeSlave
-                    Functions added:
-                       fmiEnterModelInitializationMode
-                       fmiExitModelInitializationMode
-                       fmiEnterEventMode
-                       fmiUpdateDiscreteStates
-                       fmiEnterContinuousTimeMode
-                       fmiEnterSlaveInitializationMode;
-                       fmiExitSlaveInitializationMode;
-   - Feb. 17, 2013: Portability improvements:
-                       o DllExport changed to FMI_Export
-                       o FUNCTION_PREFIX changed to FMI_FUNCTION_PREFIX
-                       o Allow undefined FMI_FUNCTION_PREFIX (meaning no prefix is used)
-                    Changed function name "fmiTerminate" to "fmiTerminateModel" (due to #113)
-                    Changed function name "fmiGetNominalContinuousState" to
-                                          "fmiGetNominalsOfContinuousStates"
-                    Removed fmiGetStateValueReferences.
-   - Nov. 14, 2011: Adapted to FMI 2.0:
-                       o Split into two files (fmiFunctions.h, fmiTypes.h) in order
-                         that code that dynamically loads an FMU can directly
-                         utilize the header files).
-                       o Added C++ encapsulation of C-part, in order that the header
-                         file can be directly utilized in C++ code.
-                       o fmiCallbackFunctions is passed as pointer to fmiInstantiateXXX
-                       o stepFinished within fmiCallbackFunctions has as first
-                         argument "fmiComponentEnvironment" and not "fmiComponent".
-                       o New functions to get and set the complete FMU state
-                         and to compute partial derivatives.
-   - Nov.  4, 2010: Adapted to specification text:
-                       o fmiGetModelTypesPlatform renamed to fmiGetTypesPlatform
-                       o fmiInstantiateSlave: Argument GUID     replaced by fmuGUID
-                                              Argument mimetype replaced by mimeType
-                       o tabs replaced by spaces
-   - Oct. 16, 2010: Functions for FMI for Co-simulation added
-   - Jan. 20, 2010: stateValueReferencesChanged added to struct fmiEventInfo (ticket #27)
-                    (by M. Otter, DLR)
-                    Added WIN32 pragma to define the struct layout (ticket #34)
-                    (by J. Mauss, QTronic)
-   - Jan.  4, 2010: Removed argument intermediateResults from fmiInitialize
-                    Renamed macro fmiGetModelFunctionsVersion to fmiGetVersion
-                    Renamed macro fmiModelFunctionsVersion to fmiVersion
-                    Replaced fmiModel by fmiComponent in decl of fmiInstantiateModel
-                    (by J. Mauss, QTronic)
-   - Dec. 17, 2009: Changed extension "me" to "fmi" (by Martin Otter, DLR).
-   - Dez. 14, 2009: Added eventInfo to meInitialize and added
-                    meGetNominalContinuousStates (by Martin Otter, DLR)
-   - Sept. 9, 2009: Added DllExport (according to Peter Nilsson's suggestion)
-                    (by A. Junghanns, QTronic)
-   - Sept. 9, 2009: Changes according to FMI-meeting on July 21:
-                    meInquireModelTypesVersion     -> meGetModelTypesPlatform
-                    meInquireModelFunctionsVersion -> meGetModelFunctionsVersion
-                    meSetStates                    -> meSetContinuousStates
-                    meGetStates                    -> meGetContinuousStates
-                    removal of meInitializeModelClass
-                    removal of meGetTime
-                    change of arguments of meInstantiateModel
-                    change of arguments of meCompletedIntegratorStep
-                    (by Martin Otter, DLR):
-   - July 19, 2009: Added "me" as prefix to file names (by Martin Otter, DLR).
-   - March 2, 2009: Changed function definitions according to the last design
-                    meeting with additional improvements (by Martin Otter, DLR).
-   - Dec. 3 , 2008: First version by Martin Otter (DLR) and Hans Olsson (Dynasim).
-
-   Copyright (C) 2008-2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "fmi2TypesPlatform.h"
-#include "fmi2FunctionTypes.h"
-#include <stdlib.h>
-
-
-/*
-  Export FMI2 API functions on Windows and under GCC.
-  If custom linking is desired then the FMI2_Export must be
-  defined before including this file. For instance,
-  it may be set to __declspec(dllimport).
-*/
-#if !defined(FMI2_Export)
-  #if !defined(FMI2_FUNCTION_PREFIX)
-    #if defined _WIN32 || defined __CYGWIN__
-     /* Note: both gcc & MSVC on Windows support this syntax. */
-        #define FMI2_Export __declspec(dllexport)
-    #else
-      #if __GNUC__ >= 4
-        #define FMI2_Export __attribute__ ((visibility ("default")))
-      #else
-        #define FMI2_Export
-      #endif
-    #endif
-  #else
-    #define FMI2_Export
-  #endif
-#endif
-
-/* Macros to construct the real function name
-   (prepend function name by FMI2_FUNCTION_PREFIX) */
-#if defined(FMI2_FUNCTION_PREFIX)
-  #define fmi2Paste(a,b)     a ## b
-  #define fmi2PasteB(a,b)    fmi2Paste(a,b)
-  #define fmi2FullName(name) fmi2PasteB(FMI2_FUNCTION_PREFIX, name)
-#else
-  #define fmi2FullName(name) name
-#endif
-
-/***************************************************
-Common Functions
-****************************************************/
-#define fmi2GetTypesPlatform         fmi2FullName(fmi2GetTypesPlatform)
-#define fmi2GetVersion               fmi2FullName(fmi2GetVersion)
-#define fmi2SetDebugLogging          fmi2FullName(fmi2SetDebugLogging)
-#define fmi2Instantiate              fmi2FullName(fmi2Instantiate)
-#define fmi2FreeInstance             fmi2FullName(fmi2FreeInstance)
-#define fmi2SetupExperiment          fmi2FullName(fmi2SetupExperiment)
-#define fmi2EnterInitializationMode  fmi2FullName(fmi2EnterInitializationMode)
-#define fmi2ExitInitializationMode   fmi2FullName(fmi2ExitInitializationMode)
-#define fmi2Terminate                fmi2FullName(fmi2Terminate)
-#define fmi2Reset                    fmi2FullName(fmi2Reset)
-#define fmi2GetReal                  fmi2FullName(fmi2GetReal)
-#define fmi2GetInteger               fmi2FullName(fmi2GetInteger)
-#define fmi2GetBoolean               fmi2FullName(fmi2GetBoolean)
-#define fmi2GetString                fmi2FullName(fmi2GetString)
-#define fmi2SetReal                  fmi2FullName(fmi2SetReal)
-#define fmi2SetInteger               fmi2FullName(fmi2SetInteger)
-#define fmi2SetBoolean               fmi2FullName(fmi2SetBoolean)
-#define fmi2SetString                fmi2FullName(fmi2SetString)
-#define fmi2GetFMUstate              fmi2FullName(fmi2GetFMUstate)
-#define fmi2SetFMUstate              fmi2FullName(fmi2SetFMUstate)
-#define fmi2FreeFMUstate             fmi2FullName(fmi2FreeFMUstate)
-#define fmi2SerializedFMUstateSize   fmi2FullName(fmi2SerializedFMUstateSize)
-#define fmi2SerializeFMUstate        fmi2FullName(fmi2SerializeFMUstate)
-#define fmi2DeSerializeFMUstate      fmi2FullName(fmi2DeSerializeFMUstate)
-#define fmi2GetDirectionalDerivative fmi2FullName(fmi2GetDirectionalDerivative)
-
-
-/***************************************************
-Functions for FMI2 for Model Exchange
-****************************************************/
-#define fmi2EnterEventMode                fmi2FullName(fmi2EnterEventMode)
-#define fmi2NewDiscreteStates             fmi2FullName(fmi2NewDiscreteStates)
-#define fmi2EnterContinuousTimeMode       fmi2FullName(fmi2EnterContinuousTimeMode)
-#define fmi2CompletedIntegratorStep       fmi2FullName(fmi2CompletedIntegratorStep)
-#define fmi2SetTime                       fmi2FullName(fmi2SetTime)
-#define fmi2SetContinuousStates           fmi2FullName(fmi2SetContinuousStates)
-#define fmi2GetDerivatives                fmi2FullName(fmi2GetDerivatives)
-#ifdef FMU_EXPERIMENTAL
-#define fmi2GetSpecificDerivatives        fmi2FullName(fmi2GetSpecificDerivatives)
-#endif
-#define fmi2GetEventIndicators            fmi2FullName(fmi2GetEventIndicators)
-#define fmi2GetContinuousStates           fmi2FullName(fmi2GetContinuousStates)
-#define fmi2GetNominalsOfContinuousStates fmi2FullName(fmi2GetNominalsOfContinuousStates)
-
-
-/***************************************************
-Functions for FMI2 for Co-Simulation
-****************************************************/
-#define fmi2SetRealInputDerivatives      fmi2FullName(fmi2SetRealInputDerivatives)
-#define fmi2GetRealOutputDerivatives     fmi2FullName(fmi2GetRealOutputDerivatives)
-#define fmi2DoStep                       fmi2FullName(fmi2DoStep)
-#define fmi2CancelStep                   fmi2FullName(fmi2CancelStep)
-#define fmi2GetStatus                    fmi2FullName(fmi2GetStatus)
-#define fmi2GetRealStatus                fmi2FullName(fmi2GetRealStatus)
-#define fmi2GetIntegerStatus             fmi2FullName(fmi2GetIntegerStatus)
-#define fmi2GetBooleanStatus             fmi2FullName(fmi2GetBooleanStatus)
-#define fmi2GetStringStatus              fmi2FullName(fmi2GetStringStatus)
-
-/* Version number */
-#define fmi2Version "2.0"
-
-
-/***************************************************
-Common Functions
-****************************************************/
-
-/* Inquire version numbers of header files */
-   FMI2_Export fmi2GetTypesPlatformTYPE fmi2GetTypesPlatform;
-   FMI2_Export fmi2GetVersionTYPE       fmi2GetVersion;
-   FMI2_Export fmi2SetDebugLoggingTYPE  fmi2SetDebugLogging;
-
-/* Creation and destruction of FMU instances */
-   FMI2_Export fmi2InstantiateTYPE  fmi2Instantiate;
-   FMI2_Export fmi2FreeInstanceTYPE fmi2FreeInstance;
-
-/* Enter and exit initialization mode, terminate and reset */
-   FMI2_Export fmi2SetupExperimentTYPE         fmi2SetupExperiment;
-   FMI2_Export fmi2EnterInitializationModeTYPE fmi2EnterInitializationMode;
-   FMI2_Export fmi2ExitInitializationModeTYPE  fmi2ExitInitializationMode;
-   FMI2_Export fmi2TerminateTYPE               fmi2Terminate;
-   FMI2_Export fmi2ResetTYPE                   fmi2Reset;
-
-/* Getting and setting variables values */
-   FMI2_Export fmi2GetRealTYPE    fmi2GetReal;
-   FMI2_Export fmi2GetIntegerTYPE fmi2GetInteger;
-   FMI2_Export fmi2GetBooleanTYPE fmi2GetBoolean;
-   FMI2_Export fmi2GetStringTYPE  fmi2GetString;
-
-   FMI2_Export fmi2SetRealTYPE    fmi2SetReal;
-   FMI2_Export fmi2SetIntegerTYPE fmi2SetInteger;
-   FMI2_Export fmi2SetBooleanTYPE fmi2SetBoolean;
-   FMI2_Export fmi2SetStringTYPE  fmi2SetString;
-
-/* Getting and setting the internal FMU state */
-   FMI2_Export fmi2GetFMUstateTYPE            fmi2GetFMUstate;
-   FMI2_Export fmi2SetFMUstateTYPE            fmi2SetFMUstate;
-   FMI2_Export fmi2FreeFMUstateTYPE           fmi2FreeFMUstate;
-   FMI2_Export fmi2SerializedFMUstateSizeTYPE fmi2SerializedFMUstateSize;
-   FMI2_Export fmi2SerializeFMUstateTYPE      fmi2SerializeFMUstate;
-   FMI2_Export fmi2DeSerializeFMUstateTYPE    fmi2DeSerializeFMUstate;
-
-/* Getting partial derivatives */
-   FMI2_Export fmi2GetDirectionalDerivativeTYPE fmi2GetDirectionalDerivative;
-
-
-/***************************************************
-Functions for FMI2 for Model Exchange
-****************************************************/
-
-/* Enter and exit the different modes */
-   FMI2_Export fmi2EnterEventModeTYPE               fmi2EnterEventMode;
-   FMI2_Export fmi2NewDiscreteStatesTYPE            fmi2NewDiscreteStates;
-   FMI2_Export fmi2EnterContinuousTimeModeTYPE      fmi2EnterContinuousTimeMode;
-   FMI2_Export fmi2CompletedIntegratorStepTYPE      fmi2CompletedIntegratorStep;
-
-/* Providing independent variables and re-initialization of caching */
-   FMI2_Export fmi2SetTimeTYPE             fmi2SetTime;
-   FMI2_Export fmi2SetContinuousStatesTYPE fmi2SetContinuousStates;
-
-/* Evaluation of the model equations */
-   FMI2_Export fmi2GetDerivativesTYPE                fmi2GetDerivatives;
-#ifdef FMU_EXPERIMENTAL
-   FMI2_Export fmi2GetSpecificDerivativesTYPE        fmi2GetSpecificDerivatives;
-#endif
-   FMI2_Export fmi2GetEventIndicatorsTYPE            fmi2GetEventIndicators;
-   FMI2_Export fmi2GetContinuousStatesTYPE           fmi2GetContinuousStates;
-   FMI2_Export fmi2GetNominalsOfContinuousStatesTYPE fmi2GetNominalsOfContinuousStates;
-
-
-/***************************************************
-Functions for FMI2 for Co-Simulation
-****************************************************/
-
-/* Simulating the slave */
-   FMI2_Export fmi2SetRealInputDerivativesTYPE  fmi2SetRealInputDerivatives;
-   FMI2_Export fmi2GetRealOutputDerivativesTYPE fmi2GetRealOutputDerivatives;
-
-   FMI2_Export fmi2DoStepTYPE     fmi2DoStep;
-   FMI2_Export fmi2CancelStepTYPE fmi2CancelStep;
-
-/* Inquire slave status */
-   FMI2_Export fmi2GetStatusTYPE        fmi2GetStatus;
-   FMI2_Export fmi2GetRealStatusTYPE    fmi2GetRealStatus;
-   FMI2_Export fmi2GetIntegerStatusTYPE fmi2GetIntegerStatus;
-   FMI2_Export fmi2GetBooleanStatusTYPE fmi2GetBooleanStatus;
-   FMI2_Export fmi2GetStringStatusTYPE  fmi2GetStringStatus;
-
-#ifdef __cplusplus
-}  /* end of extern "C" { */
-#endif
-
-#endif /* fmi2Functions_h */

+ 0 - 115
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_SEL/fmi2/fmi2TypesPlatform.h

@@ -1,115 +0,0 @@
-#ifndef fmi2TypesPlatform_h
-#define fmi2TypesPlatform_h
-
-/* Standard header file to define the argument types of the
-   functions of the Functional Mock-up Interface 2.0.
-   This header file must be utilized both by the model and
-   by the simulation engine.
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Mar   31, 2014: New datatype fmiChar introduced.
-   - Feb.  17, 2013: Changed fmiTypesPlatform from "standard32" to "default".
-                     Removed fmiUndefinedValueReference since no longer needed
-                     (because every state is defined in ScalarVariables).
-   - March 20, 2012: Renamed from fmiPlatformTypes.h to fmiTypesPlatform.h
-   - Nov.  14, 2011: Use the header file "fmiPlatformTypes.h" for FMI 2.0
-                     both for "FMI for model exchange" and for "FMI for co-simulation"
-                     New types "fmiComponentEnvironment", "fmiState", and "fmiByte".
-                     The implementation of "fmiBoolean" is change from "char" to "int".
-                     The #define "fmiPlatform" changed to "fmiTypesPlatform"
-                     (in order that #define and function call are consistent)
-   - Oct.   4, 2010: Renamed header file from "fmiModelTypes.h" to fmiPlatformTypes.h"
-                     for the co-simulation interface
-   - Jan.   4, 2010: Renamed meModelTypes_h to fmiModelTypes_h (by Mauss, QTronic)
-   - Dec.  21, 2009: Changed "me" to "fmi" and "meModel" to "fmiComponent"
-                     according to meeting on Dec. 18 (by Martin Otter, DLR)
-   - Dec.   6, 2009: Added meUndefinedValueReference (by Martin Otter, DLR)
-   - Sept.  9, 2009: Changes according to FMI-meeting on July 21:
-                     Changed "version" to "platform", "standard" to "standard32",
-                     Added a precise definition of "standard32" as comment
-                     (by Martin Otter, DLR)
-   - July  19, 2009: Added "me" as prefix to file names, added meTrue/meFalse,
-                     and changed meValueReferenced from int to unsigned int
-                     (by Martin Otter, DLR).
-   - March  2, 2009: Moved enums and function pointer definitions to
-                     ModelFunctions.h (by Martin Otter, DLR).
-   - Dec.  3, 2008 : First version by Martin Otter (DLR) and
-                     Hans Olsson (Dynasim).
-
-
-   Copyright (C) 2008-2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-/* Platform (unique identification of this header file) */
-#define fmi2TypesPlatform "default"
-
-/* Type definitions of variables passed as arguments
-   Version "default" means:
-
-   fmi2Component           : an opaque object pointer
-   fmi2ComponentEnvironment: an opaque object pointer
-   fmi2FMUstate            : an opaque object pointer
-   fmi2ValueReference      : handle to the value of a variable
-   fmi2Real                : double precision floating-point data type
-   fmi2Integer             : basic signed integer data type
-   fmi2Boolean             : basic signed integer data type
-   fmi2Char                : character data type
-   fmi2String              : a pointer to a vector of fmi2Char characters
-                             ('\0' terminated, UTF8 encoded)
-   fmi2Byte                : smallest addressable unit of the machine, typically one byte.
-*/
-   typedef void*           fmi2Component;               /* Pointer to FMU instance       */
-   typedef void*           fmi2ComponentEnvironment;    /* Pointer to FMU environment    */
-   typedef void*           fmi2FMUstate;                /* Pointer to internal FMU state */
-   typedef unsigned int    fmi2ValueReference;
-   typedef double          fmi2Real   ;
-   typedef int             fmi2Integer;
-   typedef int             fmi2Boolean;
-   typedef char            fmi2Char;
-   typedef const fmi2Char* fmi2String;
-   typedef char            fmi2Byte;
-
-/* Values for fmi2Boolean  */
-#define fmi2True  1
-#define fmi2False 0
-
-
-#endif /* fmi2TypesPlatform_h */

File diff suppressed because it is too large
+ 0 - 124
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/.cproject


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/FMI_SEL.o


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/FMI_TD.o


BIN
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/Debug/libFMI_TD.dll


+ 0 - 464
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/FMI_TD.c

@@ -1,464 +0,0 @@
-/* ---------------------------------------------------------------------------*
- * Sample implementation of an FMU - a power window controller
- * The code is generated from a Yakindu SC
- * ---------------------------------------------------------------------------*/
-/*
-Template for a TD FMU
-*/
-
-#define MODEL_IDENTIFIER TD
-#define MODEL_GUID "{41f87101-edf2-4eef-90f3-42db56d4565f}"
-#define FMI2_FUNCTION_PREFIX PW_TD
-
-
-#include <stdio.h>
-#include "string.h"
-#include "fmi2Functions.h"
-#include <float.h>
-#include "FMI_TD.h"
-#include <math.h>
-
-
-#define NUMBER_OF_REALS 0
-#define NUMBER_OF_STRINGS 0
-#define NUMBER_OF_BOOLEANS 6
-#define NUMBER_OF_INTEGERS 0
-
-
-#define _in_motor_up  0
-#define _in_motor_down 1
-#define _store_motor_up 2
-#define _store_motor_down 3
-#define _out_motor_up 4
-#define _out_motor_down 5
-
-/*
- * Helper function for relative error
- */
- double relativeError(double a, double b){
-	return fabs((a - b) / a);
-}
-
-/*
- * Helper function for absolute error
- */
- double absoluteError(double a, double b){
-	return fabs(a - b);
-}
-
-/*
- * is_close function for double comparison
- */
- int is_close(double a, double b, double REL_TOL, double ABS_TOL){
-	return ((absoluteError(a,b)<ABS_TOL) && (relativeError(a,b)<REL_TOL));
-}
-
-
-fmi2Status fmi2SetDebugLogging(fmi2Component fc, fmi2Boolean loggingOn, size_t nCategories, const fmi2String categories[])
-{
-    return fmi2OK;
-}
-
-fmi2Status fmi2SetString(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2String value[])
-{
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetString(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2String value[])
-{
-    return fmi2Error;
-}
-
-fmi2Status fmi2SetReal(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Real value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-		int i;
-	    for (i = 0; i < nvr; i++)
-		{
-	    	if(vr[i]>=5){
-	    		printf("Value reference: %d, cannot be set, it is a store element\n", vr[i]);
-	    	}else{
-	    		 printf("Value reference: %d\n", vr[i]);
-	    		 comp->r[vr[i]] = value[i];
-	    	}
-
-	        //setExposedReal(vr[i], value[i]);
-	        //comp->r[vr[i]] = value[i];
-	    }
-	    return fmi2OK;
-}
-
-fmi2Status fmi2GetReal(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Real value[])
-{
-
-    FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-    for (i = 0; i < nvr; i++)
-	{
-        value[i] = comp->r[(vr[i])];
-    }
-    return fmi2OK;
-}
-
-fmi2Status fmi2SetBoolean(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Boolean value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-	for (i = 0; i < nvr; i++)
-	{
-		comp->b[vr[i]] = value[i];
-	}
-    return fmi2OK;
-}
-
-fmi2Status fmi2GetBoolean(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Boolean value[])
-{
-	FMUInstance* comp = (FMUInstance *)fc;
-	int i;
-	for (i = 0; i < nvr; i++)
-	{
-		value[i] = comp->b[vr[i]];
-	}
-    return fmi2OK;
-}
-
-fmi2Component fmi2Instantiate(fmi2String instanceName, fmi2Type fmuType, fmi2String fmuGUID, fmi2String fmuLocation, const fmi2CallbackFunctions* functions, fmi2Boolean visible, fmi2Boolean loggingOn)
-{
-
-	//Declare data structure for fmu instance
-    FMUInstance* fi;
-	printf("%s in fmiInstantiate\n",instanceName);
-
-    //Perform checks on passed callback functions
-    if (loggingOn) {
-
-        if (!functions->logger);
-        //return NULL;
-	}
-    //Check for instanceName
-    if (!instanceName || strlen(instanceName)==0) {
-
-        // print (and/or log) instanceName is missing
-        //return NULL;
-    }
-    //Check passed GUID to defined model GUID
-    if (strcmp(fmuGUID, MODEL_GUID))
-	{
-        // print (and/or log) GUID doesn't match
-        //return NULL;
-    }
-
-    //Allocate fmu instance Memory
-    // TODO check if "canNotUseMemoryManagementFunctions == true/false". If false memory allocation not possible
-    fi = (FMUInstance *)functions->allocateMemory(1, sizeof(FMUInstance));
-    fi->functions = functions;
-    if (fi) {
-        // Think about what to do with variable values. Using these structs and pointers slows down simulation computations. Maybe only necessary for input, output and tunable parameters??
-        fi->r = functions->allocateMemory(NUMBER_OF_REALS, sizeof(fmi2Real));
-        fi->i = functions->allocateMemory(NUMBER_OF_INTEGERS, sizeof(fmi2Integer));
-        fi->b = functions->allocateMemory(NUMBER_OF_BOOLEANS, sizeof(fmi2Boolean));
-        fi->s = functions->allocateMemory(NUMBER_OF_STRINGS,  sizeof(fmi2String));
-    } // variables in predefined arrays (performance issue) --> makes multiple instances of fmu impossible
-
-
-    fi->instanceName = functions->allocateMemory(1 + strlen(instanceName), sizeof(char));
-    fi->GUID = functions->allocateMemory(1 + strlen(fmuGUID), sizeof(char));
-
-    strcpy((char*)fi->instanceName, instanceName);
-    strcpy((char*)fi->GUID, fmuGUID);
-    fi->functions = functions;
-    fi->loggingOn = loggingOn;
-    fi->isVisible = visible;
-    fi->state = fmuInstantiated;
-    return fi;
-}
-
-fmi2Status fmi2SetupExperiment(fmi2Component fc, fmi2Boolean toleranceDefined, fmi2Real tolerance,
-                            fmi2Real startTime, fmi2Boolean stopTimeDefined, fmi2Real stopTime) {
-
-
-    FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiSetupExperiment\n",fi->instanceName);
-	if (fi->state != fmuInstantiated)
-	{
-		printf("fmu: %s was not instatiated before calling fmiSetupExperiment\n", fi->instanceName);
-		return fmi2Error;
-	}
-	fi->currentTime = startTime;
-	fi->stopTimeDefined = stopTimeDefined;
-	fi->toleranceDefined = toleranceDefined;
-	if (stopTimeDefined)
-	{
-		fi->stopTime = stopTime;
-	}
-
-	if (toleranceDefined)
-	{
-		fi->tolerance = tolerance;
-	}
-	//TODO
-	//fi->stepSize = getStepSize();
-	fi->state = fmuExperimentSettedUp;
-    return fmi2OK;
-}
-
-fmi2Status fmi2EnterInitializationMode(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiEnterInitializationMode\n",fi->instanceName);
-	if (fi->state != fmuExperimentSettedUp)
-	{
-		printf("fmu: %s experiment was not set-up before calling fmiEnterInitializationMode\n", fi->instanceName);
-		return fmi2Error;
-	}
-
-    fi->state = fmuInitMode;
-    return fmi2OK;
-}
-
-fmi2Status fmi2ExitInitializationMode(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance*) fc;
-	fmi2Status initStatus = fmi2OK;
-	printf("%s in fmiExitInitializationMode\n",fi->instanceName);
-	if (fi->state != fmuInitMode)
-	{
-		printf("fmu: %s did not enter Initialization Mode before calling fmiExitInitializationMode\n", fi->instanceName);
-		return fmi2Error;
-	}
-	// TODO
-	//initStatus = calculateInitialUnknownValues();
-	//initialize();
-    fi->state = fmuInitialized;
-    return initStatus;
-}
-
-fmi2Status fmi2DoStep(fmi2Component fc , fmi2Real currentCommPoint, fmi2Real commStepSize, fmi2Boolean noPrevFMUState)
-{
-	FMUInstance* fi = (FMUInstance *)fc;
-	fmi2Status simStatus = fmi2OK;
-    printf("%s in fmiDoStep()\n",fi->instanceName);
-    fi->b[_out_motor_down] = fi->b[_store_motor_down];
-    fi->b[_out_motor_up] = fi->b[_store_motor_up];
-    fi->b[_store_motor_down] = fi->b[_in_motor_down];
-    fi->b[_store_motor_up] = fi->b[_in_motor_up];
-    fi->currentTime = currentCommPoint + commStepSize;
-	return simStatus;
-}
-
-fmi2Status fmi2Terminate(fmi2Component fc)
-{
-	FMUInstance* fi = (FMUInstance *)fc;
-	printf("%s in fmiTerminate\n",fi->instanceName);
-	// do check if fi may be terminated
-	fi->state = fmuTerminated;
-    return fmi2OK;
-}
-
-
-void fmi2FreeInstance(fmi2Component fc)
-{
-
-	FMUInstance* fi = (FMUInstance*) fc;
-	printf("%s in fmiFreeInstance\n",fi->instanceName);
-
-    if (fi) {
-
-        fi->functions->freeMemory(fi->r);
-        fi->functions->freeMemory(fi->i);
-        fi->functions->freeMemory(fi->b);
-        fi->functions->freeMemory(fi->s);// TODO has to be done with loop
-		fi->functions->freeMemory((void*)fi->instanceName);
-		fi->functions->freeMemory((void*)fi->GUID);
-		fi->functions->freeMemory((void*)fi);
-
-    }
-}
-
-//To be implemented
-
-const char* fmi2GetVersion() {
-	printf("Function fmiGetVersion not supported\n");
-    return NULL;
-}
-
-const char* fmi2GetTypesPlatform() {
-	printf("Function fmiGetTypesPlatform not supported\n");
-    return NULL;
-}
-
-fmi2Status fmi2Reset(fmi2Component fc)
-{
-	printf("Function fmiReset not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2SetInteger(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, const fmi2Integer value[])
-{
-    printf("Function fmiSetInteger not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetInteger(fmi2Component fc, const fmi2ValueReference vr[], size_t nvr, fmi2Integer value[])
-{
-    printf("Function fmiGetInteger not supported\n");
-    return fmi2Error;
-}
-
-
-/*******OWN IMPLEMENTATION OF Get/Set FMU state*******/
-fmi2Status fmi2GetFMUstate (fmi2Component c, fmi2FMUstate* FMUstate) {
-    FMUInstance* orig = (FMUInstance*)c;
-    FMUInstance* fi = (FMUInstance *)FMUstate;
-    fi = orig->functions->allocateMemory(1, sizeof(FMUInstance));
-    *FMUstate = fi;
-    if (fi) {
-        // Think about what to do with variable values. Using these structs and pointers slows down simulation computations. Maybe only necessary for input, output and tunable parameters??
-        fi->r = orig->functions->allocateMemory(NUMBER_OF_REALS, sizeof(fmi2Real));
-        fi->i = orig->functions->allocateMemory(NUMBER_OF_INTEGERS, sizeof(fmi2Integer));
-        fi->b = orig->functions->allocateMemory(NUMBER_OF_BOOLEANS, sizeof(fmi2Boolean));
-        fi->s = orig->functions->allocateMemory(NUMBER_OF_STRINGS,  sizeof(fmi2String));
-
-    } // variables in predefined arrays (performance issue) --> makes multiple instances of fmu impossible
-    fi->instanceName = orig->functions->allocateMemory(1 + strlen(orig->instanceName), sizeof(char));
-    fi->GUID = orig->functions->allocateMemory(1 + strlen(orig->GUID), sizeof(char));
-
-    strcpy((char *)fi->instanceName, (char *)orig->instanceName);
-    strcpy((char *)fi->GUID, (char *)orig->GUID);
-    fi->functions = orig->functions;
-    fi->loggingOn = orig->loggingOn;
-    fi->isVisible = orig->isVisible;
-    fi->state = orig->state;
-    fi->stepSize = orig->stepSize;
-    fi->startTime = orig->startTime;
-    fi->stopTime = orig->stopTime;
-	fi->currentTime = orig->currentTime;
-	//copy r
-	int i=0;
-	for (i=0; i< NUMBER_OF_REALS;i++){
-	    printf("Setting real: %i %f\n", i, orig->r[i]);
-        fi->r[i] = orig->r[i];
-        printf("Setted real: %i %f\n", i, fi->r[i]);
-	}
-	//copy s
-	for (i=0; i< NUMBER_OF_STRINGS;i++){
-        fi->s[i] = orig->s[i];
-	}
-	//copy i
-    for (i=0; i< NUMBER_OF_INTEGERS;i++){
-        fi->i[i] = orig->i[i];
-	}
-	//copy b
-	for (i=0; i< NUMBER_OF_BOOLEANS;i++){
-        fi->b[i] = orig->b[i];
-	}
-    return fmi2OK;
-}
-
-
-fmi2Status fmi2SetFMUstate (fmi2Component c, fmi2FMUstate FMUstate) {
-    FMUInstance* orig = (FMUInstance*)FMUstate;
-    FMUInstance* fi = (FMUInstance*)c;
-    //set time etc correct, name and GUID should still be ok ;-)
-    printf("setting time values from %f to %f\n", fi->currentTime, orig->currentTime);
-    fi->state = orig->state;
-    fi->stepSize = orig->stepSize;
-    fi->startTime = orig->startTime;
-    fi->stopTime = orig->stopTime;
-	fi->currentTime = orig->currentTime;
-	printf("setting real values\n");
-	//copy r
-	int i=0;
-	for (i=0; i< NUMBER_OF_REALS;i++){
-        fi->r[i] = orig->r[i];
-	}
-	printf("setting string values\n");
-	//copy s
-	for (i=0; i< NUMBER_OF_STRINGS;i++){
-
-        fi->s[i] = orig->s[i];
-	}
-	//copy i
-    for (i=0; i< NUMBER_OF_INTEGERS;i++){
-        fi->i[i] = orig->i[i];
-	}
-	//copy b
-	for (i=0; i< NUMBER_OF_BOOLEANS;i++){
-        fi->b[i] = orig->b[i];
-	}
-    return fmi2OK;
-
-
-}
-/****************************************************/
-
-fmi2Status fmi2FreeFMUstate(fmi2Component c, fmi2FMUstate* FMUstate) {
-    printf("Function fmiFreeFMUstate not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2SerializedFMUstateSize(fmi2Component c, fmi2FMUstate FMUstate, size_t *size) {
-    printf("Function fmiSerializedFMUstateSize not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2SerializeFMUstate (fmi2Component c, fmi2FMUstate FMUstate, fmi2Byte serializedState[], size_t size) {
-    printf("Function fmiSerializeFMUstate not supported\n");
-    return fmi2Error;
-}
-fmi2Status fmi2DeSerializeFMUstate (fmi2Component c, const fmi2Byte serializedState[], size_t size, fmi2FMUstate* FMUstate) {
-    printf("Function fmiDeSerializeFMUstate not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetDirectionalDerivative(fmi2Component c, const fmi2ValueReference vUnknown_ref[], size_t nUnknown,
-                const fmi2ValueReference vKnown_ref[] , size_t nKnown, const fmi2Real dvKnown[], fmi2Real dvUnknown[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-
-fmi2Status fmi2SetRealInputDerivatives(fmi2Component c, const fmi2ValueReference vr[], size_t nvr,
-                                     const fmi2Integer order[], const fmi2Real value[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetRealOutputDerivatives(fmi2Component c, const fmi2ValueReference vr[], size_t nvr,
-                                      const fmi2Integer order[], fmi2Real value[]) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2CancelStep(fmi2Component c) {
-    printf("Function fmiGetDirectionalDerivative not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetStatus(fmi2Component c, const fmi2StatusKind s, fmi2Status *value) {
-    printf("Function fmiGetStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetRealStatus(fmi2Component c, const fmi2StatusKind s, fmi2Real *value) {
-    if(s == fmi2LastSuccessfulTime){
-        FMUInstance* comp = (FMUInstance*) c;
-        *value = comp->currentTime;
-        return fmi2OK;
-    }
-    printf("Function fmiGetRealStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetIntegerStatus(fmi2Component c, const fmi2StatusKind s, fmi2Integer *value) {
-    printf("Function fmiGetIntegerStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetBooleanStatus(fmi2Component c, const fmi2StatusKind s, fmi2Boolean *value) {
-    printf("Function fmiGetBooleanStatus not supported\n");
-    return fmi2Error;
-}
-
-fmi2Status fmi2GetStringStatus(fmi2Component c, const fmi2StatusKind s, fmi2String *value) {
-    printf("Function fmiGetStringStatus not supported\n");
-    return fmi2Error;
-}

+ 0 - 51
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/FMI_TD.h

@@ -1,51 +0,0 @@
-/*
- * PW_Controller.h
- *
- *  Created on: Jan 25, 2017
- *      Author: Joachim
- */
-
-#ifndef FMI_TD_H_
-#define FMI_TD_H_
-
-
- double relativeError(double a, double b);
- double absoluteError(double a, double b);
- int is_close(double a, double b, double REL_TOL, double ABS_TOL);
-
-
-typedef enum {
-    fmuInstantiated = 0,
-    fmuInitMode  = 1,
-	fmuInitialized = 2,
-    fmuTerminated   = 3,
-    fmuError        = 4,
-    fmuExperimentSettedUp = 5
-} FMUState;
-
-
-
-typedef struct {
-	fmi2Real    *r;
-    fmi2Integer *i;
-    fmi2Boolean *b;
-    fmi2String  *s;
-    fmi2Boolean isVisible;
-    fmi2String instanceName;
-    fmi2String GUID;
-    const fmi2CallbackFunctions* functions;
-    fmi2Boolean loggingOn;
-    FMUState state;
-	fmi2Real stepSize;
-    fmi2Real startTime;
-    fmi2Real stopTime;
-	fmi2Real currentTime;
-    fmi2Boolean stopTimeDefined;
-    fmi2Real tolerance;
-    fmi2Boolean toleranceDefined;
-} FMUInstance; // At the moment, most of the variables not really used since multiple instances of an FMU are not supported at the moment (performance issues)
-
-
-
-
-#endif /* FMI_TD_H_ */

+ 0 - 247
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/fmi2/fmi2FunctionTypes.h

@@ -1,247 +0,0 @@
-#ifndef fmi2FunctionTypes_h
-#define fmi2FunctionTypes_h
-
-#include "fmi2TypesPlatform.h"
-
-/* This header file must be utilized when compiling an FMU or an FMI master.
-   It declares data and function types for FMI 2.0
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Apr.  3, 2014: Added #include <stddef.h> for size_t definition
-   - Mar. 27, 2014: Added #include "fmiTypesPlatform.h" (#179)
-   - Mar. 26, 2014: Introduced function argument "void" for the functions (#171)
-                      fmiGetTypesPlatformTYPE and fmiGetVersionTYPE
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModelTYPE , fmiInstantiateSlaveTYPE  -> fmiInstantiateTYPE
-                      fmiFreeModelInstanceTYPE, fmiFreeSlaveInstanceTYPE -> fmiFreeInstanceTYPE
-                      fmiEnterModelInitializationModeTYPE, fmiEnterSlaveInitializationModeTYPE -> fmiEnterInitializationModeTYPE
-                      fmiExitModelInitializationModeTYPE , fmiExitSlaveInitializationModeTYPE  -> fmiExitInitializationModeTYPE
-                      fmiTerminateModelTYPE , fmiTerminateSlaveTYPE  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed
-                      fmiUpdateDiscreteStatesTYPE -> fmiNewDiscreteStatesTYPE
-                    Renamed elements of the enumeration fmiEventInfo
-                      upcomingTimeEvent             -> nextEventTimeDefined // due to generic naming scheme: varDefined + var
-                      newUpdateDiscreteStatesNeeded -> newDiscreteStatesNeeded;
-   - June 13, 2013: Changed type fmiEventInfo
-                    Functions removed:
-                       fmiInitializeModelTYPE
-                       fmiEventUpdateTYPE
-                       fmiCompletedEventIterationTYPE
-                       fmiInitializeSlaveTYPE
-                    Functions added:
-                       fmiEnterModelInitializationModeTYPE
-                       fmiExitModelInitializationModeTYPE
-                       fmiEnterEventModeTYPE
-                       fmiUpdateDiscreteStatesTYPE
-                       fmiEnterContinuousTimeModeTYPE
-                       fmiEnterSlaveInitializationModeTYPE;
-                       fmiExitSlaveInitializationModeTYPE;
-   - Feb. 17, 2013: Added third argument to fmiCompletedIntegratorStepTYPE
-                    Changed function name "fmiTerminateType" to "fmiTerminateModelType" (due to #113)
-                    Changed function name "fmiGetNominalContinuousStateTYPE" to
-                                          "fmiGetNominalsOfContinuousStatesTYPE"
-                    Removed fmiGetStateValueReferencesTYPE.
-   - Nov. 14, 2011: First public Version
-
-
-   Copyright (C) 2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* make sure all compiler use the same alignment policies for structures */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(push,8)
-#endif
-
-/* Include stddef.h, in order that size_t etc. is defined */
-#include <stddef.h>
-
-
-/* Type definitions */
-typedef enum {
-    fmi2OK,
-    fmi2Warning,
-    fmi2Discard,
-    fmi2Error,
-    fmi2Fatal,
-    fmi2Pending
-} fmi2Status;
-
-typedef enum {
-    fmi2ModelExchange,
-    fmi2CoSimulation
-} fmi2Type;
-
-typedef enum {
-    fmi2DoStepStatus,
-    fmi2PendingStatus,
-    fmi2LastSuccessfulTime,
-    fmi2Terminated
-} fmi2StatusKind;
-
-typedef void      (*fmi2CallbackLogger)        (fmi2ComponentEnvironment, fmi2String, fmi2Status, fmi2String, fmi2String, ...);
-typedef void*     (*fmi2CallbackAllocateMemory)(size_t, size_t);
-typedef void      (*fmi2CallbackFreeMemory)    (void*);
-typedef void      (*fmi2StepFinished)          (fmi2ComponentEnvironment, fmi2Status);
-
-typedef struct {
-   const fmi2CallbackLogger         logger;
-   const fmi2CallbackAllocateMemory allocateMemory;
-   const fmi2CallbackFreeMemory     freeMemory;
-   const fmi2StepFinished           stepFinished;
-   const fmi2ComponentEnvironment   componentEnvironment;
-} fmi2CallbackFunctions;
-
-typedef struct {
-   fmi2Boolean newDiscreteStatesNeeded;
-   fmi2Boolean terminateSimulation;
-   fmi2Boolean nominalsOfContinuousStatesChanged;
-   fmi2Boolean valuesOfContinuousStatesChanged;
-   fmi2Boolean nextEventTimeDefined;
-   fmi2Real    nextEventTime;
-} fmi2EventInfo;
-
-
-/* reset alignment policy to the one set before reading this file */
-#if defined _MSC_VER || defined __GNUC__
-#pragma pack(pop)
-#endif
-
-
-/* Define fmi2 function pointer types to simplify dynamic loading */
-
-/***************************************************
-Types for Common Functions
-****************************************************/
-
-/* Inquire version numbers of header files and setting logging status */
-   typedef const char* fmi2GetTypesPlatformTYPE(void);
-   typedef const char* fmi2GetVersionTYPE(void);
-   typedef fmi2Status  fmi2SetDebugLoggingTYPE(fmi2Component, fmi2Boolean, size_t, const fmi2String[]);
-
-/* Creation and destruction of FMU instances and setting debug status */
-   typedef fmi2Component fmi2InstantiateTYPE (fmi2String, fmi2Type, fmi2String, fmi2String, const fmi2CallbackFunctions*, fmi2Boolean, fmi2Boolean);
-   typedef void          fmi2FreeInstanceTYPE(fmi2Component);
-
-/* Enter and exit initialization mode, terminate and reset */
-   typedef fmi2Status fmi2SetupExperimentTYPE        (fmi2Component, fmi2Boolean, fmi2Real, fmi2Real, fmi2Boolean, fmi2Real);
-   typedef fmi2Status fmi2EnterInitializationModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2ExitInitializationModeTYPE (fmi2Component);
-   typedef fmi2Status fmi2TerminateTYPE              (fmi2Component);
-   typedef fmi2Status fmi2ResetTYPE                  (fmi2Component);
-
-/* Getting and setting variable values */
-   typedef fmi2Status fmi2GetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, fmi2Real   []);
-   typedef fmi2Status fmi2GetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Integer[]);
-   typedef fmi2Status fmi2GetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, fmi2Boolean[]);
-   typedef fmi2Status fmi2GetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, fmi2String []);
-
-   typedef fmi2Status fmi2SetRealTYPE   (fmi2Component, const fmi2ValueReference[], size_t, const fmi2Real   []);
-   typedef fmi2Status fmi2SetIntegerTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Integer[]);
-   typedef fmi2Status fmi2SetBooleanTYPE(fmi2Component, const fmi2ValueReference[], size_t, const fmi2Boolean[]);
-   typedef fmi2Status fmi2SetStringTYPE (fmi2Component, const fmi2ValueReference[], size_t, const fmi2String []);
-
-/* Getting and setting the internal FMU state */
-   typedef fmi2Status fmi2GetFMUstateTYPE           (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SetFMUstateTYPE           (fmi2Component, fmi2FMUstate);
-   typedef fmi2Status fmi2FreeFMUstateTYPE          (fmi2Component, fmi2FMUstate*);
-   typedef fmi2Status fmi2SerializedFMUstateSizeTYPE(fmi2Component, fmi2FMUstate, size_t*);
-   typedef fmi2Status fmi2SerializeFMUstateTYPE     (fmi2Component, fmi2FMUstate, fmi2Byte[], size_t);
-   typedef fmi2Status fmi2DeSerializeFMUstateTYPE   (fmi2Component, const fmi2Byte[], size_t, fmi2FMUstate*);
-
-/* Getting partial derivatives */
-   typedef fmi2Status fmi2GetDirectionalDerivativeTYPE(fmi2Component, const fmi2ValueReference[], size_t,
-                                                                   const fmi2ValueReference[], size_t,
-                                                                   const fmi2Real[], fmi2Real[]);
-
-/***************************************************
-Types for Functions for FMI2 for Model Exchange
-****************************************************/
-
-/* Enter and exit the different modes */
-   typedef fmi2Status fmi2EnterEventModeTYPE         (fmi2Component);
-   typedef fmi2Status fmi2NewDiscreteStatesTYPE      (fmi2Component, fmi2EventInfo*);
-   typedef fmi2Status fmi2EnterContinuousTimeModeTYPE(fmi2Component);
-   typedef fmi2Status fmi2CompletedIntegratorStepTYPE(fmi2Component, fmi2Boolean, fmi2Boolean*, fmi2Boolean*);
-
-/* Providing independent variables and re-initialization of caching */
-   typedef fmi2Status fmi2SetTimeTYPE            (fmi2Component, fmi2Real);
-   typedef fmi2Status fmi2SetContinuousStatesTYPE(fmi2Component, const fmi2Real[], size_t);
-
-/* Evaluation of the model equations */
-   typedef fmi2Status fmi2GetDerivativesTYPE               (fmi2Component, fmi2Real[], size_t);
-#ifdef FMU_EXPERIMENTAL
-   typedef fmi2Status fmi2GetSpecificDerivativesTYPE       (fmi2Component, fmi2Real[], const fmi2ValueReference [], size_t);
-#endif
-
-   typedef fmi2Status fmi2GetEventIndicatorsTYPE           (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetContinuousStatesTYPE          (fmi2Component, fmi2Real[], size_t);
-   typedef fmi2Status fmi2GetNominalsOfContinuousStatesTYPE(fmi2Component, fmi2Real[], size_t);
-
-
-/***************************************************
-Types for Functions for FMI2 for Co-Simulation
-****************************************************/
-
-/* Simulating the slave */
-   typedef fmi2Status fmi2SetRealInputDerivativesTYPE (fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], const fmi2Real []);
-   typedef fmi2Status fmi2GetRealOutputDerivativesTYPE(fmi2Component, const fmi2ValueReference [], size_t, const fmi2Integer [], fmi2Real []);
-
-   typedef fmi2Status fmi2DoStepTYPE     (fmi2Component, fmi2Real, fmi2Real, fmi2Boolean);
-   typedef fmi2Status fmi2CancelStepTYPE (fmi2Component);
-
-/* Inquire slave status */
-   typedef fmi2Status fmi2GetStatusTYPE       (fmi2Component, const fmi2StatusKind, fmi2Status* );
-   typedef fmi2Status fmi2GetRealStatusTYPE   (fmi2Component, const fmi2StatusKind, fmi2Real*   );
-   typedef fmi2Status fmi2GetIntegerStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Integer*);
-   typedef fmi2Status fmi2GetBooleanStatusTYPE(fmi2Component, const fmi2StatusKind, fmi2Boolean*);
-   typedef fmi2Status fmi2GetStringStatusTYPE (fmi2Component, const fmi2StatusKind, fmi2String* );
-
-
-#ifdef __cplusplus
-}  /* end of extern "C" { */
-#endif
-
-#endif /* fmi2FunctionTypes_h */

+ 0 - 339
SemanticAdaptationForFMI/Experiments/power_window_case_study/fmu20/fmu/cs/FMI_TD/fmi2/fmi2Functions.h

@@ -1,339 +0,0 @@
-#ifndef fmi2Functions_h
-#define fmi2Functions_h
-
-/* This header file must be utilized when compiling a FMU.
-   It defines all functions of the
-         FMI 2.0 Model Exchange and Co-Simulation Interface.
-
-   In order to have unique function names even if several FMUs
-   are compiled together (e.g. for embedded systems), every "real" function name
-   is constructed by prepending the function name by "FMI2_FUNCTION_PREFIX".
-   Therefore, the typical usage is:
-
-      #define FMI2_FUNCTION_PREFIX MyModel_
-      #include "fmi2Functions.h"
-
-   As a result, a function that is defined as "fmi2GetDerivatives" in this header file,
-   is actually getting the name "MyModel_fmi2GetDerivatives".
-
-   This only holds if the FMU is shipped in C source code, or is compiled in a
-   static link library. For FMUs compiled in a DLL/sharedObject, the "actual" function
-   names are used and "FMI2_FUNCTION_PREFIX" must not be defined.
-
-   Revisions:
-   - Apr.  9, 2014: all prefixes "fmi" renamed to "fmi2" (decision from April 8)
-   - Mar. 26, 2014: FMI_Export set to empty value if FMI_Export and FMI_FUNCTION_PREFIX
-                    are not defined (#173)
-   - Oct. 11, 2013: Functions of ModelExchange and CoSimulation merged:
-                      fmiInstantiateModel , fmiInstantiateSlave  -> fmiInstantiate
-                      fmiFreeModelInstance, fmiFreeSlaveInstance -> fmiFreeInstance
-                      fmiEnterModelInitializationMode, fmiEnterSlaveInitializationMode -> fmiEnterInitializationMode
-                      fmiExitModelInitializationMode , fmiExitSlaveInitializationMode  -> fmiExitInitializationMode
-                      fmiTerminateModel, fmiTerminateSlave  -> fmiTerminate
-                      fmiResetSlave -> fmiReset (now also for ModelExchange and not only for CoSimulation)
-                    Functions renamed:
-                      fmiUpdateDiscreteStates -> fmiNewDiscreteStates
-   - June 13, 2013: Functions removed:
-                       fmiInitializeModel
-                       fmiEventUpdate
-                       fmiCompletedEventIteration
-                       fmiInitializeSlave
-                    Functions added:
-                       fmiEnterModelInitializationMode
-                       fmiExitModelInitializationMode
-                       fmiEnterEventMode
-                       fmiUpdateDiscreteStates
-                       fmiEnterContinuousTimeMode
-                       fmiEnterSlaveInitializationMode;
-                       fmiExitSlaveInitializationMode;
-   - Feb. 17, 2013: Portability improvements:
-                       o DllExport changed to FMI_Export
-                       o FUNCTION_PREFIX changed to FMI_FUNCTION_PREFIX
-                       o Allow undefined FMI_FUNCTION_PREFIX (meaning no prefix is used)
-                    Changed function name "fmiTerminate" to "fmiTerminateModel" (due to #113)
-                    Changed function name "fmiGetNominalContinuousState" to
-                                          "fmiGetNominalsOfContinuousStates"
-                    Removed fmiGetStateValueReferences.
-   - Nov. 14, 2011: Adapted to FMI 2.0:
-                       o Split into two files (fmiFunctions.h, fmiTypes.h) in order
-                         that code that dynamically loads an FMU can directly
-                         utilize the header files).
-                       o Added C++ encapsulation of C-part, in order that the header
-                         file can be directly utilized in C++ code.
-                       o fmiCallbackFunctions is passed as pointer to fmiInstantiateXXX
-                       o stepFinished within fmiCallbackFunctions has as first
-                         argument "fmiComponentEnvironment" and not "fmiComponent".
-                       o New functions to get and set the complete FMU state
-                         and to compute partial derivatives.
-   - Nov.  4, 2010: Adapted to specification text:
-                       o fmiGetModelTypesPlatform renamed to fmiGetTypesPlatform
-                       o fmiInstantiateSlave: Argument GUID     replaced by fmuGUID
-                                              Argument mimetype replaced by mimeType
-                       o tabs replaced by spaces
-   - Oct. 16, 2010: Functions for FMI for Co-simulation added
-   - Jan. 20, 2010: stateValueReferencesChanged added to struct fmiEventInfo (ticket #27)
-                    (by M. Otter, DLR)
-                    Added WIN32 pragma to define the struct layout (ticket #34)
-                    (by J. Mauss, QTronic)
-   - Jan.  4, 2010: Removed argument intermediateResults from fmiInitialize
-                    Renamed macro fmiGetModelFunctionsVersion to fmiGetVersion
-                    Renamed macro fmiModelFunctionsVersion to fmiVersion
-                    Replaced fmiModel by fmiComponent in decl of fmiInstantiateModel
-                    (by J. Mauss, QTronic)
-   - Dec. 17, 2009: Changed extension "me" to "fmi" (by Martin Otter, DLR).
-   - Dez. 14, 2009: Added eventInfo to meInitialize and added
-                    meGetNominalContinuousStates (by Martin Otter, DLR)
-   - Sept. 9, 2009: Added DllExport (according to Peter Nilsson's suggestion)
-                    (by A. Junghanns, QTronic)
-   - Sept. 9, 2009: Changes according to FMI-meeting on July 21:
-                    meInquireModelTypesVersion     -> meGetModelTypesPlatform
-                    meInquireModelFunctionsVersion -> meGetModelFunctionsVersion
-                    meSetStates                    -> meSetContinuousStates
-                    meGetStates                    -> meGetContinuousStates
-                    removal of meInitializeModelClass
-                    removal of meGetTime
-                    change of arguments of meInstantiateModel
-                    change of arguments of meCompletedIntegratorStep
-                    (by Martin Otter, DLR):
-   - July 19, 2009: Added "me" as prefix to file names (by Martin Otter, DLR).
-   - March 2, 2009: Changed function definitions according to the last design
-                    meeting with additional improvements (by Martin Otter, DLR).
-   - Dec. 3 , 2008: First version by Martin Otter (DLR) and Hans Olsson (Dynasim).
-
-   Copyright (C) 2008-2011 MODELISAR consortium,
-               2012-2013 Modelica Association Project "FMI"
-               All rights reserved.
-   This file is licensed by the copyright holders under the BSD 2-Clause License
-   (http://www.opensource.org/licenses/bsd-license.html):
-
-   ----------------------------------------------------------------------------
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are met:
-
-   - Redistributions of source code must retain the above copyright notice,
-     this list of conditions and the following disclaimer.
-   - Redistributions in binary form must reproduce the above copyright notice,
-     this list of conditions and the following disclaimer in the documentation
-     and/or other materials provided with the distribution.
-   - Neither the name of the copyright holders nor the names of its
-     contributors may be used to endorse or promote products derived
-     from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-   ----------------------------------------------------------------------------
-
-   with the extension:
-
-   You may distribute or publicly perform any modification only under the
-   terms of this license.
-   (Note, this means that if you distribute a modified file,
-    the modified file must also be provided under this license).
-*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "fmi2TypesPlatform.h"
-#include "fmi2FunctionTypes.h"
-#include <stdlib.h>
-
-
-/*
-  Export FMI2 API functions on Windows and under GCC.
-  If custom linking is desired then the FMI2_Export must be
-  defined before including this file. For instance,
-  it may be set to __declspec(dllimport).
-*/
-#if !defined(FMI2_Export)
-  #if !defined(FMI2_FUNCTION_PREFIX)
-    #if defined _WIN32 || defined __CYGWIN__
-     /* Note: both gcc & MSVC on Windows support this syntax. */
-        #define FMI2_Export __declspec(dllexport)
-    #else
-      #if __GNUC__ >= 4
-        #define FMI2_Export __attribute__ ((visibility ("default")))
-      #else
-        #define FMI2_Export
-      #endif
-    #endif
-  #else
-    #define FMI2_Export
-  #endif
-#endif
-
<