Supported platforms: CODESYS 2.3, CODESYS 3.5

 

PVC_SingleCurrentValveController (FB)

Description

PVC_SingleCurrentValveController function block controls a current controlled proportional valve in products that do not have a controller built in at firmware, such as Epec 3000 series.

 

The function block calls PVC_SingleCurrentValve 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 output is disabled until i_Control is set to zero (this function can, however, be disabled with parameter).  

 

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.

Limitations

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.

 

Inputs

CODESYS 2.3CODESYS 2.3

Input variable name

Data type

Range

Description

i_Enable

BOOL

FALSE/TRUE

Enables controlling of the o_CurrentRequest output.

i_Control

INT

0..32767

Control signal from e.g. pedal.

i_FeedbackCurrent

UINT

Hardware specific

ADC current value from FB input or high side current measure.

i_FBType

BYTE

0.. G_ADScaleArrMax

Type of current feedback input

i_MaxCurrent

UINT

1..2500 mA

Maximum current for valve.

i_MinCurrent

UINT

1..2500 mA

Minimum current for valve.

i_RampType

BYTE

0..G_RampTypeMax

Defines which one of the available ramp functions is used.

i_AscendRamp

UINT

Ramp specific

Ascending speed for valve, range and unit depends on selected ramp type.

i_DescendRamp

UINT

Ramp specific

 

Descending speed for valve, range and unit depends on selected ramp type.

i_AttenuationOn

BOOL

FALSE/TRUE

If input is true, controlling is limited to given percentage of max control.

i_AttenuationAmount

BYTE

0..100%

Amount of attenuation.

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 either of given (i_P_Gain or 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 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.

 

 

CODESYS 3.5CODESYS 3.5

Input variable name

Data type

Range

Description

i_Enable

BOOL

FALSE/TRUE

Enables controlling of the o_CurrentRequest output.

i_Control

INT

0..32767

Control signal from e.g. pedal.

i_FeedbackCurrent

UINT

Hardware specific

ADC current value from FB input or high side current measure.

i_FBType

ADData

G_AIType struct

Type of current feedback input.

i_PWMType

ADData

G_AIType struct

Type of PWM output.

i_MaxCurrent

UINT

1..2500 mA

Maximum current for valve.

i_MinCurrent

UINT

1..2500 mA

Minimum current for valve.

i_RampType

BYTE

0..G_RampTypeMax

Defines which one of the available ramp functions is used.

i_AscendRamp

UINT

Ramp specific

Ascending speed for valve, range and unit depends on selected ramp type.

i_DescendRamp

UINT

Ramp specific

 

Descending speed for valve, range and unit depends on selected ramp type.

i_AttenuationOn

BOOL

FALSE/TRUE

If input is true, controlling is limited to given percentage of max control.

i_AttenuationAmount

BYTE

0..100%

Amount of attenuation.

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 either of given (i_P_Gain or 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 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.

 

Outputs

CODESYS 2.3CODESYS 2.3

 

Output variable name

Data type

Range

Description

o_PWMOutput

UINT

Hardware specific

PWM control for valve.

o_ValveSupply

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_ShortCircuit

BOOL

FALSE/TRUE

Short circuit in valve’s circuit

o_BrokenCircuit

BOOL

FALSE/TRUE

Valve’s circuit is broken

o_CurrentWithoutControl

BOOL

FALSE/TRUE

There is current without control

 

CODESYS 3.5CODESYS 3.5

 

Output variable name

Data type

Range

Description

o_PWMOutput

UINT

Hardware specific

PWM control for valve.

o_ValveSupply

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_ShortCircuit

BOOL

FALSE/TRUE

Short circuit in valve’s circuit

o_BrokenCircuit

BOOL

FALSE/TRUE

Valve’s circuit is broken

o_CurrentWithoutControl

BOOL

FALSE/TRUE

There is current without control

o_IllegalControlRequestInStartup

BOOL

FALSE/TRUE

True if unexpected control request occurs. i_Control is not 0 when i_Enable is set to true.

 

Example code

 

See also

 

Source file Topic000469.htm

Last updated 13-Jun-2024