04-06-2016 05:34 PM
I am using a PID controller to monitor a setpoint pressure so I want to create a square wave graph that runs for 60 s at a value of 1 and then for 1s it runs at a value of 0.
I have created a formula node with the following code:
04-07-2016 03:55 AM
Your formula node do nothing.
---
u1=0;
P1=0;
Reset=0;
--
So, u1 input doesn't matter. u1 =0 any case.
---
if {(u1<= 59)
P1==1
}
-----
and u1<59 averytime
so P1=1
---
else {
(u1>59)
P1==0
}
for (i=0 ; i<0.5 ; i++) ; //this section just gives a time delay of 0.5 s
reset==1
----
and this part never work.
But even if u1>59
why you think that
"for (i=0 ; i<0.5 ; i++) "
give you delay 0.5s?
There are always 1 iteration and stop (i++ = i+1 = 1 > 0.5)
04-07-2016 05:07 AM - edited 04-07-2016 05:07 AM
No formula node needed. Just set the Elapsed Time VI to reset every 1 second and compare the elapsed time output to 0.5. Then you know if you should have a high or low.