close loop for PI
good day..
i laready make sample program close loop want using kp , ki error after compile need means of error "" [font=verdana]pid_v1.cpp:8: fatal error: wprogram.h: no such file or directory compilation terminated[/font].""
i attached program need conform parts make mistake.
#include <math.h>
#include <pid_v1.h>
float vdc= a0; // reading vdc or setpoint
float vs= a1; // reading vs
float is= a2;// reading current is
float vtri= a3; // reading vtriangle wave
float pulsepin1 = 12; // set output pin 12
float pulsepin2= 9;
float digvdc; // digital vdc
float digvs; // digital vs
float digis; // digital is
float digvtri; // digital triangle wave form
float analogvdc; // analog vdc
float analogvs; // analog vs or v input
float analogis; // analog (current)
float analogvtri; // analog triangle wave
float analogvsin; // analog vsin
float analognegvsin; // analog -vsin
float analogiref; // analog reference
pid mypid(&analogis,&analogvsin,&analogiref, 1,2,0,direct);
void setup() {
// declare pulsepin output:
pinmode(pulsepin1, output);
pinmode(pulsepin2, output);
digvdc = analogread(vdc);
digvs= analogread(vs);
digis= analogread(is);
digvtri= analogread(vtri);
analogvdc= digvdc *(5.0/1024.0);
analogvs= digvs* ( 5.0/1024.0);
analogis= digis *(5.0/1024.0);
analogvtri= digvtri *(5.0/1024.0);
analogiref=(analogvdc)*(analogvs);
// turn pid on
mypid.setmode(automatic);
}
void loop() {
analognegvsin=(-1.0)*analogvsin;
mypid.compute();
if (analogvsin>=analogvtri) {
digitalwrite( pulsepin1, high); //pin 12
}
if ( analogvsin< analogvtri){
digitalwrite(pulsepin1,low);
}
if( analognegvsin>=analogvtri){
digitalwrite( pulsepin2, high);
}
if ( analognegvsin<analogvtri){
digitalwrite(pulsepin2, low);
}
}
i laready make sample program close loop want using kp , ki error after compile need means of error "" [font=verdana]pid_v1.cpp:8: fatal error: wprogram.h: no such file or directory compilation terminated[/font].""
i attached program need conform parts make mistake.
#include <math.h>
#include <pid_v1.h>
float vdc= a0; // reading vdc or setpoint
float vs= a1; // reading vs
float is= a2;// reading current is
float vtri= a3; // reading vtriangle wave
float pulsepin1 = 12; // set output pin 12
float pulsepin2= 9;
float digvdc; // digital vdc
float digvs; // digital vs
float digis; // digital is
float digvtri; // digital triangle wave form
float analogvdc; // analog vdc
float analogvs; // analog vs or v input
float analogis; // analog (current)
float analogvtri; // analog triangle wave
float analogvsin; // analog vsin
float analognegvsin; // analog -vsin
float analogiref; // analog reference
pid mypid(&analogis,&analogvsin,&analogiref, 1,2,0,direct);
void setup() {
// declare pulsepin output:
pinmode(pulsepin1, output);
pinmode(pulsepin2, output);
digvdc = analogread(vdc);
digvs= analogread(vs);
digis= analogread(is);
digvtri= analogread(vtri);
analogvdc= digvdc *(5.0/1024.0);
analogvs= digvs* ( 5.0/1024.0);
analogis= digis *(5.0/1024.0);
analogvtri= digvtri *(5.0/1024.0);
analogiref=(analogvdc)*(analogvs);
// turn pid on
mypid.setmode(automatic);
}
void loop() {
analognegvsin=(-1.0)*analogvsin;
mypid.compute();
if (analogvsin>=analogvtri) {
digitalwrite( pulsepin1, high); //pin 12
}
if ( analogvsin< analogvtri){
digitalwrite(pulsepin1,low);
}
if( analognegvsin>=analogvtri){
digitalwrite( pulsepin2, high);
}
if ( analognegvsin<analogvtri){
digitalwrite(pulsepin2, low);
}
}
it looks have old library. edit pid_v1.cpp , change wprogram.h reference arduino.h
Arduino Forum > Using Arduino > Programming Questions > close loop for PI
arduino
Comments
Post a Comment