code power_sa: var in_condition_executed; var out_condition_executed; var power; //FMU power ref var time_last_window; var stored_windowsa_u, stored_windowsa_d; var stored_window_reaction_torque, stored_window_height; var init_armature_current = 0, init_displacement = 0, init_speed = 0; var stored_armature_current, stored_displacement, stored_speed; function instantiate() power.instantiate() return end function function setup_experiment(t, ...) time_last_window := t; end function function enter_init() power.enter_init() return end function function exit_init() power.exit_init() return end function function setValues(ports, values) in_condition_executed = empty map if (true) then in_condition_executed[cond1] = true stored_windowsa_u = values["u"] stored_windowsa_d = values["d"] // power_sa is moore, so nothing else to do. end if out_condition_executed := empty map // force output computation. end function function doStep(t, H) var e := t - time_last_window; { // new scope var t := t var h := H var dt := 0 power.setValues("u", stored_windowsa_u) power.setValues("d", stored_windowsa_d) } power.doStep(t, H); time_last_window := t; out_condition_executed := empty map end function function getValues(ports) var values = empty map if out_condition_executed == empty map then if true then stored_armature_current = power.getValues("armature_current") out_condition_executed[cond1] := true end if if true then stored_displacement = power.getValues("displacement") out_condition_executed[cond2] := true end if if true then stored_speed = power.getValues("speed") out_condition_executed[cond3] := true end if end if if out_condition_executed[cond1] then values["armature_current"] := stored_armature_current end if if out_condition_executed[cond2] then values["displacement"] := stored_displacement end if if out_condition_executed[cond3] then values["speed"] := stored_speed end if return values end function