Jump to content

bbean

Members
  • Posts

    258
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by bbean

  1. Why, for example does the "Return Settings" need file terminals? How could we tell the wizard to not wire and create those terminals for that enum?

     

    "Return Settings" doesn't need file terminals.  If you look at the code I added to delete terminals, I use a very rudimentary approach where I check to see if the case selector tunnels are wired to anything in the case structure and delete the controls with the same name as the tunnels that are unwired.  Its crude and probably not very robust at this point.  

     

    I agree with you concerns about code bloat which is why I dislike polymorphic VIs.  Would there be a generic way to do this with an Xnode FGV wrapper that goes through similar operations as hoovahs script, but self creates its inputs and outputs based on the case (enum) you selected from the Xnodes menu item?  Would it be worth it?  Or do you just transfer the complexity to the scripting environment where the potential for mistakes (and code errors) is more likely and less transparent?

  2. However, I think the reason why my code is inefficient is because I am stopping and clearing every time in my while loop. 

    Yes

     

     And my stop button logic has way to many not gates I could probably combine it into one not gate and send that out to multiple writes.

     

    Is that something that would fix my inefficiency? 

    No

     

    Use a DAQ Assistant (1 for each device) in a loop.  Its a beginners friend (and sometimes advanced users).  It automatically sets up things for you so you don't have to worry about starting and stopping every loop.  If possible write to the whole port at the same time.

     

    Hint:

    post-549-0-59932200-1436994029.png

    • Like 1
  3. Your "final" looks cleaned up to me.  Sure the terminals aren't quite right, and wires are a bit long, probably indicating that the terminals are added after the code generation (just a guess not sure XNodes actually do this).  But you don't have wires on top of each other like the first image.

     

    Since this XNode lives in the VI that calls it, and is pretty much inlined as far as we can tell, the terminals are probably added when you right click the XNode to look at the generated code, and before then an interface to the XNode is this nebulous thing (at least to you and I).

    That makes sense. Thanks for the help.

  4. hoovahh I implemented the same operation as your subvi and it did not appear to work when I looked at the generated code.  So I went back and created some debugging code to get the block diagram image before and after cleanup to compare to the final code:

     

    post-549-0-53356600-1436466343.png

     

    The result of probing these images is that it appears block diagram cleanup occurs but then gets lost:

     

    Before BD.Cleanup:

    post-549-0-66771900-1436466406.png

    After BD.Cleanup (just what I want):

    post-549-0-44890400-1436466406.png

    Final "Generated Code" (somewhat crapified)

    post-549-0-23841800-1436466406.png

     

    The only other thing that happens after the Generate Code Ability VI is that I do an  "Update Image" (calls the Image Ability).  Could this cause the diagram to get screwed up?

     

  5. Rookie question here.  I'm getting lazy and don't want to click the cleanup diagram button when I'm debugging generated code in the Xnode.

     

    Is there a way to clean-up the Xnode diagram with scripting?  I tried putting some cleanup commands on the diagram reference in generate code ability, but I'm guessing the code is not actually generated until after this VI is completed.  Or maybe I'm doing something wrong.  Is there another ability that can run after the code is actually generated where I can cleanup the diagram for debugging purposes?  

     

    post-549-0-29836000-1436455306.png

     

    • Like 1
  6. Tnx for the reply :)

    So if i understand correctly. I still use consumer producer. In the producer there is only DAQ blocks that fill up queue. In the consumer loop i can than use circular buffer and later save the data?

     

    You can still have a producer/consumer loop if you want.  The nice thing about Hoovah's circular buffer is that its DVR based so you could spit the wire and read the data in parallel if you want.  

     

    I haven't seen your code and do not know how you want to trigger the save data.  Do you need to analyze the whole buffer every iteration to determine whether to save or are you doing something like just triggering on a rising edge level and only need to look at each daq read chunk?

     

    You can probably do all the DAQ reading/triggering/saving in a single loop if you use pipe lining.  But I can only speculate unless you attach code.  A crude example using the Circular Buffer Demo.vi as a starting point:

     

    post-549-0-57900900-1435669334.png

  7. The easiest way to do this is just the replace “States on back†with a User Event message to oneself, but with a little sophistication one can create reusable subVIs that either do a delayed User Event or set up a “trigger source†of periodic events.  Here’s an example of a JKI with two timed triggers:

    attachicon.gifPeriodic Triggers with JKI statemachine.zip

     

    Very impressed with the simplicity and elegance of that timer solution.

     

    <possible thread hijack>

    Along the same lines....do you guys ever use the DAQ Events functionality within the JKI state machine in the same manner?  eg using the DAQmx events along with a daqmx read in the event structure similar to LabVIEW example:

     

    \examples\DAQmx\Analog Input\Voltage (with Events) - Continuous Input.vi

     

    Or are the downsides to reading daq at high speed in an event loop outweigh the potential benefits?

     

    post-549-0-71469700-1434569873.png

  8. Hi bbean,

     

    Thank you for your reply. Quick question before I try this, wouldn't this not work since the data flow will be in the Wait to Scan Complete while loop? If I press the Stop button, the event structure will not operate because I am stuck in the while loop.

     

    I would need to stop the while loop, prior to moving on to the event structure. Please correct me if I am wrong.

     

     

    The event structure is in a parallel loop (just like your consumer loops) with a branch of the VISA session going to it after your initialize.  The event loop will be waiting for an event (in this case the stop button press).  

    When you press the stop button it will fire an event , in that event you would execute the VI I attached which should kill the VISA session, which will cause an error in the Read VI (unlocking it) in your loop where you currently have the stop button control wired up.

  9. Not sure this will work, but try using the attached VI in a parallel while loop with an event structure and event case for stop button value change.  Its just a wrapper around the viTerminate function in VISA.

     

    Also put a sequence structure around the current stop indicator and wire the error wire from just above to the new sequence structure to enforce dataflow to the stop button.  This way it will read the correct value after the event structure fires.

     

     

    In terms of your idea with the timeout, I would like the hardware to do the counting of 15 minutes not the software.

     

    Not sure why you would do this but if its your preference then go ahead.  As you can see its causing you problems

     

     

    I am leaning towards modifying the subVI and constructing my own algorithm to read the buffer of the hardware.

     

    Don't waste your time.

    VISA Abort Pending Calls.vi

  10. The last time I did data acquisition that required start triggering (ai/StartTrigger) was 5 years ago in a LV8.6 application.  I seem to remember that the dataflow would pause at the slave's DAQmx Start Task.vi until the master arrived at its DAQmx Start Task.vi, then each task would proceed to their DAQmx Read VIs.

     

    Fast forward to LV2014 where I'm trying to help someone on another project get DAQmx start triggering working.   In LV2014, the process appears to operate differently and the slave's DAQmx Start Task.vi executes without pause and continues to the DAQmx Read.vi where it doesn't return data until the master AI input starts.

     

    Did something change or am I growing old and developing dementia?

  11. I can't really tell from the NItrace or code.  Do you have the manual that describes the wakeup protocol that you could also attach?

     

    Is the touch panel a "real" serial port  or a USB to serial converter?

     

    One problem I've had in the past with USB comm (or USB->serial com) was with the OS sending the USB ports to sleep.  Not sure if it could/would be able to do this on a "real" COM port.   Check the Advanced Power Settings in Control Panel\All Control Panel Items\Power Options\Edit Plan Settings and disable this everywhere.  You may also have to disable something in the BIOS.  The worst part about the USB sleep feature is that the more efficient you make your program the more likely the OS is to power down the USB port. 

  12. As a work around, what if you open with Option set to x100?  it seems to release memory then.  I don't know if its bad form or opens another can of worms to open with "Prepare to call and collect"  but never collect. The documentation seems to indicate so.  

     

    Quote:

    If you use this option flag (x100), you must include one Wait On Asynchronous Call node for every call that you begin with a Start Asynchronous Call node to ensure that LabVIEW does not retain any started calls in memory indefinitely.

  13. For me the event structure is in a state machine, and after getting an event will go and o what it needs to.  During this time the UI is no longer locked and will respond.  So one solution is to make the code in the event structure very minimal so it locks the UI but only for a fraction of a millisecond. 

     

    Obviously this depends on the circumstances, but what mechanism do you use to execute the "do" portion of code that could hold up the event structure?  Do you just pipe information into a parallel queued state machine or actor?  Is there a post on lavag or on the darkside that lays out the benefits or pros and cons of this (using user events) vs just directly piping the "do" into a separate parallel queued state machine queue?  

  14.  

    Once you have an image inside an IMAQ ref. Never, never manipulate it outside of IMAQ (use only the IMAQ functions like copy, extract etc). Going across the IMAQ boundary (either direction) causes huge performance hits. As AQs signature states "we write C++ so you don't have to".

     

     

    What type of performance hit would you expect manipulating pixels using IMAQ ImageToEDVR and an IPE?  Curious as to the difference between an algorithm implemented with this technique vs a c DLL call, but I'm not near a development environment with Vision.

  15. All three solutions have similar performance in all my scenarios, except when I limit consumer loop to a 25 Hz,  in this case producer in 1. is also limited at 25 Hz. Trivial solution shows image corruption in some cases.

     

    Except this case, I never see producer loop being faster than consumer, they both stay at roughly 80 Hz, while it has some margin: when I hide display window, producer goes up at its max speed (200 Hz in this benchmark). When CPU is doing other things, the rates go down to the same values at the same time, as if both loops were synchronized. This is quite strange, because in both 2. and 3. producer loop rate should be independent from consumer.

     

    Consumer really does only display, so there's no reason it would slow down the producer like this... Everything looks like there's a global lock on IMAQ functions? Everything is shared reentrant. Producer is part of an actor, execution system set to "data acquisition" and consumer is in the main VI.

     

    Are the Matrox dll calls thread safe? Are you making any dll calls in your image processing? Is it possible they are executing in the user interface thread?

    • Like 1
×
×
  • Create New...

Important Information

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