Beruflich Dokumente
Kultur Dokumente
Qi ( s )
KM
U ( s)
( )
Por lo tanto
es igual a
( )
( )
FUNCION DE TRANSFERENCIA DEL SENSOR
V ( s)
KS
H ( s)
=voltaje de salida de la tarjeta de acondicionamiento de seal (v)=5V
( )
( )
)
(
(
Sustituyendo los valores se obtiene
( )
( )
( )
( )
3.5
x 10
2.5
1.5
0.5
Asi mismo para sintonizar las k por el mtodo Ziegler-nichols se tiene en cuenta el siguiente
programa:
h=tf([0.6],[4982.48 408.4 0]);%planta
pp=pole(h);
step(h);
dt=0.05;
t=0:dt:8;
y=step(h,t)'; %respuesta escalon
dy=diff(y)/dt;%primer derivada
[m,p]=max(dy);
d2y=diff(dy)/dt;%segunda derivada
yi=y(p);
ti=t(p);
l=ti-yi/m; %retardo
tao=(y(end)-yi)/m+ti-l;%constante de tiempo
plot(t,y,'b',[0 l l+tao t(end)],[0 0 y(end) y(end)],'k')
%rlocus(h)
grid on
%g=tf([1.164 13.89 54.37 69.58],[1 6.164 22.89 59.37 69.58])
%hlc=feedback(g*h,1);
title('FUNCION DE TRANFERENCIA DE LA PLANTA')
Teniendo as el retardo la constante de tiempo que se emplearan en las siguientes formulas:
TIPO DE CONTROLADOR Kc
Ti
Td
PI
PID
2L
0.5L
L (retardo)= 3.5561
T(constante de tiempo)= 4.4439
(6)
(7)
(8)
(9)
Donde los valores se tienen que expresar en trminos de s para lo cual se muestra
en las ecuaciones 10, y 11.
(10)
(11)
-K-
Derivative
GANANCIA1
-KStep2
PROPORCIONAL
-KGANANCIA2
0.6
13.3s+1
408.4s
F.T BOMBA
F.T TANQUE
1
s
Integrator
Scope2
//variables sensor
#define echoPinA 7 // Echo Pin
#define trigPinA 6 // Trigger Pin
intmaximoRango= 200; // Maximorango
intminimoRango = 0; // Minimo rango
longdurA, disA;
void setup()
{
//initialize the variables we're linked to
//declarando Pines sensor
Serial.begin (9600);
pinMode(trigPinA, OUTPUT);
pinMode(echoPinA, INPUT);
pinMode(3,OUTPUT);
Setpoint = 7*500;
void loop()
{
error=Input-Output;
Serial.println(error);
//entrada sensor
digitalWrite(trigPinA, LOW);
delayMicroseconds(10);
digitalWrite(trigPinA, HIGH);
delayMicroseconds(10);
digitalWrite(trigPinA, LOW);
durA = pulseIn(echoPinA, HIGH);
//CALCULA LA DISTANCIA
disA = durA/58.2;
delay(1000);
Input=disA;
Input=Input*300;
//we're close to setpoint, use conservative tuning parameters
myPID.SetTunings(Kp, Ki, Kd);
myPID.Compute();
Output=map(Output,0,5,0,255);
Output=Input*(5.0/1023.0);
Output=Output*5;
Serial.println(disA);
Serial.println(Output);
analogWrite(3,Output);
if(Input<=Setpoint)
{
analogWrite(3,0);
}
}