Supported platforms: CODESYS 2.3, CODESYS 3.5
This function calculates P and I values from given coil resistance, if both given P and I values are 0.
Fast:
o_P_Gain = i_CoilResistance * G_PVC_FAST_P_GAIN_SLOPE + G_PVC_FAST_P_GAIN_ZERO
Value is limited to G_PVC_FAST_P_HIGH_LIMIT.
o_I_Gain = i_CoilResistance * G_ PVC_FAST_I_GAIN_SLOPE + G_PVC_FAST_I_GAIN_ZERO
Slow:
o_P_Gain = i_CoilResistance * G_ PVC_SLOW_P_GAIN_SLOPE + G_PVC_SLOW_P_GAIN_ZERO
Value is limited to G_PVC_SLOW_P_HIGH_LIMIT.
o_I_Gain = i_CoilResistance * G_ PVC_SLOW_I_GAIN_SLOPE + G_PVC_SLOW_I_GAIN_ZERO
With values of Global variables, P and I gain curves look like these:


  | 
		The purpose of this function is to provide basic P and I values for the controller. The user can override them by giving P and I values to inputs.  | 
	
  | 
		This function block is primarily intended for ProportionalValveControl library's internal use.  | 
	
Input variable name  | 
		Data type  | 
		Range  | 
		Description  | 
	
i_Enable  | 
		BOOL  | 
		TRUE/FALSE  | 
		Enable setting of output parameters.  | 
	
i_Fast  | 
		BOOL  | 
		TRUE/FALSE  | 
		Select faster set of pre-scaled values.  | 
	
i_P_Gain  | 
		UINT  | 
		0..65535  | 
		Proportional gain value. If set to 0, both outputs are set from pre-scaled value table.  | 
	
i_I_Gain  | 
		UINT  | 
		0..65535  | 
		Integration gain value. If set to 0, both outputs are set from pre-scaled value table.  | 
	
i_CoilResistance  | 
		UINT  | 
		3..200 Ohm  | 
		Coil resistance.  | 
	
Output variable name  | 
		Data type  | 
		Range  | 
		Description  | 
	
o_P_Gain  | 
		UINT  | 
		0..65535  | 
		Output proportional gain value.  | 
	
o_I_Gain  | 
		UINT  | 
		0..65535  | 
		Output integration gain value.  | 
	
Source file Topic000470.htm
Last updated 4-Sep-2025