LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hardware Timed Single Point

Hello All.
 
I am tyring to output a PWM, the duty cyle of which is controller by a PID controller.
I am using a counter output, as I have no spare anolog outputs.
The problem I am having is that I also have to display on charts the same data I am using a reference from the controller.
Attached is the NI example on PWM generation.
But when I use HW timed single point for the AI, and Counter out to try to synchronise, no data is available.
 
I have read the help files which implies HW single point holds no buffer.
 
But how can I remove this dependency and disaply the data, and use it for control purposes also.
 
Thanks.
 
Best regards
Tom 
0 Kudos
Message 1 of 8
(3,887 Views)

Your comment "no data is available" is what gets me here.  If you truly are getting no data then your controller isn't working correct?  Is it the fact there is no data or there is only 1 data point?  If you aren't getting any data then you have a much bigger problem here than how to display the data.  Also, can you clarify which data you are trying to capture?  The AI data, the output of your PID, or the frequency/duty cycle of the waveform?

 

StuartG

Message 2 of 8
(3,878 Views)

Hello Stuart.

Thanks for the reply, and my apologies for the vagueness of my post.

 

The context of my post.

I am reading in 3 anologue voltages, and comapparing them to a setpoint in real time, using the 7041e card. I am also charting the same data. I then use a PID controller via a PWM signal to form the control action. As in the example when both the AI task and the CO task are HW single point, the controller reacts to the changing data and outputs the desired response.

However I also displaying the data from the 3 AI channels, so I can monitor the behaviour of the controller.

What I mean by no data is that the numerical displays all say "NAN", and the charts are all blank. When I look at the block diagram there is no data listed for the signals.

Best wishes

Tom

0 Kudos
Message 3 of 8
(3,860 Views)

So...from what I am reading in this message is if you say put a probe after your analog read you are getting no data returned.  If that is the case then you do have much bigger problems.  You are actually inputting data.  In other words if you do just the AI on those three channels everything works fine??  You aren't getting any errors?  Kind of weird because I would at least expect from the AI read you would be getting zeros even if no signal was actually hooked up.  If you then fed this into your PID and monitored there it would possibly give you NAN. 

What if you do just an AI HWTSP acquisition (ignore the PWM for now) what happens.  Try looking at the example in the control.llb\PID Control Single Channel.VI.  Does that work??  What do you see after the read...what do you see after the PID calculation...is it the same or different from what you see when using the PWM VI??

StuartG

0 Kudos
Message 4 of 8
(3,851 Views)
Hello Stuart.
 
What exactly is the significance of the hardware timed single point acqusition?
Before I was using the AI in continuos mode, and all samples were displayed, its the HWSP that creates the problem.
I am going back into the lab now, to try your suggestions.
 
Thanks again
 
0 Kudos
Message 5 of 8
(3,843 Views)
I looked at the example you mentioned.
In this eample I place a probe after the read, I get a reading of 10V, which is not true, the channel is at 0V.
This value does not change, therefore nor does the control action.
 
I am not sure what this means.
 
 
 
 
0 Kudos
Message 6 of 8
(3,839 Views)
If you hooked up an AI continuous task to the same channel and it works and then all you did is change the timing from continuous to HWTSP it should work.  By you getting 10V when you expect 0 V I am suspecting you are monitoring a different channel OR something in the PID calculation is causing your voltage to ramp up.  HWTSP should in no way have any affect on how the channel is read.  One test to try is take a simple AI continuous app that you say works fine and then just change the sample mode from continuous to HWTSP.  You may have to tweak a few things like the sample rate and obviously the number of samples to read is only going to be 1 but other than that the apps should be the same.  Take the PWM and PID control out of the equation for now.  Vary the voltage and make sure you can see a change.
 
Significance of HWTSP.  This is used primarily in control applications where low jitter and speed are crucial.  Every point is important to the PID calculation you are doing.  We have put a lot of optimizations into this mode so that the Reads are more efficient and there is lower jitter simply because the buffer size is 1.  For most control apps I would say this is the way to go.  The downside is you are not going to be able to monitor as fast as a buffered acquisition.  If you use LabVIEW RT it can help increase the speed degradation but Windows is so jittery that this mode will error at moderate rates.  I hope this makes sense??
0 Kudos
Message 7 of 8
(3,815 Views)
Thanks Stuart.
 
I think I understand better now. I will have another look.
 
All the best.
 
Tom
 
0 Kudos
Message 8 of 8
(3,805 Views)