04-29-2009 10:11 AM
Hello,
I am programming a PID temperature controller and need to plot two curves on the same graph. The first is the desired setpoint temperature--a straight line--and the other is the fluctuating temperature with respect to time. The missing vi's configure the serial port, set the PID values and get the current temerautre. They all have been tested and work fine. Any suggestions?
Solved! Go to Solution.
04-29-2009 10:59 AM - edited 04-29-2009 11:00 AM
Add another plot to the graph with two points; (xmin,ysetpoint) & (xmax,ysetpoint). This will create a straight horizontal line across your plot.
Chris
04-29-2009 11:19 AM - edited 04-29-2009 11:20 AM
You have some major problems with the way you are plotting. First, you are using an XY graph so you only get a single plot. If you want to plot two separate, then you should be using a regular graph or chart. Second, the way you are creating the array with the GetTemp VI is totally wrong. With each iteration of the while loop, you create a new array and replace one element. You are throwing away the old data. The simplest thing for you to do is to use a chart. Wire the scalar from the ReadTemp and a constant to a bunle function and the output of this to the chart.
04-29-2009 01:12 PM
No comments on the GetTemp vi from me, I didn't even look at the rest of the code.
"First, you are using an XY graph so you only get a single plot. If you want to plot two separate, then you should be using a regular graph or chart."
huh? You can certainly put more than one plot on an XY graph, and the decision to use a XY vs. waveform graph really has nothing to do with how many plots you want to display. It should be based on whether your data is evenly spaced (constant dt) and all waveforms have identical dt and phase (let's just say T0).
Like I said, I didn't even look at the rest of the code, but Dennis's suggestion to go with a chart may be the simplest way to go assuming your data meets the conditions I outlined, and you don't need to change what's on the chart (adding or removing plots from the chart will wipe the history).
Chris
04-29-2009 01:22 PM
04-29-2009 03:01 PM
04-30-2009 05:24 AM
04-30-2009 07:11 AM