March 2017 - TricksMenu

Post Top Ad

Thursday, 16 March 2017

Zeigler-Nichols Rule explained with example

09:25 0

Ziegler-Nichols root locus

When to use the Zeigler-Nichols

Tuning rules work well when the controller required is analog, system is linear, monotonic and a response that is dominated by a single-pole exponential “lag”.
Actual plants are unlikely to have a perfect first-order lag characteristic. Higher-order poles will introduce an extra phase shift, phase shift matters a lot to loop stability. You can’t depend upon the single “lag” pole to match both the amplitude roll-off and phase shift accurately.
So the ZN model presumes an additional fictional phase adjustment that does not distort the assumed magnitude roll-off. At the stability margin there is a 180 degree phase shift around the feedback loop which is the Nyquist’s stability criteria. A first order lag can contribute no more than 90 degrees of that phase shift.
To summarize, then, the Ziegler-Nichols rule assumes that the system has a transfer function of the following form:
= (Ke^-sT)/ (a+s)
The model matches the system response at frequencies 0 and at the stability limit.

How do you measure response parameters?

Given the magnitude and phase open-loop response curves of the plant, you can fit the assumed model in the following manner.
  1. The ratio of output level to input level at low frequencies determines the gain parameter K of the model.
  2. Observe the frequency F0 at which the phase passes through -pi radians (-180 degrees). The inverse of this frequency is the period of the oscillation, T0.
  3. Observe the plant gain Kc that occurs at the critical oscillation frequency Fu. The inverse of this is the gain marginK0.

Example:

The given transfer function is:
Gp = 1/s(s+11.6+5.8i)(s+11.6-5.8i)

Zeigler-Nichols Compensation

MATLAB CODE

num=1;
den=conv([1 0],conv([1 11.6+5.8i],[1 11.6-5.8i]));
figure
rlocus(num,den) %frequency response of the system
T0=(2*pi)/13;  % Measuring the period T0 at the stability limit
Kp0=3900;      % Measuring the gain margin Kp0 for loop stability
Ti=0.5*T0;     % Calculating the tuning parameters
Td=0.125*T0;  
kp=0.6*Kp0;
ki=kp/Ti;
kd=kp*Td;
numgc=kp*[Td*Ti Ti 1]; %Numerator of PID transfer function 
dengc=[Ti 0];          %denominator of PID transfer function
gc=tf(numgc,dengc);    % PID controller’s transfer function
gp=tf(num,den);
gf=gc*gp;
t=gf/(1+gf);           %Closed loop transfer  function
figure
step(t)
 Root Locus

Read More

PLC Applications: Primary Resistance Starter for AC Motor

09:23 0
PLC applications: Program for primary resistor starter

Induction motors are widely used in industry. They have lots of advantages however they inherit a problem of high starting current. As compared to full load current, the starting current is 6 to 10 times higher. This high inrush of current can damage the motor windings and other parts. High inrush current can also affect the source. Therefore it is required to limit the high starting current in induction motor. There are lots of methods for smooth starting of induction motors. Each one has its own advantages and disadvantages. Some of them are
In this article we will discuss the primary resistance starter with detail and also learn how to implement it in PLC. Motor starters are among of the basic PLC applications.

Operating principle of primary resistance motor starter

Primary resistance starting method is based on the reduced starting voltage concept. This method introduces the resistance in series with the stator windings of squirrel cage induction motor. Voltage drop occurs in the added resistors during starting which provides reduced voltage across the stator windings. With the reduced voltage, the starting current is lower than it would be if the motor is started on full line voltage. After a preset delay, the resistance unit is shunted out of the circuit and the motor continues to run on line voltage.

Primary resistance starter arrangement

Above figure shows the primary resistor starter arrangement.  It consists of a main contactor and a second contactor labelled as S2. Resistors are connected with each phase of stator winding in series to reduce voltage. The value of these starting resistors can be determined by the method explained in the article
primary resistance starter arrangment
By pass switches are connected in parallel to with the starting resistors which are controlled by S2 contactor.

Working

The motor is started by closing the main contactor. This supplies power to the motor through series starting resistance. The contactor S2 is open thus the current has to pass through the resistors resulting in voltage drop. Due to voltage drop in these resistors, the motor gets reduced voltage.
primary resistance motor starter at starting time
A timer is installed with a preset time delay. When the delay is over, the contactor S2 is closed closing the parallel switches.
primary resistance starting when motor gained speed
As it can be seen in the above figure that closing the S2 bypass all the resistors. As a result full line voltage is applied to the motor windings.

PLC Applications: PLC program for primary resistance starter

Following figure shows the PLC program for Primary resistance motor starter

Induction motors are widely used in industry. They have lots of advantages however they inherit a problem of high starting current. As compared to full load current, the starting current is 6 to 10 times higher. This high inrush of current can damage the motor windings and other parts. High inrush current can also affect the source. Therefore it is required to limit the high starting current in induction motor. There are lots of methods for smooth starting of induction motors. Each one has its own advantages and disadvantages. Some of them are
In this article we will discuss the primary resistance starter with detail and also learn how to implement it in PLC. Motor starters are among of the basic PLC applications.

Operating principle of primary resistance motor starter

Primary resistance starting method is based on the reduced starting voltage concept. This method introduces the resistance in series with the stator windings of squirrel cage induction motor. Voltage drop occurs in the added resistors during starting which provides reduced voltage across the stator windings. With the reduced voltage, the starting current is lower than it would be if the motor is started on full line voltage. After a preset delay, the resistance unit is shunted out of the circuit and the motor continues to run on line voltage.

Primary resistance starter arrangement

Above figure shows the primary resistor starter arrangement.  It consists of a main contactor and a second contactor labelled as S2. Resistors are connected with each phase of stator winding in series to reduce voltage. The value of these starting resistors can be determined by the method explained in the article
primary resistance starter arrangment
By pass switches are connected in parallel to with the starting resistors which are controlled by S2 contactor.

Working

The motor is started by closing the main contactor. This supplies power to the motor through series starting resistance. The contactor S2 is open thus the current has to pass through the resistors resulting in voltage drop. Due to voltage drop in these resistors, the motor gets reduced voltage.
primary resistance motor starter at starting time
A timer is installed with a preset time delay. When the delay is over, the contactor S2 is closed closing the parallel switches.
primary resistance starting when motor gained speed
As it can be seen in the above figure that closing the S2 bypass all the resistors. As a result full line voltage is applied to the motor windings.

PLC Applications: PLC program for primary resistance starter

Following figure shows the PLC program for Primary resistance motor starter
Induction motors are widely used in industry. They have lots of advantages however they inherit a problem of high starting current. As compared to full load current, the starting current is 6 to 10 times higher. This high inrush of current can damage the motor windings and other parts. High inrush current can also affect the source. Therefore it is required to limit the high starting current in induction motor. There are lots of methods for smooth starting of induction motors. Each one has its own advantages and disadvantages. Some of them are
In this article we will discuss the primary resistance starter with detail and also learn how to implement it in PLC. Motor starters are among of the basic PLC applications.

Operating principle of primary resistance motor starter

Primary resistance starting method is based on the reduced starting voltage concept. This method introduces the resistance in series with the stator windings of squirrel cage induction motor. Voltage drop occurs in the added resistors during starting which provides reduced voltage across the stator windings. With the reduced voltage, the starting current is lower than it would be if the motor is started on full line voltage. After a preset delay, the resistance unit is shunted out of the circuit and the motor continues to run on line voltage.

Primary resistance starter arrangement

Above figure shows the primary resistor starter arrangement.  It consists of a main contactor and a second contactor labelled as S2. Resistors are connected with each phase of stator winding in series to reduce voltage. The value of these starting resistors can be determined by the method explained in the article
primary resistance starter arrangment
By pass switches are connected in parallel to with the starting resistors which are controlled by S2 contactor.

Working

The motor is started by closing the main contactor. This supplies power to the motor through series starting resistance. The contactor S2 is open thus the current has to pass through the resistors resulting in voltage drop. Due to voltage drop in these resistors, the motor gets reduced voltage.
primary resistance motor starter at starting time
A timer is installed with a preset time delay. When the delay is over, the contactor S2 is closed closing the parallel switches.
primary resistance starting when motor gained speed
As it can be seen in the above figure that closing the S2 bypass all the resistors. As a result full line voltage is applied to the motor windings.

PLC Applications: PLC program for primary resistance starter

Following figure shows the PLC program for Primary resistance motor starter
Read More

+15V & -15V Regulated Dual Polarity Power Supply Circuit

09:20 0

Introduction

Power supplies are important part of electronic circuits. Many electronic circuits and components require negative voltage in addition to positive voltage. An example can be operational amplifiers. They require +15 and -15 for biasing. Similarly other components also require negative voltage. Providing negative voltage is always been a challenge. If a circuit requires both positive and negative voltage than providing two power supplies for a single circuit increases cost and size of electronic circuit. Due to this reason lots of useful circuits and components are regarded as impractical because of dual polarity voltage requirement. The solution to this problem is given in this article by presenting a regulated dual polarity power supply circuit. The design uses single power supply circuit to supply voltage of dual polarity. Its negative voltage power supply as well as positive voltage power supply in one circuit.
It must be noted that this article is about dual polarity power supply. Same configuration can be used to build dual voltage power supply which is explained in this article Dual voltage power supply 

Components and ratings of dual regulated power supply

Following components are required for dual polarity power supply.
  • SPST Switch
  • Fuse 1A
  • 4 Diodes 1N4007
  • Transformer 220/25V
  • Capacitors 2200uF, 0.33uF and 0.1uF (2 each)
  • Voltage regulator IC LM7815 & LM7915
  • Veropins (Optional)
1A fuse is used to provide protection against high current currents. The rating of fuse depends upon the rating of other electronic components. A center tap transformer capable of reducing 220V to 25V is need in dual polarity power supply. Diodes are used to construct bridge rectifier. Since voltage is step down to 25V, PIV (peak inverse rating) of each diode is 50V since double voltage appears across each diode in rectification process.

Circuit diagram: Positive & Negative voltage power supply circuit 

Following figure shows circuit diagram for dual regulated power supply.
connection diagram for dual polarity power supply circuit
Transformer steps down 220V 50Hz voltage to 25V and gives it to the bridge configuration for rectification.  Bridge circuit converts AC to pulsating DC. In order acquire smooth constant DC voltage, smoothing capacitor of 2200 uF is installed next to the bridge. Till this point a 25V DC unregulated voltage is achieved. To get regulated 15V supply, voltage regulator IC 7815 is used. In order to understand more about LM7815 click here.
On both sides of voltage regulator IC, bypass capacitors (0.33uF and 0.1uF) are connected to provide optimum stability and helps in correct transient response. The values of bypass capacitors are provided in voltage regulator datasheet. The output of LM7815 gives regulat
ed 15V. For negative voltage, the same configuration as for positive voltage is connected with back end of diode bridge configuration. So LM7915 along with its parallel capacitors captures negative cycle of AC supply and converts into negative DC voltage.
Voltage regulator IC can also be used to make constant current source which is explained in this articleConstant current source using LM317

Simulation of Dual polarity power supply

Above explained circuit is simulated in proteus ISIS and the result is shown
simulation Positive and negative voltage power supply
simulation of dual regulated power supply
It can be seen that one side porivdes +15V and second terminal provides -15V.

Simulation Video




Read More

Capacitance meter: How to measure capacitance with microcontroller

09:19 0
Consider a simple charging circuit of a capacitor. It consists of a capacitor and resistor connected in series with a DC battery through a switch. When the switch is closed, the charges begin to accumulate on the plates of the capacitor.
Capacitor charging circuit
The charging of capacitor follows the following equation
V_c=\ V_o\ (1-e^{-\left(\frac{t}{RC}\right)}\ )
Where  V0 = Applied Voltage
                Vc = Voltage of capacitor
                T = time of charging
                R= resistance value
                C = Capacitance of capacitor
The charging plot of capacitor is shown in the following figure
capacitor charging plot
The principle of measuring capacitor in this article is based on the capacitor charging equation. If a capacitor is inserted in a charging circuit having input voltage and series resistance value is already known. By applying the input voltage for a fixed amount of time, certain charge will be stored. By the measuring the voltage of the capacitor, the capacitance can be determined by putting all the known quantities in the capacitor charging equation.
So last equation is used to find the capacitance of capacitor. 
\gg \ \ V_c=\ V_o\ (1-e^{-\left(\frac{t}{RC}\right)}\ )
\gg \ \ \left(1-e^{-\left(\frac{t}{RC}\right)}\ \right)=\ \frac{V_c}{V_o}
\gg \ \left(e^{-\left(\frac{t}{RC}\right)}\ \right)=\left(1-\ \frac{V_c}{V_o}\ \right)
\gg \ \frac{t}{\ RC}={ln \left(1-\ \frac{V_c}{V_o}\ \right)\ }let\ X={ln \left(1-\ \frac{V_c}{V_o}\ \right)\ }
\gg \ \ C=\ \frac{t}{RX}
So last equation is used to find the capacitance of capacitor.

Schematic

Following components are required to construct a capacitance meter
  • Two switches (relays or can be any )
  • Resistors
  • Push buttons
  • Relay driver ULN2003A
  • Microcontroller (PIC 18F452)
  • Power Source 5V & 12V
  • LCD
The above components are connected as shown in the following diagram
Capacitance meter schematic diagram
Push button is connected to Pin RB0 while capacitor voltage is measured using analogue pin RA0. LCD is interfaced with Port C and switches for charging capacitor are controlled through port D. The sequence of events is as follows
  • Push button needs be pressed to measure capacitance.
  • When push button is pressed, charging switch is closed.
  • Capacitor is connected to ground for 1 sec to discharge any charge stored on it.
  • After 1 sec, power switch is closed for 5ms to store charge on capacitor.
  • After 5ms, charge switch is opened to disconnect capacitor from battery.
  • Power switch is also opened to save battery from discharging.
  • Voltage due to stored charge on capacitor is measured by controller.
  • The known values t=5ms, Vo = 5V, R = 50kΩ, and measured capacitor voltage (Vc) are used to determine capacitance using charging equation.
  • Measured value is displayed on LCD.
All the above steps are performed by microcontroller after button is pressed by the user.

Simulation Results

The capacitance meter is tested in ISIS Proteus environment for different values of capciatance and the results are displayed.
For 50nF capacitor
capacitance meter result 1
The meter shows 47nF which is fairly correct value.
Now for 500nF capacitance value
capacitance meter result 2
The capacitance meter shows 499nF values which is very much near to the actual 500nF value.

Code

The code for microcontroller is written in C language and compiled in MIKRO C compiler.
#define charge PORTD.F1.//assigning names to pins
#define button PORTB.F0
#define power PORTD.F0
float voltage;// initializing variable for capacitor calculation
float voltagecap;
sbit LCD_RS at Rc3_bit;
sbit LCD_EN at Rc2_bit;
sbit LCD_D4 at Rc4_bit;
sbit LCD_D5 at Rc5_bit;
sbit LCD_D6 at Rc6_bit;
sbit LCD_D7 at Rc7_bit;
sbit LCD_RS_Direction at TRISc4_bit;
sbit LCD_EN_Direction at TRISc5_bit;
sbit LCD_D4_Direction at TRISc0_bit;
sbit LCD_D5_Direction at TRISc1_bit;
sbit LCD_D6_Direction at TRISc2_bit;
sbit LCD_D7_Direction at TRISc3_bit;
void main() {
char z[14];// char to store measured value
float a,b,c,d;// arbitrary variables for calculation of capacitance
TRISC=0;// making port C as an output port
TRISD=0;// making port D as an output port
TRISB=0XFF;// making port B as in input port
TRISA=0XFF;// making port A as in input port
ADC_Init();// Initialize ADC module with default settings
Lcd_Init();// Initialize Lcd
Lcd_Cmd(_LCD_CLEAR);// Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);// Cursor off
Lcd_Out(1,1,”Welcome to”);// dsiaplay the welcome logo on the LCD screen at position ROW=1 COLUMN=1
Lcd_Out(2,1,”help2educate”);
delay_ms(1000);// keep displaying logo for 1s
while (1){
if(button==1)
{
charge =1;// close charging switch to discharge capacitor fully before measuring
delay_ms(1000);// discharge for 1sec
power=1;// close power switch to connect battery to capacitor for charging
delay_ms(5);// charge capacitor for 5ms
charge=0;// open charge switch to isolate capacitor from battery and ground
power =0;//  open power switch to prevent battery from discharging
voltage = ADC_Read(0);// reading analogue value from channel 0. 0 stands for channel number
delay_ms(1);
voltagecap=(voltage*4.88)/1000;// convert digital value into analogue
a=voltagecap/5;// first step of charging equation Vc/Vo
b=1-a;// 1-Vc/Vo
c = log(b);// ln (1-Vc/Vo) = X
d=-100/c;// t/RX & converting to nF
floattostr(d,z);// convert to char for display
}
else
{floattostr(d,z);}// if button not pressed
lcd_cmd(_lcd_clear);
Lcd_Cmd(_LCD_CURSOR_OFF);
lcd_out(1,1,z);
lcd_out(1,15,”nF”);
delay_ms(100);
}}
Read More

Post Top Ad