LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Temperature dependent data acquisition with PID control

Hello all, 

 

  I am trying to take measurements in an automated labview environment such as (take measurements at 300-320-330-340 etc.. Kelvin). My problem here is the PID control loop is never ending so when I put it in the loop, tho only way to stop it is the stop function. However, that stops the VI entirely. My goal is checking the Temperature 3 times in 15 min intervals (these can be changed with controls) but I cannot do it beacuse I need the global Temperature data running all the time. I am attaching the VIs.

Thanks

Download All
0 Kudos
Message 1 of 18
(3,476 Views)

I did update the controller Vi as attached. My problem is not being able to stop the initializing VI's (Temperature controller and 2 KLP sub VI`s). I tried putting a stop connection on the sub VI`s but than  they wait for the other loop to even start the suv VI`s which prevents me to get the initial data. Please help asap. Thanks !

 

0 Kudos
Message 2 of 18
(3,465 Views)

Can you share the subVIs?  Without those we cannot tell much about what your code is doing.  There should be no need for global variables in this application.

0 Kudos
Message 3 of 18
(3,459 Views)

Hello, I am attaching the sub VI`s . The reason that I put global variables is I didnt want to initiate the insturments each time. So they are running on the backround and giving me the current data. I can remove them but I have no idea how to do what I want withoiut them. So, in the Sub VI`s `temperature monitor` is getting temperature data, KLP 150 and KLP 300  are heaters to the system. 

 

Thanks!

Download All
0 Kudos
Message 4 of 18
(3,457 Views)

The KLP 300 didnt fit so I am sending it with another message. Thanks in advance for your help

0 Kudos
Message 5 of 18
(3,456 Views)

What is this program actually supposed to do?  What is the reason for keeping things running in the background?  You're using a PID loop.  It doesn't make sense to run the PID any faster than you can acquire data, so you might as well read the data in the same loop as the PID.  Same goes for the output - no reason to update it any faster than the PID, so put that in the same loop too.

 

If you need to do some initialization, do it outside the loop, before the loop starts.  If you really, really want to keep all related functions inside the same subVI, then add an input to the subVI that sets whether it's in "initialize" or "run" mode, call it once outside the loop to initialize, then call it in run mode inside the loop.

0 Kudos
Message 6 of 18
(3,449 Views)

Here is what I want to do:

 

   1.Set the temperature to x value make sure it is stable in +/- 2K for 15 minutes and stop PID (I cannot read the data in the same loop since both temperature monitor and data channels are on the same insturment)

   2.Run the measurement VI for hall effect measurements, save the data, show it on the graph and move to the next temperature.

 

After your message I have tried for loops to monitor the temperature and set the current for the heaters using PID. It overshoots a lot. I am confused.

0 Kudos
Message 7 of 18
(3,447 Views)

You're still providing very little information about your system.  What do you mean by "both the temperature monitor and data channels are on the same instrument"?  Your system may seem obvious to you when it's sitting in front of you, but two sentences isn't enough to describe it to someone who isn't there, and your code isn't too clear either.

 

It sounds like you need a state machine.  One state will bring the temperature to the setpoint.  Once you reach the setpoint, move to the next state in which you take the measurements.  In a third state, increment the temperture setpoint (which should be stored in a shift register), then return to the first state.  That's one possible structure, it's up to you to determine the right number of states.

0 Kudos
Message 8 of 18
(3,440 Views)

My system includes , sourcemeter, multimeter, 2 power supplies for heaters, magnet power supply, switch system (connected to multiemeter and sourcemeter). I have a measurement VI already written and works ok. What I Want to do is running these measurement VI in different temperatures and record the data. I also have a PID controller which runs seperately. My problem is I cannot stop the PID controller so It wont go to the next state machine case. I have made a state machine structure and It doesnt move from the first state cos PID control is still running. If I put a stop button, it stops the entire VI. If I put a boolean connected to the stop of the controller VI than It waits for that boolean even to start and doesnt update my tenperature or any data realated to the PID control. My problem is how can I stop the PID and still make it work efficient? 

 

Thanks

0 Kudos
Message 9 of 18
(3,410 Views)

There is an easy way to do this, as I explained before, if you are willing to break up your existing VIs and not run the PID in the background.  Start with a state machine.  In one state, read the temperature, do the PID calculation, and set the output.  No global variables: send the serial command, read directly from the instrument, compute the new output, write it directly to the heater power supplies, all within the same state.  Continue in this state until you reach the desired temperature.  Then proceed to the next state, in which you take the measurements.  Note that the PID doesn't run in that state.  After taking the measurements, write a new temperature setpoint to a shift register, then go back to the first state in which the PID attempts to reach that temperature.  You may need to reset the PID each time you change the setpoint; if so, this is easy to do with another boolean shift register.

 

If you're going to insist that you must keep your existing VIs, running separate loops communicating with global variables for no good reason, then you could come up with some complicated system using notifiers to signal each state, but that hardly seems worthwhile when there is a simple solution available.

 

EDIT: Also, try writing down a detailed list of the actions you want your program to perform, in the correct order.  This will help with two things:

1) If you can explain in words what you want your program to do, then you will more easily be able to understand how to program it

2) It will make it clearer to other readers of this forum what you are trying to accomplish

 

Telling us that you have a heater, power supply, magnet (?) etc is really not helpful since you've said nothing of how they're connected nor what the system is supposed to do.

0 Kudos
Message 10 of 18
(3,390 Views)