CONTINUOUS_MODEL PSmooth ABSTRACT "SMOOTHed (no events) approximation to P-controller. Approximates real behaviour with a sine function. No event calls. Input control signal <= 0 (usually schedule) overrides control action. Output in control mode varies between 0 and 1 (or 1 and 0), as measured signal varies between lo and hi (or hi and lo). (hi < lo means turn down control as measured signal increases, e.g. temperature control of radiator). Multiple output links." EQUATIONS RampPos := (Measure - (hi + lo)/2) / (hi - lo); OutSignal = IF OverRide <= 0 THEN OverRide ELSE_IF RampPos > 0.5 THEN 1 ELSE_IF RampPos < -0.5 THEN 0 ELSE (sin (RampPos*PI) + 1) / 2 END_IF ; LINKS GENERIC MeasureLink Measure; GENERIC OverRideLink OverRide; FOR i = 1, n GENERIC OutSignalLink[i] OutSignal END_FOR; VARIABLES GENERIC RampPos LOC 2 -BIG BIG "Normalized measurement signal" GENERIC Measure IN 20 -BIG BIG "Sensed signal" GENERIC OutSignal OUT 0.5 0 1 "Control signal" GENERIC OverRide IN 1 -BIG BIG "Control action override signal, <= 0 overrides" MODEL_PARAMETERS INT n SMP 1 1 BIGINT "Number of OutSignal links" PARAMETERS GENERIC hi S_P 23 -BIG BIG "Sensed signal at which OutSignal becomes 1" GENERIC lo S_P 21 -BIG BIG "Sensed signal at which OutSignal becomes 0" END_MODEL