Examples for good programming practice with multiple DAQmx tasks

I'm writing a program to continuously log data from 8 counters, 8 encoders, and 8 voltages. The proof of concept VI with a single counter was simple and elegant, but scaling up to all signals resulted in a wiring mess. I've been working through the Labview Core courses, and am currently on Core 3. I still haven't come across a discussion on how to work with multiple DAQmx tasks without making a mess of the block diagram. Can anyone point me in the right direction?
Also, say I have a state machine that has a configure, idle, and logging states. I need to set the initial values of the encoders during configuration, and keep up with their changes while in the idle state so I have appropriate starting values when entering the logging state. Can anyone point to an example that shows how this might be accomplished?
Thanks

I'm very familiar with AE's/Functional Globals - but I have struggled in the past with handling multiple DAQmx tasks - particularly when you're using multiple devices and using different types of measurements which require seperate tasks/handling (e.g. such as thermocouples which require extra compensation).
I'm not even sure I know whare the requirements are for needing multiple tasks - I know you can need multiple tasks for a single device if the type of measurement is different but can you share an Analogue Input task amongst multiple devices?
I think in hindsight (and without too much thought now) it looks like a good case for Object Oriented LabVIEW - with a base DAQmx class (initialise, configure, start, acquire, stop, close etc.) and then child classes for each type of measurement (with one task associated with each - and private data unique to that specific class). You then hold an array of objects (one for each task) and iterate through each one with dynamic despatch to get the data.
I don't know your particular experience level of using LabVIEW (and as such, OO may not be appropriate) - but as a wider discussion of 'best practice' it seems like an appropriate method I would use going forward.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets

Similar Messages

  • Good programming practice - Abstract class

    Hi all,
    I have been trying to help another soul in this forum, and came to the conclusion that I don't know good
    programming practice when it comes to abstract classes.
    Is this correct?
    You CAN implement methods in an abstract class, but it's not recommended.
    I have NEVER done this...when is there possibly a need to?
    Regards.
    / k

    Yes, absolutely, you can implement methods in an abstract class. Any method that all subclasses will perform in the same way can be implemented in the abstract base class. If subclasses perform similiar functions depending on their type you declare those as abstract in the base class. Here is a contrived example that I have seen on job interviews.
    Suppose your developing an application that draws on a panel. We want to provide some canned shapes such as a circle, a square and a triangle. We want to be able to draw the shape set or get its color and calculate its area.
    Let's define an abstract base class Shape
    public abstract class Shape{
        private Color myColor;
       //  since color has nothing to do with what kind of shape we're working with, create concrete implementation
       public Color getColor(){
            return myColor;
    public void setColor(Color newColor){
       myColor = newColor;
    // however, drawing the shape and calculation its area are depending on the actual shape.
    public abstract void draw();
    public abstract double getArea();
    // so then Square would be something like
    public class Square extends Shape{
       public double get Area()
          return sideLength * sideLength  // assumes somehow we know sideLength
    public void draw(){
                  // concrete implementation
    }we can do the same things for Circle class and Triangle class.
    And, if you think about it you'll notice that we could have made a Rectangle class and then Square would be a subclass of Rectangle where both dimensions are equal.
    I hope that somewhat strained example helps answer your question.
    DB

  • Do IOS app developers follow any good program practices?

    I've had my iPad (original) a little over two years now, and I can say without a doubt, it is the most unstable platform I've used in nearly 30 years of using computers.  Most apps crash routinely, usually while at least one other app is running in the background.  Unloading the crashed app from memory and reopening uually works, but is a huge nuisance (and reason enough to me why iPads are not business-ready, except for specific task applications requiring mobility).  As one trained in both software and systems engineering, with 20 years IT experience mostly in engineering, I have to conclude that IOS app developers use "code and fix" development, with little testing before release.  Of course, in theory it could be that IOS itself isn't well designed to handle multitasking and doesn't provide adequate process isolation.  Either way, it makes for a frustrating experience as a user.
    Has anyone else had similar issues?  Thoughts on why?

    The original iPad does poorly with multiple apps open, the memory is just too small at 256 MB.  The processor is very slow compared to those in the current generation iPads.  And then couple that with developers who are for the most part independent of Apple and merely submit there products to Apple and you get a totally unpoliced set of apps.  Some are true professionals and follow very good programming practices, one that comes to mind is the GoodReader PDF reader.  Very stable and very powerfully built.  then you get into the gamers and Is is almost like they never heard of writing effecient, compact code.
    The issue I see is a tightly controled operating system, with app developers handed a set of specs under which to code, but no real controls other than does the app run and is it free of malicious code.
    Just some thoughts.

  • Good programming practices:   creating Iterator objects

    Hi,
    This is a question about Good programming practices for creating Iterator objects of ArrayList objects. The following line of code works fine in my program (as ridiculous as it may sound):
            Iterator cheesesIterator = cheeses.iterator();but I was wondering whether Java is automatically inserting the <Type> and new code to make:
            Iterator<String> cheesesIterator = new cheeses.iterator();and therefore whether it is good practice to use these everytime? Thank you. ("full" code shown below:)
    import java.util.ArrayList;
    import java.util.Iterator;
    public class DemonstrateIterator
        private ArrayList<String>  cheeses;
         * constructor:
        public DemonstrateIterator()
            cheeses = new ArrayList<String>();
            cheeses.add("Emmentaler");
            cheeses.add("Cheddar");
            cheeses.add("Stilton");
            cheeses.add("Brie");
            cheeses.add("Roquefort");
        public void listCheeses()
             //make an iterator object of the ArrayList object
            Iterator cheesesIterator = cheeses.iterator();
            while (cheesesIterator.hasNext()) {
                System.out.println(cheesesIterator.next());
            /** Exploring the toString and Super functions. **/       
            System.out.println("\na toString call to Super returns: " +
                                              super.toString() + "\n");
    }

    AJ-Phil wrote:
    Hi,
    This is a question about Good programming practices for creating Iterator objects of ArrayList objects. The following line of code works fine in my program (as ridiculous as it may sound):
            Iterator cheesesIterator = cheeses.iterator();but I was wondering whether Java is automatically inserting the <Type> and new code to make:
            Iterator<String> cheesesIterator = new cheeses.iterator();and therefore whether it is good practice to use these everytime? TFirst, new chesses.iterator() won't compile.
    iterator() is just a method that returns an iterator. It constructs an instance of a private or nested class that implements iterator, and returns a reference to it.
    As for the <T>, when you declare List<String>, that parameterizes that list with type String. The iterator() method returns Iterator<T>. You can look at the source code for yourself. It's in src.zip that came with your JDK download.
    Separate from that is your declaration of that variable as type Iterator, rather than Iterator<String>. Regardless of what you declare on the LHS, the iterator() method returns Iterator<T>. Your bare Iterator is essentially Iterator<Object> or Iterator<? extends Object> (not sure which, or what the difference is), which is assignment compatible with Iterator<T>. If you had declared it Iterator<String>, you wouldn't have to cast after calling next().
    Edited by: jverd on Nov 23, 2008 11:33 AM

  • [Non IE Regression] Support for full screen mode with multiple monitors

    This seems to be a regression with Flash Player v11.2.202.x (for all other browsers).
    With Internet Explorer it is still working.
    http://kb2.adobe.com/cps/890/cpsid_89050.html
    == Support for full screen mode with multiple monitors ==
    Full screen content will remain in full-screen on secondary monitors, allowing users to watch full-screen content while working on another display.
    Tested on Windows 7 x64 SP1 with:
    - Internet Explorer 9
    - Firefox Release, Beta, Aurora, Nightly
    - Opera 12 build 1116
    In bugbase.adobe.com I cannot choose v11.2.x

    Please vote for it If you have the same problem:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3016912
    Thanks

  • Any usefull examples of good coding practice in large programs

    Hi, ive been writing code for about 10 years now. Know a good bit about labview now lmao! But want to get to know good code practices e.g. in creating large programs, code templates, avoiding race conditions, use of multiple loops and to be able to write code for clients as a contractor. Any one help me??
    Stu
    Solved!
    Go to Solution.

    Check out thelargeapp community and this KB article
    Message Edited by Jeff Bohrer on 06-14-2010 04:49 PM
    Jeff

  • Design Suggestions for Multiple DaqMX Task Streaming App?

    I'm working on a LabVIEW application in which I'm streaming high-speed data to disk from multiple PXI devices simultaneously.  Each device has its own DaqMX task, and all tasks stream to the same file.  The PXI device configuration (which devices are in the chassis, which slots they're in, and which channels to read from each device) is determined at runtime.
    Does anyone have a suggestion for a design model for this?  To make matters worse, I'd like to be able to specify a channel to monitor its data during the streaming.  I'm thinking the Producer-Consumer model is the basic approach, and I'm at the point where I have an array of DaqMX tasks, one for each device.  I could probably extend that array to be an array of clusters containing:
       1) DAQ Command (e.g. Initialize, Start, Stop, Acquire, etc)
       1) Task ID
       2) Control reference to 2-D array (where each DaqMX read can be stored)
       3) Array of channel names (to allow selection of channel to be monitored
    This could be passed as notifier data, to a data collection subVI, but the part I'm struggling with is finding the best way to run X number of tasks in parallel, where X is not known until runtime.
    Any suggestions would be appreciated.

    Thanks for the input.  With regards to the file format, the decision has been made by my superiors not to use TDMS - unfortunate, but NI hasn't provided the information to write a MatLab file reader, which is a requirement.  So, I've created a custom file format tailored to the needs of my application, but generic enough to be used for other apps. With it, I've been able to stream 8 channels at 800KHz (4 channels each from 2 PXI-6120s) without breaking a sweat.  However, the performance varies greatly depending on which slots the cards are in (but that's a whole different discussion - see the PXI forum for that one).  Once NI solves that one, I'll feel a lot more comfortable.
    I have already made reentrant subVIs that can perform a specific DAQ task.  The problem with a for loop is that the VI sits and wait for a start trigger, then acquires the streaming data.  I can't start the next VI because I'm in the first one.  I thought about creating a data collection VI, and this VI would start up to 6 other VIs in parallel, based on how many and which cards were present.  It's a bit messy, because each slot can contain one of two devices, so I'd need to check which type it was before calling it.  I'm thinking I'll have to create the task list and the references to the data in the main GUI loop, and then pass this using a notifier or queue to the data collection loop. 

  • Dynamic routing for a Business Service with multiple operations

    I have two business services with multiple operations. Business service A (bsA) has operations OpA1 and OpA2. Business service B (bsB) has operations OpB1 and OpB2.
    Depending on incoming Proxy message and operation, I have to do one of the following
    1. If someValue = A and operation= Op1 then invoke operation opA1 of bsA
    2. If someValue = B and operation= Op1 then invoke operation opB1 of bsB
    3. If someValue = C and operation= Op1 then invoke operation opA1 of bsA AND* operation opB1 of bsB and return aggregate data of both invocations
    1. If someValue = A and operation= Op2 then invoke operation opA2 of bsA
    2. If someValue = B and operation= Op2 then invoke operation opB2 of bsB
    3. If someValue = C and operation= Op2 then invoke operation opA2 of bsA AND* operation opB2 of bsB and return aggregate data of both invocations
    Using a dynamic route node or dynamic routing options, I am able to achieve cases 1, 2, 4, and 5.
    But for cases 3 & 6, I can not use a route node. When I use a Service call out instead, then I am forced to create a Operational branch but that does not seem like the best design since for every new operation added to the business services, I have to add a new branch to the Operational branch and redo all the functionality for that branch.
    Basically, I am looking to achieve the functionality of the Route node ( no need to specify the operation ).
    Any thoughts/ideas on what the best design would be?
    thanks

    For cases 3 & 6, why don't you route to another proxy service where you can simple do two service callouts, merge output data somehow and return them to the first proxy?
    If you look for "special route feature", that could possibly call two services for a single message, I'm afraid you won't succeed.

  • Display only one row for distinct columns and with multiple rows their valu

    Hi,
    I have a table having some similar rows for some columns and multiple different rows for some other columns
    i.e
    o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
    9825000111 01-jan-06 'a' 980515464 01-feb-06 c
    9825000111 01-jan-06 'a' 991543154 02-feb-06 d
    9825000111 01-jan-06 'a' 154845545 10-mar-06 a
    What i want is to display only one row for above distinct row along with multiple non distinct colums
    ie
    o_mobile_no o_doc_date o_status d_mobile_no d_doc_date d_status
    9825000111 01-jan-06 'a' 980515464 01-feb-06 c
    991543154 02-feb-06 d
    154845545 10-mar-06 a
    regards,
    Kumar

    Re: SQL Help

  • Any example for Timed ShellScript Discovery with PowerShell Discovery Probe?

    Hi all,
    Kris Bash provided a unix authoring library with many examples for dynamic discoveries for Unix/Linux (Unix/Linux Authoring
    Library). What I am missing here is a timed shell script discovery, using a powershell discovery probe for creating discovery data. There is only a PropertyBag Discovery available.
    Maybe one of you has already implemented such a discovery and can provide this as an example? I tried some things but so far it is not working.
    The idea behind this is to execute a shell script on a linux host that returns several lines. The output should then be parsed by a powershell script that - depending on the output - creates different class instances. Any ideas?
    Regards,
    Holger

    Holger,
    See the blog post here (http://operatingquadrant.com/2011/03/24/operations-manager-%e2%80%93-extending-unixlinux-monitoring-with-mp-authoring-%e2%80%93-part-iii/)
    for an example of using the PowerShellDiscoveryProbe.  It doesn't matter whether this follows a Shell Command or a Shell Script probe, as in both cases you are passing the StdOut output as a parameter to the PowerShell script.  You would parse StdOut
    just as you do in the PropertyBag examples, but use the MOMApi calls to create and return the class instances and properties.
    I hope this helps,
    Kris
    www.operatingquadrant.com

  • SO creation for one internal item with multiple customer code

    Hello,
    We want to create sales order for one internal product for one customer with multiple customer product code.
    SAP allows only one to one relation in customer info record. Is there any work around for having multiple customer product code for our single internal product code in single sales order.
    Regards,
    Balu J Karbhari

    Hello,
    It is not possible. Please check OSS note 626931.
    One alternative approach might be to trying to use the material determination functionality. Please try the below steps and check if it works for you.
    T Code VD51: Create CMIR for Customer & Material
    T. Code VB11: Maintain material determination for all required materials to point to the Material which has the CMIR.
    T Code OVRQ: Substitution reasons. Make the configuration to print Original material . Check  the column ENTRY, so on output the original material will be printed.
    Hope this helps
    Regards
    Sai

  • Using Content Query webpart for specific Document library with multiple managed metadata - Document with multiple metadata tags not showing up

    Hi,
    I am having an issue where when I insert a Content Query webpart into a page, and filter to managed metadata, all the right documents show up except one document that happens to have two metadata tags attached to it.  The content query webpart is set
    to only look through a specific document library.  I'm not sure what I am doing wrong.
    Here is the one document with two metadata tags:
    Below is the Content Query:

    Hi,
    As I understand, you did not get the results with multiple metadata tags through Content Query web part in SharePoint 2013.
    Check things below:
    1. Check if you have set the item limit more than the display items in Presentation section of the web part. If the item number more than item limit, the rest items will not show.
    2. Check if the item you cannot find uses the content type you have set in the content type section of content query web part.
    When you edit the properties of the item, you will see the content type the item is using.
    Best regards
    Sara Fan
    TechNet Community Support

  • Non-valuated Goods Receipt for Purch.Order Item with multiple acct assgnt

    Dears,
    i used multiple account assignment functionality based on percentage for purchase order item and the system forced the goods receipt as "Non-valuated Goods receipt".
    In this way i don't have FI-CO documents at Goods receipt; i got them only at Invoice verification. So i totally lose analysis on account "Invoice to Receive".
    Please, give me some suggestion if you know something in matter.
    Thanks in advance,
    Regards
    Enrico

    It means that i didn't set non-valuated goods receipt.
    The system automatically set the flag if more than one account assignment are used for one purchase order item.
    If happens that just one account asignment is used for one purchase order item then the goods receipt is still valuated.
    i didn't try so far with quantity instead of percentage but, anyway, i need to use percentage.

  • Best practice for TM on AEBS with multiple macs

    Like many others, I just plugged a WD 1TB drive (mac ready) into the AEBS and started TM.
    But in reading here and elsewhere I'm realizing that there might be a better way.
    I'd like suggestions for best practices on how to setup the external drive.
    The environment is...
    ...G4 Mac mini, 10.4 PPC - this is the system I'm moving from, it has all iPhotos, iTunes, and it being left untouched until I get all the TM/backup setup and tested. But it will got to 10.5 eventually.
    ...Intel iMac, 10.5 soon to be 10.6
    ...Intel Mac mini, 10.5, soon to be 10.6
    ...AEBS with (mac ready) WD-1TB usb attached drive.
    What I'd like to do...
    ...use the one WD-1TB drive for all three backups, AND keep a copy of system and iLife DVD's to recover from.
    From what I'm reading, I should have a separate partition for each mac's TM to backup to.
    The first question is partitioning... disk utility see's my iMac's internal HD&DVD, but doesn't see the WD-1TB on the AEBS. (when TM is activity it will appear in disk utility, but when TM ends, it drops off the disk utility list).
    I guess I have to connect it via USB to the iMac for the partitioning, right?
    I've also read the benefits of keeping a copy of the install DVD's on the external drive... but this raises more questions.
    How do I get an image of the install DVD onto the 1TB drive?
    How do I do that? (install?, ISO image?, straight copy?)
    And what about the 2nd disk (for iLife?) - same partition, a different one, ISO image, straight copy?
    Can I actually boot from the external WD 1TB while it it connected to the AEBS, or do I have to temporarily plug it in via USB?
    And if I have to boot the O/S from USB, once I load it and it wants to restore from the TM, do I leave it USB or move it to the AEBS? (I've heard the way the backups are created differ local vs network)>
    I know its a lot of question but here are the two objectives...
    1. Use TM in typical fashion, to recover the occasion deleted file.
    2. The ability to perform a bare-metal point-in-time recovery (not always to the very last backup, but sometimes to a day or two before.)

    dmcnish wrote:
    From what I'm reading, I should have a separate partition for each mac's TM to backup to.
    Hi, and welcome to the forums.
    You can, but you really only need a separate partition for the Mac that's backing-up directly. It won't have a Sparse Bundle, but a Backups.backupdb folder, and if you ever have or want to delete all of them (new Mac, certain hardware repairs, etc.) you can just erase the partition.
    The first question is partitioning... disk utility see's my iMac's internal HD&DVD, but doesn't see the WD-1TB on the AEBS. (when TM is activity it will appear in disk utility, but when TM ends, it drops off the disk utility list).
    I guess I have to connect it via USB to the iMac for the partitioning, right?
    Right.
    I've also read the benefits of keeping a copy of the install DVD's on the external drive... but this raises more questions.
    Can I actually boot from the external WD 1TB while it it connected to the AEBS, or do I have to temporarily plug it in via USB?
    I don't think so. I've never tried it, but even if it works, it will be very slow. So connect via F/W or USB (the PPC Mac probably can't boot from USB, but the Intels can).
    And if I have to boot the O/S from USB, once I load it and it wants to restore from the TM, do I leave it USB or move it to the AEBS? (I've heard the way the backups are created differ local vs network)
    That's actually two different questions. To do a full system restore, you don't load OSX at all, but you do need the Leopard Install disc, because it has the installer. See item #14 of the Frequently Asked Questions *User Tip* at the top of this forum.
    If for some reason you do install OSX, then you can either "transfer" (as part of the installation) or "Migrate" (after restarting, via the Migration Assistant app in your Applications/Utilities folder) from your TM backups. See the *Erase, Install, & Migrate* section of the Glenn Carter - Restoring Your Entire System / Time Machine *User Tip* at the top of this forum.
    In either case, If the backups were done wirelessly, you must transfer/migrate wirelessly (although you can speed it up by connecting via Ethernet).

  • Best practice for setting up iCloud with multiple devices using a single AppleID

    Hi there
    Me and my wife have an iPhone each, and are looking at getting both of us using iCloud. The problem is that we only use one Apple ID for our music library.
    Is getting a separate Apple ID necessary for each device on iCloud, or can multiple devices have seperate settings/photos/music, etc.?

    Using different Apple ID for iCloud is not necessary, but in most cases it is recommended.
    You can however choose to use separate Apple IDs for iCloud and continue to use the same Apple ID for iTunes, thereby being able to share all your purchases of music, apps and books.

Maybe you are looking for