// outdated

semantic adaptation window_obstacle_sa_loop overrides master
for fmu window_sa, obstacle
input ports motor_speed
output ports reaction_torque
param MAXITER = 100;
param REL_TOL = 1e-8;
param ABS_TOL = 1e-8;
in rules {
	true -> {
		height := height; // do_step will always use the last values, local_step does not advance time so will replace the last signal values! therefore, we must set the signal at time t+h of reaction_torque and height. this is done by a very weird statement:
		reaction_force := 0; // and just initialise other values at time t+h
		var prev_height; // to compare new value with previous value
		for (var iter in 0 .. MAXITER) {
			prev_height := height;
			local_step(obstacle); // with delayed input for height
			local_step(window_sa);
			if (is_close(prev_height, height, REL_TOL, ABS_TOL)) {
				break;
			}
		}
	} --> { };
}
