Jump to content

Storing/Importing DAQmx Task Configurations


Recommended Posts

Hello all,

My question is: what is your preferred non-volatile way of storing daqmx task configurations? 

Backstory: For a long time I've used ini files to maintain task configurations between executions of a program. This has worked for primarily static DAQmx configurations but I'm looking at creating a test executive with some degree of flexibility, which means daqmx task configurations start to get more complicated.

If you use MAX for storing your tasks:  Do you run into problems accessing and maintaining these tasks even though you don't have direct access to the file?  Or is there an unlisted storage location for these files?

If you use ini/text based files:  How do you keep things orderly?  I'm running into all kinds of limitations with the format.

If you use XML: Where did you find your schema?  Did you write it?  I know NI saves tasks as XML files, and so therefore the schema exists, but I haven't been able to figure out how to use it.  I've created a task in my project and then dug through the XML of the project to find the attached image.  I believe this would be the ideal solution, but a little bit of digging in around NI.com (I know...) and google (actually useful) has resulted in no answers.

 

I know there is an elegant answer to this question, I've just not found it yet.  Thanks in advance for your comments. 

 

Cheers,

Tim M

SampVolt.PNG

SampVoltXML.PNG

Link to post
Share on other sites

I use MAX as much as I can.  I try to not reinvent the wheel unless there are limitations that I really need to work around, and MAX just does so much that I try to avoid custom things.  I'll still incorporate MAX in my application, by doing things like calling test panels to hardware to open, or creating and editing channels, tasks, and scales using a VI I posted here.

But as for the tasks and how they work in applications.  I'll usually make the tasks in MAX and test them there, then perform an export into an NCE file which can go along with the source code which explains how the channels are all setup.  Then in application builder, you can specify this NCE file to be imported when the installer runs.

I do however remember some issues with editing tasks that have already been opened.  Like I remember having my software opening it, and then trying to edit the scale of a channel and having issues where the new scale wouldn't be applied until I closed and reopened my software.  I must not have been stopping or closing all of the references to the scale, or channel using the scale and that might not be a real limitation of DAQmx but something to look out for.

I've had no experience with INIs or XML as a result.

  • Like 1
Link to post
Share on other sites

Update: 

I can't take credit for this one, as it was recommended to me.  Here's a solution that I believe would work for those wanting a quick and dirty xml solution.  Create a class, add the task to the class private data, and dump the class to xml.  If you do this with just the task you get a nondescript task header, if you do it with a class you get the full task.  Not really sure why this is the case.  Perhaps there is someone with more knowledge of the XML parser who could shed some light on this.  

Capture.PNG

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By paulofelora
      I have a requirement that I thought would be SIMPLE, but can't get it to work.  I have a 9205 card in a little 9174 cDAQ USB chassis.
      My *intended* behavior is to wait (block) at the DAQmx Trigger/Start Analog Edge on, say channel ai1, until I get a falling edge thru, say, -0.050V.  So I have a little vi (that contains 2 parallel loops) that I want to sit & wait for the trigger to be satisifed.  I'm doing "routine" voltage measurements in another AI loop on a different channel.  I want this vi to run separately from my "routine" voltage measurements because I want the app to respond "instantly" to input voltage exceeding a limit to prevent expensive damage to load cells.  I was afraid that if I used either Finite or Continuous sampling to "catch" an excessive voltage, I might miss it while I'm doing something else.  Yes, yes, a cRIO real-time setup would be better for this, but this is a very cost-sensitive task... I just want to "Arm & Forget" this process until it gets triggered, whereupon it fires an event at me.  SO... I'm also reading the same voltage on channel ai0 for regular-ole voltage measurements, and just jumpering them together.  I did this because I read somewhere that you can't use the same channel for multiple DAQ tasks - I *thought* I would need to set up the tasks differently.  {but now that think about it, the setups can be the same...}.
      I've set up the DAQmx task the same as shipping examples and lots of posts I've seen.  I'm supplying a nice clean DC voltage to a 9205 card using a high quality HP variable power supply.  Using NI-MAX, I've verified that my 9174 chassis & 9205 are working properly.
      THE PROBLEM - When I run it, the vi just sails right through to the end, with no error, and an empty data array out.  No matter WHAT crazy voltage I give the "DAQmx Trigger.vi" (set up for Start Analog Edge), it never waits for the trigger to be satisfied, just breezes on through as if it weren't there.  If I set the Sample Clock for "Finite Samples", the DAQmx Read fails with timeout - makes sense, since the trigger wasn't satisfied.  What could I possibly be doing wrong with such a simple task???????
      So my fundamental misunderstanding still vexes me - does the DAQmx Trigger vi not block and wait for the trigger condition to be satisfied, like the instructions state - "Configures the task to start acquiring or generating samples when an analog signal crosses the level you specify"?
      I stripped my requirement down to the bare essentials - see the 1st snippet, the 2nd is my actual vi.  Any ideas, anybody?


    • By Benoit
      This XML test report library is available for you to modify at your will.
      It is based on the IPC-2547 standard so it is easier for any other application or database to parse.
      The html file report offered by LabVIEW was not sufficient for my need.
      So I created those. enjoy!!!
    • By Benoit
      View File .xml test report Measurements.zip
      This XML test report library is available for you to modify at your will.
      It is based on the IPC-2547 standard so it is easier for any other application or database to parse.
      The html file report offered by LabVIEW was not sufficient for my need.
      So I created those. enjoy!!!
      Submitter Benoit Submitted 02/26/2018 Category *Uncertified* LabVIEW Version  
    • By neunited
      Dear All, 
      I'm new to this forum and I'm really glad I became a member.
      I am currently in the phase of designing a simple program which can control all the DAQmx channels using a configuration file (.ini) which is capable of change voltage range during mid-simulation. 
      At the moment my .ini file reads as follows: 
      [AO Channel 1] 
      Name = T2
      Physical Channel = cDAQ1Mod1/ao0
      Max Value = 10 
      Min Value = 0 
      [AO Channel 2] 
      Name = T3
      Physical Channel = cDAQ1Mod1/ao1
      Max Value = 10 
      Min Value = 0 
      [AO Channel 1] 
      Name = T2
      Physical Channel = cDAQ1Mod1/ao0
      Max Value = 5 
      Min Value = 0 
      [AO Channel 2] 
      Name = T3
      Physical Channel = cDAQ1Mod1/ao1
      Max Value = 10 
      Min Value = 0 
      My LabVIEW VI for the .ini script  is attached. I'm relatively new to using configuration file functions and I don't really understand where "Get Key Names" section should be wired to. I have placed a constant on it for now which reads the "AO Channel 1" but how can I get it to read all the channels in the .ini file.
      I am welcome to all suggestions here, I just want to make sure that I don't cause any problems to any of the channels and use best practice methods. All constructive criticism welcome!
      Thank you. 
       
       

      Read Configuration (INI) File (1).vi
    • By Mafis
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <DCT Version="V3.0" User="Administrator" FileType="4" TagListFile=""><DATASOURCE Name="Marchwood" User="root" Password="" Driver="PI"/><PLANT PlantName="Marchwood" UnitName="Plant" ConfigFile="MAR1_Avg_000.XML" ConfigFileCreation="16/04/2007 14:01:40" TimeBias="0" Locale="(GMT) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London"/><DATA_MESSAGE Type="Average" TimeBegin="31-Dec-2007 00:00:00" TimeEnd="01-Jan-2008 00:00:00" SamplePeriod="00:05:00" RequestType="Automatic" TransferPeriod="24"><DATA_POINT PopName="11GB_VIB_HP-SMAX" TagName="11GB_VIB_HP-SMAX" Vartype="A" UnitLabel="µm"><SAMPLE TimeStamp="1199059500" Validity="0" Value="1.274646E+01"/><SAMPLE TimeStamp="1199059800" Validity="0" Value="1.260714E+01"/><SAMPLE TimeStamp="1199060100" Validity="0" Value="1.248902E+01"/><SAMPLE TimeStamp="1199060400" Validity="0" Value="1.236600E+01"/><SAMPLE TimeStamp="1199060700" Validity="0" Value="1.231612E+01"/><SAMPLE TimeStamp="1199061000" Validity="0" Value="1.237882E+01"/><SAMPLE TimeStamp="1199061300" Validity="0" Value="1.231513E+01"/><SAMPLE TimeStamp="1199061600" Validity="0" Value="1.233609E+01"/><SAMPLE TimeStamp="1199061900" Validity="0" Value="1.235653E+01"/><SAMPLE TimeStamp="1199062200" Validity="0" Value="1.236966E+01"/><SAMPLE TimeStamp="1199062500" Validity="0" Value="1.235595E+01"/><SAMPLE TimeStamp="1199062800" Validity="0" Value="1.221824E+01"/><SAMPLE TimeStamp="1199063100" Validity="0" Value="1.210020E+01"/><SAMPLE TimeStamp="1199063400" Validity="0" Value="1.202238E+01"/><SAMPLE TimeStamp="1199063700" Validity="0" Value="1.220617E+01"/><SAMPLE TimeStamp="1199064000" Validity="0" Value="1.231157E+01"/><SAMPLE TimeStamp="1199064300" Validity="0" Value="1.228374E+01"/><SAMPLE TimeStamp="1199064600" Validity="0" Value="1.230319E+01"/><SAMPLE TimeStamp="1199064900" Validity="0" Value="1.237157E+01"/><SAMPLE TimeStamp="1199065200" Validity="0" Value="1.231859E+01"/><SAMPLE TimeStamp="1199065500" Validity="0" Value="1.228248E+01"/><SAMPLE TimeStamp="1199065800" Validity="0" Value="1.235305E+01"/><SAMPLE TimeStamp="1199066100" Validity="0" Value="1.248533E+01"/><SAMPLE TimeStamp="1199066400" Validity="0" Value="1.242054E+01"/><SAMPLE TimeStamp="1199066700" Validity="0" Value="1.230065E+01"/><SAMPLE TimeStamp="1199067000" Validity="0" Value="1.228046E+01"/><SAMPLE TimeStamp="1199067300" Validity="0" Value="1.245642E+01"/><SAMPLE TimeStamp="1199067600" Validity="0" Value="1.245089E+01"/><SAMPLE TimeStamp="1199067900" Validity="0" Value="1.239629E+01"/><SAMPLE TimeStamp="1199068200" Validity="0" Value="1.242647E+01"/><SAMPLE TimeStamp="1199068500" Validity="0" Value="1.249479E+01"/><SAMPLE TimeStamp="1199068800" Validity="0" Value="1.251456E+01"/><SAMPLE TimeStamp="1199069100" Validity="0" Value="1.266746E+01"/><SAMPLE TimeStamp="1199069400" Validity="0" Value="1.266234E+01"/><SAMPLE TimeStamp="1199069700" Validity="0" Value="1.266106E+01"/><SAMPLE TimeStamp="1199070000" Validity="0" Value="1.259365E+01"/><SAMPLE TimeStamp="1199070300" Validity="0" Value="1.238166E+01"/><SAMPLE TimeStamp="1199070600" Validity="0" Value="1.229414E+01"/><SAMPLE TimeStamp="1199070900" Validity="0" Value="1.224306E+01"/><SAMPLE TimeStamp="1199071200" Validity="0" Value="1.225017E+01"/><SAMPLE TimeStamp="1199071500" Validity="0" Value="1.207360E+01"/><SAMPLE TimeStamp="1199071800" Validity="0" Value="1.223199E+01"/><SAMPLE TimeStamp="1199072100" Validity="0" Value="1.232578E+01"/><SAMPLE TimeStamp="1199072400" Validity="0" Value="1.236228E+01"/><SAMPLE TimeStamp="1199072700" Validity="0" Value="1.243583E+01"/><SAMPLE TimeStamp="1199073000" Validity="0" Value="1.254738E+01"/><SAMPLE TimeStamp="1199073300" Validity="0" Value="1.279570E+01"/><SAMPLE TimeStamp="1199073600" Validity="0" Value="1.317496E+01"/><SAMPLE TimeStamp="1199073900" Validity="0" Value="1.322220E+01"/><SAMPLE TimeStamp="1199074200" Validity="0" Value="1.337082E+01"/><SAMPLE TimeStamp="1199074500" Validity="0" Value="1.323367E+01"/><SAMPLE TimeStamp="1199074800" Validity="0" Value="1.274038E+01"/><SAMPLE TimeStamp="1199075100" Validity="0" Value="1.235951E+01"/><SAMPLE TimeStamp="1199075400" Validity="0" Value="1.243144E+01"/><SAMPLE TimeStamp="1199075700" Validity="0" Value="1.255276E+01"/><SAMPLE TimeStamp="1199076000" Validity="0" Value="1.263342E+01"/><SAMPLE TimeStamp="1199076300" Validity="0" Value="1.252355E+01"/><SAMPLE TimeStamp="1199076600" Validity="0" Value="1.254722E+01"/><SAMPLE TimeStamp="1199076900" Validity="0" Value="1.261100E+01"/><SAMPLE TimeStamp="1199077200" Validity="0" Value="1.265973E+01"/><SAMPLE TimeStamp="1199077500" Validity="0" Value="1.257116E+01"/><SAMPLE TimeStamp="1199077800" Validity="0" Value="1.245824E+01"/><SAMPLE TimeStamp="1199078100" Validity="0"
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.