Browse Source

lazy does not need refreshOutputs var

Cláudio Gomes 4 years ago
parent
commit
6b27ccbbb8

+ 4 - 10
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy.sa

@@ -17,19 +17,15 @@ param 	INIT_UP := 0.0,
 		INIT_STOP := 0.0;
 
 control var	tn := -1.0,
-			tl := -1.0,
-			refresh_outputs := true;
+			tl := -1.0;
 
 control rules {
 	if (tl < 0.0){
 		tl := t;
 	}
 	
-	refresh_outputs := false;
-	
 	var step_size := min(H, tn - t); 
 	if (lazy_sa.obj_detected or (t+H) >= tn){
-		refresh_outputs := true; 
 		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); 
@@ -45,11 +41,9 @@ out var	stored_up := INIT_UP,
 		stored_stop := INIT_STOP;
 out rules{
 	 true -> {
-		if (refresh_outputs){
-			stored_up := controller.up;
-			stored_down := controller.down;
-			stored_stop := controller.stop;
-		}
+		stored_up := controller.up;
+		stored_down := controller.down;
+		stored_stop := controller.stop;
 	} --> {
 		lazy_sa.up := stored_up;
 		lazy_sa.down := stored_down;

+ 4 - 10
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation.tests/input/power_window_case_study/lazy_sa_commented.sa

@@ -22,8 +22,7 @@ param 	INIT_UP := 0.0,
 		INIT_STOP := 0.0;
 
 control var	tn := -1.0,
-			tl := -1.0,
-			refresh_outputs := true;
+			tl := -1.0;
 
 control rules {
 	// This initialisation covers simulations that start at a non-zero time.
@@ -31,12 +30,9 @@ control rules {
 		tl := t;
 	}
 	
-	refresh_outputs := false;
-	
 	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){
-		refresh_outputs := true; // This is used in the mapOut rules, to refresh the outputs.
 		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.
@@ -61,11 +57,9 @@ out var	stored_up := INIT_UP,
 		stored_stop := INIT_STOP;
 out rules{
 	 true -> {
-		if (refresh_outputs){
-			stored_up := controller.up;
-			stored_down := controller.down;
-			stored_stop := controller.stop;
-		}
+		stored_up := controller.up;
+		stored_down := controller.down;
+		stored_stop := controller.stop;
 	} --> {
 		lazy_sa.up := stored_up;
 		lazy_sa.down := stored_down;