Added Simulation plc and removed unnecessary files from repository
This commit is contained in:
@@ -6,20 +6,29 @@ VAR_INPUT
|
||||
// Raise sensor level from min to max
|
||||
xEnable : BOOL;
|
||||
|
||||
// Switch to error high
|
||||
xErrorHigh : BOOL := FALSE;
|
||||
|
||||
// Switch to error low
|
||||
xErrorLow : BOOL := FALSE;
|
||||
|
||||
// Sensor value when enabled
|
||||
rOnValue : REAL;
|
||||
|
||||
// Sensor value when dissabled
|
||||
rOffValue : REAL;
|
||||
|
||||
// Sensor value error high
|
||||
rErrorLowValue : REAL;
|
||||
|
||||
// Sensor value error high
|
||||
rErrorHighValue : REAL;
|
||||
|
||||
// Sensor noise value
|
||||
rNoise : REAL := 0.0;
|
||||
|
||||
// Sensor min value for analog scaling
|
||||
rMinValue : REAL := 0.0;
|
||||
|
||||
// Sensor max value for analog scaling
|
||||
rMaxValue : REAL := 1.0;
|
||||
// Analog output scaling
|
||||
stAnalogScaling : ST_ANALOG_IO_CONFIG;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
iAnalogValue AT %Q* : INT;
|
||||
@@ -42,18 +51,25 @@ VAR
|
||||
_rPrevValue : REAL := 0.0;
|
||||
|
||||
// Analog output
|
||||
_fbValveAnalogOutput : FB_AnalogOutput('');
|
||||
|
||||
// Analog output scaling
|
||||
_stAnalogScaling : ST_ANALOG_IO_CONFIG;
|
||||
_stAnalogEWConfig : ST_ANALOG_EW_LEVELS;
|
||||
_stAnalogEWDelays : ST_ANALOG_EW_DELAYS;
|
||||
{attribute 'hide'}
|
||||
_fbAnalogOutput : FB_AnalogOutput('');
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Pressure only if enabled
|
||||
IF xEnable THEN
|
||||
// Normal enable value
|
||||
_rTargetValue := rOnValue;
|
||||
|
||||
// Switch to error high value
|
||||
IF xErrorHigh AND (NOT xErrorLow) THEN
|
||||
_rTargetValue := rErrorHighValue;
|
||||
END_IF
|
||||
|
||||
// Switch to error low value
|
||||
IF xErrorLow AND (NOT xErrorHigh) THEN
|
||||
_rTargetValue := rErrorHighValue;
|
||||
END_IF
|
||||
ELSE
|
||||
_rTargetValue := rOffValue;
|
||||
END_IF
|
||||
@@ -70,16 +86,11 @@ IF xEnable THEN
|
||||
_rValue := _rValue + (LREAL_TO_REAL(_lrTmp - 0.5) * rNoise);
|
||||
END_IF
|
||||
|
||||
// Set analog output scaling
|
||||
_stAnalogScaling.iAIMax := 32767;
|
||||
_stAnalogScaling.iAIMin := 0;
|
||||
_stAnalogScaling.rPVMax := rMaxValue;
|
||||
_stAnalogScaling.rPVMin := rMinValue;
|
||||
|
||||
// Calculate analog output from ramp generator setpoint
|
||||
_fbValveAnalogOutput(
|
||||
_fbAnalogOutput(
|
||||
rSetpoint:= _rValue,
|
||||
stScalingConfig:= _stAnalogScaling,
|
||||
stScalingConfig:= stAnalogScaling,
|
||||
xReleaseErrors:= FALSE,
|
||||
xReleaseHardwareErrors:= FALSE,
|
||||
xConfirmAlarms:= ,
|
||||
@@ -87,11 +98,7 @@ _fbValveAnalogOutput(
|
||||
xError=> );]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="FB_AnalogSensorMockup">
|
||||
<LineId Id="719" Count="14" />
|
||||
<LineId Id="798" Count="0" />
|
||||
<LineId Id="734" Count="0" />
|
||||
<LineId Id="799" Count="0" />
|
||||
<LineId Id="735" Count="14" />
|
||||
<LineId Id="1084" Count="38" />
|
||||
<LineId Id="9" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
|
||||
Reference in New Issue
Block a user