04-06-2020 10:53 AM
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!
04-06-2020 12:29 PM
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.
04-06-2020 01:03 PM
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.
04-06-2020 01:38 PM
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?
04-06-2020 03:54 PM
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:
Bob Schor
04-06-2020 04:47 PM
@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.
04-07-2020 09:36 AM
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
04-07-2020 09:53 AM
@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.