Supported platforms: CODESYS 3.5, CODESYS 3.5 SAFETY
This section describes how to control Danfoss PVG voltage valves.
|
This example uses the following libraries: SafeProportionalValveControl library
SafeSSeriesHardware library
, or alternatively non-safe library SensorsAndActuators library
|
|
Depending on hardware, output group control needs to be activated before controlling outputs. See How to use S series and E series HW diagnostics for more information.
|
|
Currently, the S Series and E Series control unit's code template S_Outputs / Outputs programs provide interface for all output related variables defined in Epec MultiTool Creator. All output related function blocks are implemented by the application. |
|
External voltage detection in output pins is provided by safety control unit's switch startup test. The startup test execution depends on used product:
After startup test the external voltage is monitored by application diagnostics. |
|
Application level detection is required if external voltage needs to be monitored while operational (application functionality specific). External voltage can be monitored using DOS status of the output when PWM control is not active. |
|
S_ADCToVoltageOrCurrent and S_VoltageToDI POUs are included in the code template generated by Multitool Creator. |
The following example shows how to control a PVG valve when the following I/O pins are defined in MultiTool Creator:
PosEndAttenuation DI
NegEndAttenuation DI
PVGErrorSignal DI
VoltageValve PWFM
SupplyToVoltageValve DO
|
When the following example is used with non-safety I/O, the I/O variables are generated in Inputs and Outputs programs instead of S_Inputs and S_Outputs. |
|
In the following example, the output's PWM pin external voltage error is not monitored when control is inactive. See the How to control DO & DO ECO example for more information. |
Safe PRG:
|
|
Init method:
|
IF NOT initDone THEN S_MovementEndAttenuation.Init( S_i_PosDirAttenuationLimit:=UINT#90 , S_i_NegDirAttenuationLimit:=UINT#90 , i_pEventCode:= ADR(eventCode_VoltageValve), i_pEventCodePosDirAtt:=ADR(S_Inputs.o_EventCodeMain_PosEndAttenuation) , i_pEventCodeNegDirAtt:=ADR(S_Inputs.o_EventCode_NegEndAttenuation) );
S_VoltageValve.Init( S_i_PosDirMaxPWMLevel:= UINT#750, S_i_PosDirMinPWMLevel:= UINT#550, S_i_CenterPositionPWMLevel:= UINT#500, S_i_NegDirMinPWMLevel:= UINT#450, S_i_NegDirMaxPWMLevel:= UINT#250, S_i_PosDirAscendRampTime:= UINT#1000, S_i_PosDirDescendRampTime:=UINT#1000 , S_i_NegDirAscendRampTime:= UINT#1000, S_i_NegDirDescendRampTime:=UINT#1000 , S_i_PVGPullUpResistor:=UDINT#24000 , S_i_PVGPullDownResistor:= UDINT#24000, S_i_PinPullUpResistor:= UDINT#0, S_i_PinPullDownResistor:=UDINT#8000 , S_i_DiagnosticDelay:= UINT#100, i_pEventCode:=ADR(eventCode_VoltageValve ), i_pEventCodePVGError:=ADR(S_Inputs.o_EventCode_PVGErrorSignal) );
S_VoltageValveSupply.Init(S_i_OverCurrentLimit:=DINT#700 , S_i_BrokenCircuitCurrentLimit:=DINT#30 , S_i_DiagnosticDelay:=UINT#30 , i_pEventCode:=ADR(eventCode_VoltageValve ) );
initDone:=TRUE; END_IF
|
The following code controls non-safe voltage valve with alternative non-safe wrapper POU.
Code at non-safe PRG: |
|
SafeProportionalValveControl library
S_EndAttenuation (FB)
S_PVGValveController (FB)
SensorsAndActuators library
SafeSSeriesHardware library
Source file topic100378.htm
Last updated 21-Feb-2025