Supported platforms: CODESYS 2.3, CODESYS 3.5
PVC_CurrentValvePairController function block controls a current controlled proportional pair in products that do not have a controller built in at firmware, such as Epec 3000 series.
The function block calls PVC_CurrentValvePair FB and converts its output to a PWM request with PVC_CurrentController.
ADC_To_mAOrV is used to convert feedback signal to mA value for the current controller.
PVC_ValveDiagnostic FB is called for diagnosing short circuit and broken circuit errors. In case of a short circuit or a broken circuit error, PWM outputs are disabled until i_Control is set to zero (this function can, however, be disabled with a parameter).
With i_CommonCurrentMeasure input the user can define whether there are separate current measure signals for both PWM outputs or not.
With i_EnableCounterControl input the user can enable the counter control feature, but only if both valves have their own current measurements (i_CommonCurrentMeasure is FALSE). The counter control feature allows both valves to be controlled simultaneously. This makes it possible to counter control.
If i_Enable is inactive or in case of a parameter error or AI voltage error, the PWM request and valve supply outputs are set to zero.
Use only with hardware that does not have a built-in current controller, i.e. PWM value is written to output. |
i_Control must be 0 on the rising edge of i_Enable status. Otherwise control is not enabled. |
When the linear ramp type is selected, the ramp speed changes when the current parameters are changed. |
By leaving P- and I-parameters empty (0), default values are calculated from coil resistance. See function PVC_Initialize_P_and_I. |
Input variable name |
Data type |
Range |
Description |
i_Enable |
BOOL |
FALSE/TRUE |
Enables controlling of the current request outputs. |
i_Control |
INT |
-32767..32767 |
Control signal from e.g. joystick |
i_PosDirFeedbackCurrent |
UINT |
Hardware specific |
ADC current value from FB input or high side current measure. |
i_NegDirFeedbackCurrent |
UINT |
Hardware specific |
ADC current value from FB input or high side current measure. |
i_FBType |
BYTE |
0.. G_ADScaleArrMax |
Type of current feedback inputs |
i_CommonCurrentMeasure |
BOOL |
FALSE/TRUE |
Defines if there is separate current measuring for both pwm outputs or not. When true, i_PosDirFeedbackCurrent input is used as common measure for both directions. |
i_PosDirMaxCurrent |
UINT |
1..2500 mA |
Maximum current for valve that is controlled with positive control signal |
i_PosDirMinCurrent |
UINT |
1..2500 mA |
Minimum current for valve that is controlled with positive control signal |
i_NegDirMinCurrent |
UINT |
1..2500 mA |
Minimum current for valve that is controlled with negative control signal |
i_NegDirMaxCurrent |
UINT |
1..2500 mA |
Maximum current for valve that is controlled with negative control signal. |
i_RampType |
BYTE |
0..G_RampTypeMax |
Defines which one of the available ramp functions is used. |
i_PosDirAscendRamp |
UINT |
Depends on selected ramp type |
Ascending speed for valve that is controlled with positive control signal, range and unit depends on selected ramp type. |
i_PosDirDescendRamp |
UINT |
Depends on selected ramp type |
Descending speed for valve that is controlled with positive control signal, range and unit depends on selected ramp type. |
i_NegDirAscendRamp |
UINT |
Depends on selected ramp type |
Ascending speed for valve that is controlled with negative control signal, range and unit depends on selected ramp type. |
i_NegDirDescendRamp |
UINT |
Depends on selected ramp type |
Descending speed for valve that is controlled with negative control signal, range and unit depends on selected ramp type. |
i_PosDirAttenuationOn |
BOOL |
FALSE/TRUE |
If input is true, controlling of positive direction valve is limited to given percentage of max control. |
i_NegDirAttenuationOn |
BOOL |
FALSE/TRUE |
If input is true, controlling of negative direction valve is limited to given percentage of max control. |
i_PosDirAttenuationAmount |
BYTE |
0..100% |
Amount of attenuation for positive direction valve. |
i_NegDirAttenuationAmount |
BYTE |
0..100% |
Amount of attenuation for negative direction valve. |
i_EnableCounterControl |
BOOL |
FALSE/TRUE |
Both valves can be controlled at the same time. |
i_SupplyVoltage |
UINT |
Hardware specific |
Measured supply voltage with two decimals, 2400 = 24,00V |
i_Fast |
BOOL |
FALSE/TRUE |
Use fast PI curve pre-scaled parameters by default. Pre-scaled P and I are used if both given i_P_Gain and i_I_Gain is zero. |
i_P_Gain |
UINT |
0..65535 |
Proportional gain of PI controller, 1000 = 1 |
i_I_Gain |
UINT |
0..65535 |
Integration gain of PI controller, 1000 = 1 |
i_CoilResistance |
UINT |
3..200 Ohm |
Coil nominal resistance value in Ohms. |
i_CircuitErrorDelay |
UINT |
0..65535 ms |
Delay before error outputs are activated in ms. |
i_CircuitErrorDisablesOutput |
BOOL |
FALSE/TRUE |
Defines if PWM output is disabled in short circuit or broken circuit error situations |
Input variable name |
Data type |
Range |
Description |
i_Enable |
BOOL |
FALSE/TRUE |
Enables controlling of the current request outputs. |
i_Control |
INT |
-32767..32767 |
Control signal from e.g. joystick |
i_PosDirFeedbackCurrent |
UINT |
Hardware specific |
ADC current value from FB input or high side current measure. |
i_NegDirFeedbackCurrent |
UINT |
Hardware specific |
ADC current value from FB input or high side current measure. |
i_FBType |
ADData |
G_AIType struct |
Type of current feedback inputs. |
i_PWMType |
ADData |
G_AIType struct |
Type of PWM output. |
i_CommonCurrentMeasure |
BOOL |
FALSE/TRUE |
Defines if there is separate current measuring for both pwm outputs or not. When true, i_PosDirFeedbackCurrent input is used as common measure for both directions. |
i_PosDirMaxCurrent |
UINT |
1..2500 mA |
Maximum current for valve that is controlled with positive control signal |
i_PosDirMinCurrent |
UINT |
1..2500 mA |
Minimum current for valve that is controlled with positive control signal |
i_NegDirMinCurrent |
UINT |
1..2500 mA |
Minimum current for valve that is controlled with negative control signal |
i_NegDirMaxCurrent |
UINT |
1..2500 mA |
Maximum current for valve that is controlled with negative control signal. |
i_RampType |
BYTE |
0..G_RampTypeMax |
Defines which one of the available ramp functions is used. |
i_PosDirAscendRamp |
UINT |
Depends on selected ramp type |
Ascending speed for valve that is controlled with positive control signal, range and unit depends on selected ramp type. |
i_PosDirDescendRamp |
UINT |
Depends on selected ramp type |
Descending speed for valve that is controlled with positive control signal, range and unit depends on selected ramp type. |
i_NegDirAscendRamp |
UINT |
Depends on selected ramp type |
Ascending speed for valve that is controlled with negative control signal, range and unit depends on selected ramp type. |
i_NegDirDescendRamp |
UINT |
Depends on selected ramp type |
Descending speed for valve that is controlled with negative control signal, range and unit depends on selected ramp type. |
i_PosDirAttenuationOn |
BOOL |
FALSE/TRUE |
If input is true, controlling of positive direction valve is limited to given percentage of max control. |
i_NegDirAttenuationOn |
BOOL |
FALSE/TRUE |
If input is true, controlling of negative direction valve is limited to given percentage of max control. |
i_PosDirAttenuationAmount |
BYTE |
0..100% |
Amount of attenuation for positive direction valve. |
i_NegDirAttenuationAmount |
BYTE |
0..100% |
Amount of attenuation for negative direction valve. |
i_EnableCounterControl |
BOOL |
FALSE/TRUE |
Both valves can be controlled at the same time. |
i_SupplyVoltage |
UINT |
Hardware specific |
Measured supply voltage with two decimals, 2400 = 24,00V |
i_Fast |
BOOL |
FALSE/TRUE |
Use fast PI curve pre-scaled parameters by default. Pre-scaled P and I are used if both given i_P_Gain and i_I_Gain is zero. |
i_P_Gain |
UINT |
0..65535 |
Proportional gain of PI controller, 1000 = 1 |
i_I_Gain |
UINT |
0..65535 |
Integration gain of PI controller, 1000 = 1 |
i_CoilResistance |
UINT |
3..200 Ohm |
Coil nominal resistance value in Ohms. |
i_CircuitErrorDelay |
UINT |
0..65535 ms |
Delay before error outputs are activated in ms. |
i_CircuitErrorDisablesOutput |
BOOL |
FALSE/TRUE |
Defines if PWM output is disabled in short circuit or broken circuit error situations |
Output variable name |
Data type |
Range |
Description |
o_PosDirPWMOutput |
UINT |
HW specific |
PWM control for valve that is controlled with positive control signal. |
o_PosDirValveSupply |
BOOL |
FALSE/TRUE |
Control condition for valve supply volt output. |
o_NegDirPWMOutput |
UINT |
HW specific |
PWM control for valve that is controlled with negative control signal. |
o_NegDirValveSupply |
BOOL |
FALSE/TRUE |
Control condition for valve supply volt output. |
o_ParameterError |
BOOL |
FALSE/TRUE |
True when incorrect parameter value in any of the FB’s input. |
o_PosDirShortCircuit |
BOOL |
FALSE/TRUE |
Short circuit in positive direction valve’s circuit. |
o_NegDirShortCircuit |
BOOL |
FALSE/TRUE |
Short circuit in negative direction valve’s circuit. |
o_PosDirBrokenCircuit |
BOOL |
FALSE/TRUE |
Positive direction valve’s circuit is broken. |
o_NegDirBrokenCircuit |
BOOL |
FALSE/TRUE |
Negative direction valve’s circuit is broken. |
o_PosDirCurrentWithoutControl |
BOOL |
FALSE/TRUE |
There is measured current without control in positive direction circuit. |
o_NegDirCurrentWithoutControl |
BOOL |
FALSE/TRUE |
There is measured current without control in negative direction circuit. |
Output variable name |
Data type |
Range |
Description |
o_PosDirPWMOutput |
UINT |
HW specific |
PWM control for valve that is controlled with positive control signal. |
o_PosDirValveSupply |
BOOL |
FALSE/TRUE |
Control condition for valve supply volt output. |
o_NegDirPWMOutput |
UINT |
HW specific |
PWM control for valve that is controlled with negative control signal. |
o_NegDirValveSupply |
BOOL |
FALSE/TRUE |
Control condition for valve supply volt output. |
o_ParameterError |
BOOL |
FALSE/TRUE |
True when incorrect parameter value in any of the FB’s input. |
o_PosDirShortCircuit |
BOOL |
FALSE/TRUE |
Short circuit in positive direction valve’s circuit. |
o_NegDirShortCircuit |
BOOL |
FALSE/TRUE |
Short circuit in negative direction valve’s circuit. |
o_PosDirBrokenCircuit |
BOOL |
FALSE/TRUE |
Positive direction valve’s circuit is broken. |
o_NegDirBrokenCircuit |
BOOL |
FALSE/TRUE |
Negative direction valve’s circuit is broken. |
o_PosDirCurrentWithoutControl |
BOOL |
FALSE/TRUE |
There is measured current without control in positive direction circuit. |
o_NegDirCurrentWithoutControl |
BOOL |
FALSE/TRUE |
There is measured current without control in negative direction circuit. |
o_IllegalControlRequestInStartup |
BOOL |
FALSE/TRUE |
True if unexpected control request occurs. i_Control is not 0 when i_Enable is set to true. |
Source file Topic000468.htm
Last updated 21-Feb-2025