LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Almost there testing concepts I've learned. Need help.

Hey all, I've completed core 1 and 2 labview training and thought I would make an exercise program from scratch to:

 

Acquire data from 2 thermocouple probes hooked to NI-9211 w/ USB carrier to laptop

Input low and high temperature alarm limits

Display running waveform to show the two temperatures

Show low/high limits (eventually do something with this data, just display for now)

Toggle button highlight to help know where you're at

Use tab control, making tabs transparent for aesthetics

Stop VI

 

So I've almost got it, except my graph doesn't show individual plots and doesn't run continuously. Thoughts on why this is?

 

I will also GLADLY take feedback on the programming. What would you do different? For instance, maybe instead of designing for two thermocouples, I could take any number of thermocouples and let user add channels dynamically. I'm sure I could also create sub VIs to handle repetitive steps.

 

Thanks for you input. During this time where I'm at home I hope to do something constructive and your help is appreciated!

0 Kudos
Message 1 of 8
(2,733 Views)

Your architecture if focused on an event structure that after the first iteration has no timeout value.  That means nothing will happen withe the loop until an event happens.  In this case you pressing the data display button.

 

You should put that in a timeout case.  Or put that in it's own separate loop that runs at a consistent rate.  You can pass data between the loops through queues, or use a user event to pass to the event structure.

 

 

0 Kudos
Message 2 of 8
(2,704 Views)

I find data acquisition applications to be the perfect place to be using configuration files.  They are a great tool for you to learn.  You define your channels and alarms in a specifically formatted text file.  At start up uou read the file, create your DAQmx task based on the file contents, and run the task.  Then you can read the task inside of a loop, preferably this is all that is done in this loop.  Then you stop the task and clear it after the loop is complete.  As stated earlier, use a Queue or User Event to pass your data from this DAQ loop to a logger loop and/or GUI loop.  This will all but eliminate your GUI except for the data display.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(2,699 Views)

Thanks for the input! My ultimate goal would be to allow this VI to run on different machines with different thermocouple options. That's why I want to allow the user to select the channel. And I would love to allow the channel select to the scalable in case there is one TC channel entered or ten. Would a configuration file still apply in this case?

0 Kudos
Message 4 of 8
(2,691 Views)

I recommend that you look into State-machine-like architectures, such as some of the examples that ship with LabVIEW (look at the options under New Project, maybe starting with Continuous Measurement and Logging (DAQmx)).  Here is what I would definitely change in your design:

  • Get rid of the Tab control.  There are rare instances where this Control is useful, and your task is not one of them.  Much better would be an early "Get Configuration" State in a State Machine design.
  • Make use of sub-VIs to "hide the messy details" so you can focus on what you want your code to accomplish.
  • Simplify your logic.  Get it working first, then (if necessary) "make it fancy".

Bob Schor

0 Kudos
Message 5 of 8
(2,671 Views)

@Triplett wrote:

Thanks for the input! My ultimate goal would be to allow this VI to run on different machines with different thermocouple options. That's why I want to allow the user to select the channel. And I would love to allow the channel select to the scalable in case there is one TC channel entered or ten. Would a configuration file still apply in this case?


Yes, it does.  I have a setup that allows a virtually unlimited number of channels and it is all set up using a configuration file.  You just set up the configuration file to have the setup you want and run the application.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(2,656 Views)

Your Data Display is what you probably want in your timeout case, if you set it to e.g. 50.

Your timeout values are backwards, you want to start with -1 so it waits for your setup, then 50 so it keeps the graph rolling.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 8
(2,625 Views)

@crossrulz wrote:

@Triplett wrote:

Thanks for the input! My ultimate goal would be to allow this VI to run on different machines with different thermocouple options. That's why I want to allow the user to select the channel. And I would love to allow the channel select to the scalable in case there is one TC channel entered or ten. Would a configuration file still apply in this case?


Yes, it does.  I have a setup that allows a virtually unlimited number of channels and it is all set up using a configuration file.  You just set up the configuration file to have the setup you want and run the application.


Depending on the OPs use case, they may need the user to perform the initial configuration on the machine. If this is the case, you can have a configuration editor which allows the user to configure the system and which channels are in use. Once they do, save that to a file. When the application starts it will looks for the configuration file. If it exists, it uses those settings. If it does not, it brings up the configuration editor allowing the user to define the configuration on that machine. Still provide the user the option to modify or load a new configuration even when one exists. This type of approach is very flexible and powerful. It is also a nice user experience since in most cases they only have to configure the system once.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 8 of 8
(2,619 Views)