PWM Function (MICRO - PREMIUM ) on PL7 software

PWM Function


The PWM function supports regulation of a pulse width on a TOR output.
It is a function that formats the PID’s output.
The pulse width depends on the PID’s output (The PWM function’s INP input)
and the modulation period.
 The PID operation have been described in a previous post
The circuit diagram of the function’s operation is as follows:


To each TOP of the T_MOD modulation period, the activation period
in 10-3 second of the PW_O output is calculated according to the following formula:
State 1 of the gap (shown in 10-2 seconds) = INP * T_MOD / 1000

The following timing diagram illustrates this formula:


Practical rules
T_MOD = TS (where TS is the sampling period of the upstream PID),
The period of the current task (expressed in 10-3 second) is equal to:
(Required resolution)* 10 * T_MOD.
The PID is in the MAST task, the MAST’s period is 50*10-3 s,
TS = 500*10-2 s and the required resolution is 1/50
(a T_MOD period must contain at least 50 periods of the current task).

T_MOD = TS = 500.

The period of the task where the PWM is introduced must therefore be less
than 500 * 10 /50 =100 10-3 s.

The PWM function can therefore be programmed in the MAST task.
the resolution will be 1/100.

The PWM function is a standard PL7 function. As such, it is available from the
functions library.
From the language editors there, it is possible to use the help of a PWM
function’s input to facilitate its programming.

From the PL7 menu Tools --> Library the next picture appears

The illustration gives you a general idea of the Functions screen in the library
supporting the implementation of the PWM function.


The PWM function’s call syntax is:
PWM(INP,PW_0,PARA)  Equation 1

For the Purpose of the example a Micro CPU TSX3722 used
with a TSXDSZ08T2 card  (8 Transistor Outs) in order to have
the digital output for the PWM output.
The selection of a Transistor Output was done because of the long life time of the transistor.
Of course the developer has to use additional relays for the output
The following picture illustrate the configuration of the PLC



The PID operate function which explained in a previous post is


Next the Allingment of the T_MOD (PWM) on the TS of the PID 
 which is the %MW105




 And Finally in the Mast Or Fast task the PWM Operate Function in which the PWM output is the %Q3.0


Using the equation 1
PWM(INP,PW_0,PARA)
INP = %MW52
PW_0 = :%Q3.0
PARA = %MW90:5
The following Illustration all the parameters explained 



 NOTE FOR THE READER : THE ABOVE IS THE CONFIGURATION ONLY AND TYPICAL EXAMPLES ON HOW TO CONGIGURE THE PWM FUNCTION IN PL7 SOFTWARE. THE INFORMATION GIVEN ARE NOT A COMPLETE APPLICATION AND THE DEVELOPER MUST MAKE HIS OWN CALCULATIONS TO ACHIEVE PWM CONTROL IN HIS SPECIFIC APPLICATION. IT'S THE RESPONSIBILITY OF THE USER TO USE THE INFORMATION ABOVE CORRECTLY IN THE APPLICATION. IMPROPER USE MAY RESULT IN EQUIPMENT DAMAGE OR HUMAN INJURIES

PID Software function (MICRO - PREMIUM) on PL7

PID Function

The PID function completes a PID correction via an analog measurement and
setpoint on the [0-10000] format and provides an analog command to the
same format.

Available PID functions

serial / parallel PID algorithm,
forward / backward action (according to the KP gain sign),
action derived from measurement or from distance,
high and low limitation of the setpoint to [0-10000],
high and low limitation of the output in automatic mode,
anti-saturation of the integral action,
Manual/Automatic operating modes without definitely changing,
PID access control through the dialog operator,
operating in integrator for (KP = TD =0).

Here is the operating principle diagram of the PID function



PID functions are standard PL7 functions. They are therefore available from the function library.
From the PL7 menu Tools --> Library the next picture appears




The call syntax for the PID function is:

PID(TAG,UNIT,PV,OUT,AUTO,PARA) -  Equation 1

Note: A PID function can be entered in any periodic task (MAST or FAST). 

Call of PID function . We are Opening in a PL7v4.5 Project (Micro or Premium) a Fast periodic Task section and insert an operate instruction. Right click inside the operate function to call for a function.
See the following picture



The following illustration appears:




Then fullfill with parameters the PID call in grey zone . See the following picture



The following picture is the PID function fullfilled . Next we are going to analyze the parameters entered



As we can see the parameters are 6 and is the equation 1 . So.

PID(TAG,UNIT,PV,OUT,AUTO,PARA)
TAG = %MB0:8      Used by CCX17 . not neccessary
UNIT = %MB10:8   Used by CCX17 . not neccessary
PV = %MW50         Process value of the function
OUT = %MW52      Analog PID output
AUTO = %M40       Operating Mode
PARA = %MW100:43  PID Parameters

Detailed Description of Parameters



As we could see from the 2nd table above the PID parameters like internal SP=Setpoint, Kp,Ti,Td,Ts
are in the range of %MW100:43.
So for SP = %MW100 and so on in which the developer should setup a value

On cold start, the PID resumes in manual, with the output at 0.
To impose automatic mode or a manual input not at zero after a cold start,
you must program the initialization sequence after the PID call.
 
Where the process control Human Machine Interface is used
(DEVAL_MMI = 0)
Where no Human Machine Interface is used DEVAL_MMI = 1.

Examples. In this example, the TAG and UNIT parameters are not applicable,
so you can simply enter the values.

(* PID correction on temperature process control loop *)
PID(‘TEMP’,’DEGRES’,%MW10,%MW1>>  OPERATE FUNCTION
with PID(‘TEMP’,’DEGRES’,%MW10,%MW11,%M10,%MW20:43)

(* PID correction on process control loop without built-in HMI
PID(‘ ’,’ ’,%MW10,%MW1>>   OPERATE FUNCTION
with PID(‘ ’,’ ’,%IW3.1,%QW4.0,%M10,%MW20:43)

 
NOTE FOR THE READER : THE ABOVE IS THE CONFIGURATION ONLY AND TYPICAL EXAMPLES ON HOW TO CONGIGURE THE PID FUNCTION IN PL7 SOFTWARE. THE INFORMATION GIVEN ARE NOT A COMPLETE APPLICATION AND THE DEVELOPER MUST MAKE HIS OWN CALCULATIONS TO ACHIEVE PID CONTROL IN HIS SPECIFIC APPLICATION. IT'S THE RESPONSIBILITY OF THE USER TO USE THE INFORMATION ABOVE CORRECT IN HIS APPLICATION. IMPROPER USE MAY RESULT IN EQUIPMENT DAMAGE OR HUMAN INJURIES