PID Functions by JS Automation

JS_DeadTime - analog delay

by JS Automation

call:

INPUT : signal input
N : number of samples (200 max)
DeadTime : delay (seconds)

return:

OUT : output signal

notes:

Allows to put a delay on an analog signal
Warning: The dead time divided by the number of samples must be very greater than cycle time.
If N = 0 the function understands 1
If N > 200 the function understands 200

JS_LeadLag - signal lead / lag

by JS Automation

call:

Input : input signal
Lead : lead value
Lag : lag value
Ts : sampling period

return:

Out : output signal

function:

Qn = Qn-1 + Ts/Ti.(Mn-1 - Qn-1) + Td/Ti.(Mn - Mn-1)

Qn : Output at t
Qn-1 : Output at t-1
Mn : Input at t
Mn-1 : Input at t-1
Ts : Sampling period
Ti : Lag
Td : Lead

notes:

If Lag = 0 the function is not executed
Sampling period must be very greater than cycle time

JS_PID - PID loop setpoint balance

by JS Automation

call:

LSL : Loop Scale Lo
LSH : Loop Scale Hi
Auto : automatic or manual mode
Pv : Process output value
Sp : Set point value
Ramp : Setpoint Ramp ( Unit per Minute )
Balance : Auto/Manu Setpoint balancing
Action : Output action Direct or Reverse
Mixt : Interactive or Non-Interactive PID
Deriv : Derivative action
Feedback : external PID feedback for output manipulations
X0 : Adjustment value: In manual mode, output pid regulator equal to X0
You must connect obligatory a variable (not a constant and no computation on this variable
Kp : Proportionality constant
Ti : Integral time constant in minute
Td : derivative time constant in minute
Ts : Sampling period
Xmin : Minimum limit on output command value
Xmax : Maximum limit on output command value

return:

SPcur : Current Setpoint
Xout : Command

notes:

Automatic mode must be set to false at init.
Balance = 0 Non-balancing Setpoint ; =1 Balancing
Xout is limited inside specified Xmin ,Xmax range.
Xmax should be greater than Xmin.
The integral term is held when Xout reaches the limits
The Ts parameter should be greater (>>>) than the kernel cycle time.
Action :
- Direct (0) Output increase if PV-SP positive and decrease if PV-SP negative
- Reverse (1) Output decrease if PV-SP positive and increase if PV-SP negative
Mixt :
- Interactive PID (0) : The I and D parameters are multipied by KP
- Non-Interactive (1) : The P,I,D parameters are independant
Feedback :
- The range must be 0-100
- Feeback=0 : internal feedback

JS_Ramp - Limit variation speed

by JS Automation

call:

- INPUT : input signal
- Rampe : maximum variation speed ( Unit/mn)
- Cycle : application cycle time

return:

OUT : output signal

notes:

- The variation of speed is expressed as units per minute
- The Cycle input must be the application cycle time
  Use GetSysInfo (_SYSINFO_CYCLETIME_MS)