0% found this document useful (0 votes)
8 views

LAB4

The document outlines the procedures and code for conducting a Nyquist lab experiment focused on pipe flow control systems. It details the use of a PIC microcontroller to generate a sinusoidal signal for testing, as well as the methods for analyzing the resulting GH plot and estimating system parameters. Additionally, it includes a mathematical model of the pipe flow setup and instructions for plotting the open loop response.

Uploaded by

Aki Umicho
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

LAB4

The document outlines the procedures and code for conducting a Nyquist lab experiment focused on pipe flow control systems. It details the use of a PIC microcontroller to generate a sinusoidal signal for testing, as well as the methods for analyzing the resulting GH plot and estimating system parameters. Additionally, it includes a mathematical model of the pipe flow setup and instructions for plotting the open loop response.

Uploaded by

Aki Umicho
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

AUTOMATIC CONTROL ENGINEERING

PIPE FLOW NYQUIST LAB

PURPOSE: The main purpose of this lab is to

give you some experience getting the GH or

Nyquist plot of a system from an experiment.

PROCEDURE: The PIC code gh.c operates the pipe

flow setup open loop. Using gh.c, send a

sinusoidal signal into the heater. Display the

heater and sensor signals on an oscilloscope.

From the oscilloscope traces estimate the open

loop magnitude ratio and phase shift for

different heater frequencies. Use these data to

construct a GH Plot. Use the GH Plot to

estimate the borderline KP and TP. Compare

these KP and TP with those obtained in the

Ziegler Nichols gains lab.


/*************************************************

PIPE FLOW SETUP NYQUIST LAB

*************************************************/

/* header files */
#include<16f876.h>
#include<math.h>
#fuses HS,NOWDT,NOPROTECT
#fuses NOBROWNOUT,NOPUT,NOLVP
#use delay(clock=20000000)
#use i2c(master,sda=PIN_C4,scl=PIN_C3,slow)
#org 0x1F00,0x1FFF{}

/* declare variables */
float a,b,p,o;
float t,dt,c;
float wave,s;
int power;

void chip(int data);

/* main code */

void main()
{
c=3.14159;
s=254.0/10.0;
a=6.0*s; b=2.0*s;
p=10.0; o=2*c/p;
dt=0.0129; t=0.0;

delay_ms(7000);

/* control loop */

while(TRUE)
{
t=t+dt;
delay_ms(10);
wave=a+b*sin(o*t);
power=wave;
chip(power);
}
}

void chip(int data)


{
i2c_start();
i2c_write(0x5e);
i2c_write(0);
i2c_write(data);
i2c_stop();
}
NYQUIST LAB DATA SHEET

GAIN = COMMAND = [2Io] =

MR = [2Oo]/[2Io]  = T/T 360

T T 2Oo MR 
PIPE FLOW SETUP

A simple model of the pipe flow setup is

X dR/dt + Y R = Q

Q = KP E E = C – R

R(t) = R(t-T)

Laplace Transformation gives

(X S + Y) R = Q

Q = KP E E = C – R

R = e-TS R

The GH function for the setup is:

KP e[-TS] / (X S + Y)
% PIPE FLOW SETUP
% OPEN LOOP PLOT

X=0.5;Y=0.5;
W=0.05;DW=0.05;
GP=1.0;T=0.25;
NIT=5000;
for K=1:NIT
S=complex(0.0,W);
num=GP*exp(-T*S);
den=X*S+Y;
p(K)=real(num/den);
q(K)=imag(num/den);
W=W+DW;
end
plot(p,q,p,-q);
title('lab gh plot')
xlabel('real')
ylabel('imag')
grid

You might also like