LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Heater control and temperature measurement help (integrating 2 VIs)

I'm hoping someone can help me integrate the function of 2 VIs I've created together.  I wrote basic LabView code about 10 years ago so I'm rusty but understand the priniciples.  I don't need a full worked solution just helping hand that I can tidy into my LabView program.

 

My system consists of 10 heaters with 10 associated temperature probes (RTD).  The program needs to be able to measure and display the temperatures continuously.  The program also needs to allow the user to switch on any one of the heaters for a fixed period of time (between 0.5 and 15 seconds).  There is some electronics to switch the heaters that allow the NI hardware to use simple digital outputs.

 

I am using LabView 2016 and a compactDAQ chassis with 3 modules:

2 x NI9216 (for the 10 RTDs)

1 x NI9403 (for the Digital outputs)

 

I have 2 Labview VIs, one which uses a DAQ assistant to gather the temperatures and output to a chart (screenshot attached).  It's really simple and does the job.  The second uses a for loop to allow me to select and switch on a heater for a fixed period of time (the programming is really clumsy but it proved my hardware and shows the principle of what I want - even if the implementation is naff!) - VI attached.

 

I need to integrate these together but whenever I try this the two loops interact making the heater switching not work or the temperature not display rapidly.  I've spent a few hours thinking and trialing things and I believe I need to add the heater switching into the temperature VI while loop.  Any help on how to do this would be really appreciated as I'm supposed to have this working by end of tomorrow!

 

===

FInally, some implementation thoughts (feel free to ignore - these are my thoughts about how I thought I could get it working):

Have a momentary boolean switch outside the while loop that is default false

When the switch is pressed a timestamp is recorded and the DO line is switched to true

The number of 'heater on' seconds is added to this timestamp

The loop checks continuously if the current time has past the timestamp+heater on time - if it has DO = false otherwise DO = true

I haven't found a way of coding this 😉

 

Download All
0 Kudos
Message 1 of 2
(3,000 Views)

Suggestions, requests, and recommendations:

  • Attach code, not static pictures of code.  (You get half-credit for Heater Controller.vi, no credit for Temperatures.png).
  • Exception to the above -- if you know how to create a LabVIEW Snippet of your code, feel free to attach the Snippet (which also has a .png extension, but is much more than a picture -- it contains the actual VI).
  • Try to avoid the DAQ Assistant.  Do a Web Search for "Learn 10 Functions in NI-DAQmx" and learn how easy it is to use DAQmx functions like Start Task, Read, Write, etc.
  • Do not use Dynamic Wires!  They "hide" details and are sources of confusion.
  • Sometimes it helps to "start small".  Try to think about controlling a single Heater.  I trust you recognize that the Heater Control logic and the Temperature Reading logic are independent (unless you are "heating until Temperature X is reached"), and can thus be two independent loops or independent VIs called in parallel.
  • For a single heater, you need the following:
    • How long to run.  This can be a Knob or other numeric control that you read, and you can read it when you start the heater.
    • A Start button to start the heater.
    • Possibly a Stop button to stop the heater "early".
    • Think about timing.  I presume that your heater will run in units of 0.1 seconds, so you can have a loop that has a 100-msec Wait inside it, making it a 10Hz "clock".
    • Do you know about State Machines?  Your system exists in two States -- Heater Off and Heater On.  You can have a loop that runs at 10 Hz and checks which State it is in (State is held in a Shift Register), with the initial State being Off.
      • If Off, check if Start pressed.  If so, set up counter for number of ticks before turning State Off, turn on Heater, and set State On.
      • If On, increment (or decrement) Clock Count.  If time expired or if Stop button pressed, turn off Heater and set State Off.

I hope that will get you started.

 

Bob Schor 

0 Kudos
Message 2 of 2
(2,936 Views)