LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID datapoint variable

Hello everyone.
this is the first time I write on the general forum. I need a big help !!! I need to build a PID but does not have a fixed setpoint but variable. That should follow a waveform. My latest attempt is this (attachment), but it does not work so well. I do not know how to do and the time is almost expired. Please help me!!!

 

thanks to all

0 Kudos
Message 1 of 11
(3,508 Views)

i have only LV2012, cannot open your VI.

I guess this is a homework/student project? I am just curious, what a real world application would need a setpoint changing as a waveform 🙂

Question is very similar to this:

http://forums.ni.com/t5/LabVIEW/how-to-make-setpoint-dynamic-for-PID-control/td-p/2930998

 

0 Kudos
Message 2 of 11
(3,493 Views)

It is a university project! I saved my sixth in the 2012 version, if you want you can open it now. I know I read the thread you're referring to, but I did not understand the answer or did not work. If you could help me I shall be very grateful. However, it is a system for controlling a piezoelectric actuator.

 

Salvo

0 Kudos
Message 3 of 11
(3,466 Views)

Hi,

unfortunately "not work so well" isn't sufficient to understand le problem.

What hardware are you using?

There is an error out?

Can you provide more information?

 

Bye

0 Kudos
Message 4 of 11
(3,454 Views)

the PC is connected to only one A / D card (+10 - 10 V) which then sends and receives the voltage to my actuator

0 Kudos
Message 5 of 11
(3,450 Views)

I have no error, but it is as if it worked too slowly. It seems to me that you only update once every second, and this is not enough.

0 Kudos
Message 6 of 11
(3,447 Views)

NI-DAQmx driver can be used only with NI Hardware... do you have HW name/code? 

Cycle speed in this case is determined by DAQmx Read. It waits for all samples be available.

For example if you are acquiring at 1kHz and you connect "500" at DAQmx Read-->number of samples, while loop cycles at 500ms.

0 Kudos
Message 7 of 11
(3,446 Views)

yes i think is NI SCB-68

0 Kudos
Message 8 of 11
(3,443 Views)

SCB-68 is only terminal block.

Anyway try reducing number of samples per channel number and monitor while loop speed.

In general try to identificate what is the part of while loop that take more time

0 Kudos
Message 9 of 11
(3,437 Views)

1. one subVI is missing, the "Get Terminal Name with Device Prefix.vi", my LabView does not have this VI

2. You should tidy up your code and wiring, there are many overlapping objects, it is a big "spagetti"

3. the "Start" button does not have any function, you can skip it, if you start to run the code (and set parameters before) just simply, you get the same behaviour. So you do not need the large case structure either!

 

4. There are big confusion at many parts in your code. First you should clearly specify to yourself what you code must perform. First as I see you create a signal which you would like to use as setpoints. But you cannot wire this dynamic data directly to your PID! You can see the little red coercion dot at the input? So here you just get always the same value as setpoint (3.35).

You need to create an array of numeric doubles from the dynamic data first, and index it to your PID (autoindex it through the while loop)

 

problem_01.png

 

 

5. Specification requirements! How do you want to do the PID control? You generate 20 001 setpoint values with your signal express VIs. So do you want exactly 20001 loop iterations? So at every iteration you feed your PID with a new number from your array? So in this case you will need Finite number of samples for DAQmx. As I see you want a rate of 5000 Hz? It means that, your whole process will be 20001*1/5000 sec = 4 sec approx. long.

 

6. Your DAQmx VIs will do the timing, remove the "Wait Until Next ms Multiple" from your loop.

7. Set your DAQmx Read.vi for 1Chan 1Samp, because you only want to read a single value per iteration, and write also a single value.

 

Also try to practice LabView using some of the available training material, you are missing very basic concepts in LabView.

 

0 Kudos
Message 10 of 11
(3,422 Views)