Browse Source

corrected calculation of h in the generated example.

Cláudio Gomes 7 years ago
parent
commit
9e793d0473

+ 6 - 6
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation/examples/algorithm.c

@@ -86,7 +86,7 @@ code AdaptedFMU:
 		out_condition_executed := empty map // force output computation.
 		out_condition_executed := empty map // force output computation.
 	end function
 	end function
 	
 	
-	function do_inner_step(fmu, t, inner_t, h) 
+	function do_inner_step(fmu, t, inner_t, some_step_size) 
 		/*
 		/*
 		Evaluate each update_in block of the rules that were successfully evaluated before the doStep was called.
 		Evaluate each update_in block of the rules that were successfully evaluated before the doStep was called.
 		This is because the window.doStep will be called immediately afterward.
 		This is because the window.doStep will be called immediately afterward.
@@ -96,17 +96,17 @@ code AdaptedFMU:
 			These variables are available in the scope of the update_in block.
 			These variables are available in the scope of the update_in block.
 				It's not a good idea to have t also in that scope, because it is not available when getValues/setValues is called.
 				It's not a good idea to have t also in that scope, because it is not available when getValues/setValues is called.
 			*/
 			*/
-			var h = h
+			var h = some_step_size
 			var dt = inner_t - t
 			var dt = inner_t - t
 			<update_in_1>
 			<update_in_1>
 		end if
 		end if
 		if (in_condition_executed[IN_COND_2]) then
 		if (in_condition_executed[IN_COND_2]) then
-			var h = h
+			var h = some_step_size
 			var dt = inner_t - t
 			var dt = inner_t - t
 			<update_in_2>
 			<update_in_2>
 		end if
 		end if
 		...
 		...
-		fmi2DoStep(fmu1, inner_t, h)
+		fmi2DoStep(fmu1, inner_t, some_step_size)
 		/*
 		/*
 		Executes the update_out blocks.
 		Executes the update_out blocks.
 		These always execute after a doStep is called on an internal FMU.
 		These always execute after a doStep is called on an internal FMU.
@@ -116,7 +116,7 @@ code AdaptedFMU:
 		*/
 		*/
 		if (<out_condition_1>) then
 		if (<out_condition_1>) then
 			out_condition_executed[OUT_COND_1] = true
 			out_condition_executed[OUT_COND_1] = true
-			var h = h
+			var h = some_step_size
 			var dt = inner_t - t
 			var dt = inner_t - t
 			<update_out_1>
 			<update_out_1>
 		end if
 		end if
@@ -139,7 +139,7 @@ code AdaptedFMU:
 		
 		
 		<control_block_part_1>
 		<control_block_part_1>
 		
 		
-		do_inner_step(fmu1, t, inner_t, h);
+		do_inner_step(fmu1, t, inner_t, some_step_size);
 		
 		
 		<control_block_part_2>
 		<control_block_part_2>
 		
 		

+ 1 - 1
DSL_SemanticAdaptation/be.uantwerpen.ansymo.semanticadaptation/examples/sketch.BASE.sa

@@ -45,7 +45,7 @@ in rules {
 
 
 control rules {
 control rules {
 	control_block_part_1
 	control_block_part_1
-	do_step(fmu1, inner_t, h)
+	do_step(fmu1, inner_t, some_step_size)
 	control_block_part_2
 	control_block_part_2
 	
 	
 	return step_size;
 	return step_size;