First attempt at Producer Consumer Architectu​re: continuous read and dynamicall​y update parameters​.

Hello,
I am currently working with two instruments; an Agilent E3646A and an NI 6212 BNC. My objective is to have the 6212 to be continuously taking measurements according to predefined parameters while the E3646A's parameters can be continuously updated. This simple instrument combination is intended to help me learn the necessarry achitecture; continuous measurement, dynamic output control, and more instruments will be added in the future.
I've previously posted on a similar, but more complicated, setup (http://forums.ni.com/t5/Instrument-Control-GPIB-Se​rial/Split-second-lag-when-controlling-two-instrum​... and was advised to try the Producer Consumer Architecture. I've found relevant literature on the site (http://www.ni.com/white-paper/3023/en/, https://decibel.ni.com/content/docs/DOC-2431), searched the forums and constructed my own VI. While my first attempt at a Producer Consumer Architecture has resolved some of the issues I was having when I first posted on the subject, however, new issues have arisen with regard to reading and stopping the VI.
I am currently able to run the VI and update the device parameters. Previously, I would get a freeze while the instrument was being updated and could not toggle parameters until it was done. This has been resolved although the read only updates when a parameter has been updated although it is outside of the event structure. Furthermore the Stop button does not work in any context. I've also gotten occasional errors regarding the Deqeue Element but the bulk of the trouble is Error -200279 "Attempted to read samples that are no longer available" at DAQmx Read. I realize that there is a problem in my Producer Loop but haven't been able to figure out how to resolve it.
This is my first attempt at a Producer Consumer Architecture and already I can see that it is a powerful tool. I read as much as I could and looked at the relevant examples but expected to have some issues in the beginning. Would really appreciate any advice so I can take full advantage of the architecture.
Hope to hear from you,
Yusif Nurizade
Solved!
Go to Solution.
Attachments:
DCe3646A_DAQ6212_Prod_Con_4_13a_2014.vi ‏89 KB

Jon,
Thank you for the response and the suggestions.
I created the Local Variable for the Stop Button and moved the original into its own Event Case. It is now able to stop VI execution although I get Warning -1073676294 which I understand to be the buffer issue. The warning says that this was incurred on VISA Open for the E3646A's Initialize VI which is outside both loops, however, which I don't understand.
I tried increasing buffer size by decreasing the Number of Samples as per suggestions I found on NI forum threads. I've brought it down as low as 1 but the graph still only updates when an Event occurs and I keep getting the same buffer error. You suggested that the problem could be that they are in the same loop; does this mean that the DAQmx read should be outside both Producer and Consumer Loops or moved into the Consumer Loop? I found a couple of links ( http://forums.ni.com/t5/LabVIEW/Producer-Consumer-​Design-Pattern-DAQmx-Event-Structure/td-p/2744450 ,  http://forums.ni.com/t5/LabVIEW/Producer-Consumer-​Architecture/td-p/494883 -first response) on dealing with an Event Structure that my own VI is based. Alternatively, I found another link ( http://forums.ni.com/t5/LabVIEW/Producer-Consumer-​Design-Pattern-DAQmx-Event-Structure/td-p/2744450 - first response) on a DAQmx Read with an Event Structure that places the graph in the Consumer Loop.
The core of my purpose in setting up this Producer Consumer Architecture is so that I could read continuously while the instrument parameters are updated dynamically so it's very important that I understand how this works. I am particularly struggling with how the Event Structure is controlling the While Loop's Execution.
Hope to hear form you,
Yusif Nurizade
Attachments:
DCe3646A_DAQ6212_Prod_Con_4_14a_2014_Edit_I.vi ‏90 KB

Similar Messages

  • Producer consumer architectu​re functional​ity

    I was wondering if the consumer loop in a producer consumer architecture only works when the producer loop sends something to it, or is it always working, even if it doesn't receive anything from the producer loop?
    Solved!
    Go to Solution.

    In a "pure" producer/consumer, there is no timeout on the queue.  So as long as there is no data waiting in the queue, the Dequeue Element will "sleep" until the is data available.
    As Greg stated, if you have a timeout, then the Dequeue Element will "sleep" until the timeout is reached (assuming no data is available during the timeout time).  There is an output of the Dequeue Element that will tell you if it did timeout.  This is sometimes useful if you want to pull an instrument every so often or keep an ethernet port active.  But that is getting more into the Queued Message Handler than a Producer/Consumer.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • PCR isn't producing values -- it's being read and shows in the log

    Hi,
    I'm having problems with a PCR,
    it is being read (all of the lines show in the payroll log)
    Processing
    /102 401(k) Wages
    Rule   ESGPCR VaKey    Operation
    ZSUP      *            ADDWT&SUPC
    ZSUP      *            AMT=&SUPY
    ZSUP      *            AMT?I401KS
    ZSUP      *   *        AMT+&SUPC
    *ZSUP      *   *        ADDWT&SB1*
    ZSUP      *   *        AMT?I401KS
    ZSUP      *   * *      ZERO=
    ZSUP      *   * *      AMT=&SUPY
    ZSUP      *   * *      AMT+&SUPC
    *ZSUP      *   * *      ADDWT &SBF*
    ZSUP      *   * *      FILLF NRA
    ZSUP      *   * *      NEXTR A
    ZSUP      *   * *      ADDWT *
    but a print of the VAR table immediately following this only shows the first variable addwt
    PRINT NP   VAR
    Output
    Table VAR
    WType    Rate                   Number                 Amount
    SUPY                      0.00                   0.00              80,571.08  (comes from an earlier PCR)
    SUPC                      0.00                   0.00             199,680.00
    Why isn't it calculating the rest of the rule?
    Also the second ZSUP      *   *        AMT?I401KS shouldn't follow the * path, it should go to the > path as 199680+80571.08 > 245,000.
    I've tried backing out and re running payroll to see if it's confused, to no avail.
    I'm confused, help would be greatly appreciated.
    Thanks in advance!
    Stephanie

    Hi,
    I'm having problems with a PCR,
    it is being read (all of the lines show in the payroll log)
    Processing
    /102 401(k) Wages
    Rule   ESGPCR VaKey    Operation
    ZSUP      *            ADDWT&SUPC
    ZSUP      *            AMT=&SUPY
    ZSUP      *            AMT?I401KS
    ZSUP      *   *        AMT+&SUPC
    ZSUP      *   *        ADDWT&SB1
    ZSUP      *   *        AMT?I401KS
    ZSUP      *   * *      ZERO=
    ZSUP      *   * *      AMT=&SUPY
    ZSUP      *   * *      AMT+&SUPC
    ZSUP      *   * *      ADDWT &SBF
    ZSUP      *   * *      FILLF NRA
    ZSUP      *   * *      NEXTR A
    ZSUP      *   * *      ADDWT *
    but a print of the VAR table immediately following this only shows the first variable addwt
    PRINT NP   VAR
    Output
    Table VAR
    WType    Rate                   Number                 Amount
    SUPY                      0.00                   0.00              80,571.08  (comes from an earlier PCR)
    SUPC                      0.00                   0.00             199,680.00
    Why isn't it calculating the rest of the rule?
    Also the second ZSUP      *   *        AMT?I401KS shouldn't follow the * path, it should go to the > path as 199680+80571.08 > 245,000.
    I've tried backing out and re running payroll to see if it's confused, to no avail.
    I'm confused, help would be greatly appreciated.
    Thanks in advance!
    Stephanie

  • When I click on retrieve update, It continues running and never retreives update, why?

    I have never been able to update firefox, because it can't. retrieve the update. When the box appears and click on update, It runs and runs without succeeding. When I have tried to get help with this problem before, there was no response from firefox. What to do????

    If there are problems with updating or with the permissions then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the disk image (dmg) file to the desktop
    * Firefox 6.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the Firefox Profile Folder, so you won't lose your bookmarks and other personal data.
    * http://kb.mozillazine.org/Profile_folder_-_Firefox

  • Producer consumer loop

    I have a Producer consumer loop that is  reading in data from a Excel File call sample1. There is a third party software that constantly writes data to the same excel file Sample1 every _ amount of seconds. Every time the Third party software writes it will over write the excel file data. So it may only be 5 columns and 3 rows.
    1. I need to make sure that there is not a conflict when the Third party software has the file locked to read and Labview is trying to read.
    2. I need to make sure  that if labview isn't reading and reading before the Third party software writes so basically i need some way of checking labview isnt reading the same data twice i need to make sure the file has been updated before it tries to read again. The problem comes in when you can't regulate the time that the third party software reads.
    Solved!
    Go to Solution.
    Attachments:
    VI snippet (2).png ‏123 KB

    I've had to write code for similiar applications.  It is tricky.
    Have a look at the .NET FileSystemWatcher.Changed Event.  This might be a good way to monitor what is happening with the file.
     Take a look at this post: http://forums.ni.com/t5/LabVIEW/My-First-Nugget-Directory-Changed-Event/m-p/1407552/highlight/true#M...
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal

  • Event producer/consumer

    hello,
    i'm trying to study the differents existing structures (event, state, semaphore ...)
    the first is event producer/consumer and i don't succeed to display queue infos it's ok for size queue but not max and
    array of elements, what can i do to make it visible ?
    another question, where can i find basics examples ( but realistic) using event P/C, event p/c state machine, semaphore, rendezvous, occurence, dynamic regitration .....
    if you can reply even just one of  requests it would be nice
    Best regards
    Tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte

    hello bis,
    I just come to find the return element option , but for others questions it's still on air
    tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte

  • Producer/consumer w/ScanEngine issue

    All,
    I have a large VI implemented with producer/consumer architecture using 10 events and uses conditional disables to select the data acquisition hardware.  The application is being developed in LV2009 with FPGA & RT on XP.  The application is intended to acquire and control analog signals in a cRIO-9073, but early development is done using LV simulated signals.  I can switch back/forth between the different configurations quickly & easily.  In the simulation mode, the front panel, controls, events, etc; all behave as one would expect.  When the conditional disable is changed to use ScanEngine and cRIO modules, then a very primary control fails to generate an event and does not function.  All other controls that can be tested are functional and generate their events.  I am at a loss and seeking suggestions on techniques to diagnose & fix the problem.  The application behaves as if the 'event structure' for primary control gets corrupted or some size threshold is been exceeded.  The whole concept, scanEngine based and simulated data, were functioning several days ago prior to numeruous edits and I can revert back to not using the scan engine and cRIO hardware with simulated data to validate correct function, but that is not the intended final path.  At the present time, I am stuck and looking for ideas.  All suggestions will be considered and appreciated.  The applicatiion is company proprietary and can't be posted.  Thanks in advance.

    I can definitely understand your confusion, and on the surface it seems like everything should transfer over.  However, when using simulated data you won't get errors that can occur once you introduce hardware.  Errors can prevent events from occuring, there is also the issue of timing, to see if when using actual hardware, the timing causes issues.  As I menationed before, there are a hundred different reasons why it would work with simulated data, but not actual hardware.  Please let me know if you need further direction in your troubleshooting.
    National Instruments
    Applications Engineer

  • Producer/consumer state machine

    Hello,
    I have a State Machine with an Idle state that has an Event Structure to handle user events in it. I would like to include in that state, and in parallel with the Event Structure, a VI that polls for data every 10 seconds. Is there a way to have the Event Structure respond automatically to User events without having to wait 10 seconds before polling new data? Is the Producer/Consumer the way to go and how am I going to program this?
    Thank you,
    Richard
    Attachments:
    Tombeau_NewArchitecture1.vi ‏171 KB

    If you are polling for data (in the same state) in parrell to the event case then surely the event structure would execute at the same time you poll.. it would just not be able to jump to the next state in your state machine until the polling had completed.
    I had a quick look at your code, not to be mean but it's not the easiest thing to read. Try to keep the block diagram to a single screen so you don't have to scroll if possible. If that isn't possible, have it only scroll in one direction. You can achieve this with the use of Sub VIs.
    Also, be careful with using local variables to read and write. They are terrible for introducing race conditions. Instead trying using an FGV/Action Engine.
    Olly
    The day is quickly coming when every knee will bow down to a silicon fist, and you will all beg your binary gods for mercy.

  • WSRP Consumer - producer registration error : (100)continue return code

    I am trying to get an ALI WSRP Consumer working with the ALI WSRP Producer. Whenever I try to register the producer wsdl, the consumer fails with the error :
    Failed to get a service description from WSRP provider!
    Error message from WSRP provider: (100)Continue
    Any clues? I can successfully register this producer with a different portal's consumer. Is there a configuration property that needs to be set to allow the (100) response code? Or perhaps my Producer should avoid that response code in the first place? Has anybody run into this?
    Below is the stack trace generated by my consumer on the back-end (from ALI Logging Spy) :
    Failed to get service description from WSRP provider: http://scollins.sd.defenseweb.net:80/wsrpproducer1.1/1.0/WSRPBaseService.asmx
    AxisFault
    faultCode: {http://xml.apache.org/axis/}HTTP
    faultSubcode:
    faultString: (100)Continue
    faultActor:
    faultNode:
    faultDetail:
         {}string: return code: 100
    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Wed, 22 Apr 2009 23:31:53 GMT
    X-Powered-By: ASP.NET
    Connection: close
    X-AspNet-Version: 2.0.50727
    Cache-Control: private, max-age=0
    Content-Type: text/xml; charset=utf-8
    Content-Length: 3084
    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header><wsa:Action>urn:oasis:names:tc:wsrp:v1:getServiceDescriptionResponse</wsa:Action><wsa:MessageID>uuid:dc3a3069-320a-4a6d-a997-45313098bc00</wsa:MessageID><wsa:RelatesTo>uuid:c827c145-c82d-4958-a201-30e7a86c053b</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-18d05f2a-c5dd-4519-8d1d-24b68f27b9e5"><wsu:Created>2009-04-22T23:31:54Z</wsu:Created><wsu:Expires>2009-04-22T23:36:54Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><getServiceDescriptionResponse xmlns="urn:oasis:names:tc:wsrp:v1:types"><requiresRegistration>false</requiresRegistration><offeredPortlets><portletHandle>simple</portletHandle><markupTypes><mimeType>text/html</mimeType><modes>wsrp:edit</modes><modes>wsrp:help</modes><modes>wsrp:view</modes><windowStates>wsrp:maximized</windowStates><windowStates>wsrp:minimized</windowStates><windowStates>wsrp:normal</windowStates><windowStates>wsrp:solo</windowStates><locales>en</locales></markupTypes><description xml:lang="en"><value>Simple view portlet to test WSRP viewing</value></description><shortTitle xml:lang="en"><value>View</value></shortTitle><title xml:lang="en"><value>View Portlet</value></title><displayName xml:lang="en"><value>SimpleView</value></displayName><userProfileItems>UserProfileName/PropertyName</userProfileItems><templatesStoredInSession>true</templatesStoredInSession><doesUrlTemplateProcessing>true</doesUrlTemplateProcessing></offeredPortlets><offeredPortlets><portletHandle>helloworld</portletHandle><markupTypes><mimeType>text/html</mimeType><modes>wsrp:edit</modes><modes>wsrp:help</modes><modes>wsrp:view</modes><windowStates>wsrp:maximized</windowStates><windowStates>wsrp:minimized</windowStates><windowStates>wsrp:normal</windowStates><windowStates>wsrp:solo</windowStates><locales>en</locales></markupTypes><description xml:lang="en"><value>Hello world portlet to test WSRP viewing</value></description><shortTitle xml:lang="en"><value>View</value></shortTitle><title xml:lang="en"><value>Hello World Portlet</value></title><displayName xml:lang="en"><value>HelloWorld99</value></displayName><userProfileItems>UserProfileName/PropertyName</userProfileItems><templatesStoredInSession>true</templatesStoredInSession><doesUrlTemplateProcessing>true</doesUrlTemplateProcessing></offeredPortlets><registrationPropertyDescription><propertyDescriptions name="ConsumerName" type="xsd:string" /><propertyDescriptions name="BuildDate" type="xsd:dateTime" /></registrationPropertyDescription></getServiceDescriptionResponse></soap:Body></soap:Envelope>
    (100)Continue
         at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:695)
         at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:129)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2575)
         at org.apache.axis.client.Call.invoke(Call.java:2564)
         at org.apache.axis.client.Call.invoke(Call.java:2259)
         at org.apache.axis.client.Call.invoke(Call.java:2182)
         at org.apache.axis.client.Call.invoke(Call.java:1702)
         at com.plumtree.wsrp.base.WSRP_v1_ServiceDescription_Binding_SOAPStub.getServiceDescription(WSRP_v1_ServiceDescription_Binding_SOAPStub.java:857)
         at com.plumtree.wsrp.consumer.impl.ServiceDescriptionManager.getServiceDescription(ServiceDescriptionManager.java:118)
         at com.plumtree.wsrp.consumer.servlet.AdminPreference.renderSetRegistrationPage(AdminPreference.java:992)
         at com.plumtree.wsrp.consumer.servlet.AdminPreference.service(AdminPreference.java:117)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Unknown Source)

    This seemed promising, but the proposed solution (adding 'servicePointManager expect100Continue="false"' to Web.config) had no effect.
    My consumer request actually does not include the "Expect: 100-continue" header and receives the 100 response anyways. My understanding now is that this is okay (thought I'm not sure why) and that the client should be expected to handle that response code in any case.
    I am wondering if there is an issue with the combination of products in my environment that is not supported by this product?? I am using
    IIS 5.1,
    .Net 2.0
    AquaLogic WSRP Producer 1.1/WebCenter WSRP Producer 10.3.0 (tried both)
    I am testing this producer in two environments -
    - AquaLogic Consumer running on AL Portal 6.5. When the WSRPConsumer is configured with the producer wsdl, it fails with message "Failed to get service description from WSRP Provider: .... faultString: (100) Continue".
    - Liferay - AFTER successful registration, attempts to deploy my registered .Net portlet (simple hello-world) result in an internal exception thrown in the Producer [Bea.Portlet.Management.PortletManager.LoadPortlet(PortletManager.cs:line 114)] Error loading PortletContainer: Bad PortletState. No request is made to my .Net application.
    It appears from both of these tests that both my producer and consumer are having fundamental problems that do not seem overly exotic (although I have successfully registered other WSRP portlets with the AL Consumer). However, I have not come across much information on these sorts of problems.

  • I want to add one Continuous function in Producer consumer event??

    Hello,
    producer consumer event vi is base example for me ,I have design my system according to it.
    Now I am dealing with photo sensor in that its measure continuous data according to intensity of light,for continuous function I have make while structure for photo sensor but the problem is that I don't know how to add this while loop in producer consumer event ,if I add then its run continuously and then my operation is stuck there.
    Will you please guide me that how can I add this continuous function in this structure so simultaneously I can do other function like pause reset..Etc...
    Here in attachment I have attaché one example regarding to this in that I have add simply increment function in case structure and when I execute my vi then execution is stuck at while loop until it manually stop.
    Thank you very much...
    Attachments:
    ProducerConsumerEvents 1.vi ‏15 KB

    Hi AnkitRamani,
    I made a simple example with a UI queue and a second producer which is pushing data into its own consumer, displaying the signal and its spectrum.
    Maybe this is what u need.
    Marco Brauner NIG
    Attachments:
    ProducerConsumerEventsData.vi ‏70 KB

  • Producer/Consumer(Events)

    I am trying to practice using Producer/Consumer(Events) design pattern.  In the attached VI I'm trying to control 3 LED's using front panel controls.  I'm not sure how to extend the time that the LEDs remain lit.  My first guess would be to continue queing a given state until a timer expires.  But, from what I understand, it's not good practice to add to the que in both the producer and consumer loops.  Any advice will be appreciated.  Also, is there a possibility for a race condition in the way I terminate the program on STOP?
    Thanks in advance.
    Attachments:
    Prod_Cons Lites.vi ‏16 KB

    VI Joe wrote:
    I'm not sure how to extend the time that the LEDs remain lit.
    You could use the timeout of "dequeue element" and reset to false after the timeout or after another button is pressed. You don't need the wait state.
    Also make sure to make the enum into a typedef, else this will be difficult to maintain once you want to modify the possible states.
    VI Joe wrote:
    Also, is there a possibility for a race condition in the way I terminate the program on STOP?
    No, that looks OK.
    Here's a quick draft. In order to eliminate case bloat, I would combine the color events and simply check which one got pressed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Prod_Cons LitesMOD.vi ‏13 KB

  • Producer Consumer with a state machine within the consumer

        Hi All,
    I have been trying to develop a data acquisition system with the producer consumer architecture.  To the left of the two main loops I initialize the serial port and any constants and variables im using.  I also have an obtain queue VI needed for enqueue and dequeue. Then in the producer loop i have a state machine.  The first state is where I wait for a button press on the front panel to write a GO signal on the serial line which will tell the device connected to the serial port to begin sampling data.  After this button press I go into the next state which is called my read state.
    In the read state I use a property node to read all of the available bytes at the serial port and then enqueue this collected data into a queue.  The state machine then is directed to continously go to the read state again and collect more data.
    Now this is where my dilemma is......  The consumer loop has the dequeue VI inside it and after this VI i have a state machine (while loop and case structure) which contains the following states
    1.  Build Array - build an array from the dequeue element and if there is any left over data from the parsing states it will build an array with the left over data and the dequeued data
    2.  Determine packet type - this state looks for the packet type byte(not necessarily the first byte in the message) and also check the next byte (packet length) to ensure that I am at the begininng of this chunk of data.  This state may be a little slow because there can be three different packet types and based on this byte and the packet length it may have to search the array several time to find the valid starting point.  This state also determine the next state to go to based on the packet type.
    3 packet type 1 parsing - parse data and store the remaining data it leftOver array.  Go to exit state.
    4 packet type 2 parsing - "" ""
    5 packet type 3 parsing - "" ""
    6 exit - leave this state machine and fall back to the consumer while loop.
    After it exit I think it should fall back to the consumer while loop and dequeue more data and enter the state machine again to build a new array with the dequeued data and leftover data.  It seems to work when I trace the execution using the Highlight execution feature, however when I run this all at full speed, it seems to go into the consumers 1st and 2nd states back and forth and not completely go through the state machine.
    I tried adding in a delay in the producer loop to give the consumer loop time, but I didnt notice any difference.  Is it possible that my dequeue element is retreiving more data while im still in the state machine, causing the execution to leave the state machine before it finished all states?
    Is there a better approach to take to solve this problem. Basically I need to read data at a 1,000,000 baudrate and parse it as quickly as possible so that I can break it up into 3 different packet types, write the data to a file, and graph the actual data (header info removed) in realtime.  I need to also ensure that I am not losing any of the collected data.  Data loss cannnot occur.

    A couple of things more to go along with Ben's pointers:
    You convert your data from a string, to a U8 array, to a Hex string array in the producer loop, then convert back to a integer to determine what to do with it.  In the process, you create two or three copies of your data, slowing yourself down quite a bit.  The code would be quite a bit more efficient if you left the data as a U8 array.  You can change the format of the controls and indicators to show hex values instead of integer by right clicking on them and selecting Format and Precision...
    Your search code is fairly inefficient.  I made a whack at making it a bit better.  See attachment below.
    If you continue to run into race conditions, you can debug them using a calls to the Windows debug write sprinkled liberally about your code.  Check out the post here for more information.
    Don't let your lack of format LabVIEW training stop you.  The biggest thing to get is the data flow paradigm (aka data is wires, not registers).  Once you get past that and learn how to pass data around using shift registers, queues, events, etc, you are most of the way to mastering LabVIEW.  The rest is just learning the plethora of functionality LabVIEW gives you (yes, I have reimplemented LabVIEW native code more than once in the process of learning).
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    serialUtil_V3_DFG.zip ‏137 KB

  • Producer/consumer architecture over network variables with Real-Time target.

    Hi all,
    I am maintaining a producer/consumer data acquisition program to be deployed on a real-time target. The main code is deployed to and run on the real-time target during experiments, but was having trouble because the program was originally designed to write all experimental data to disk on the real time during acquisition, which puts the whole experiment at the mercy of the hard drive. I am now trying to rework the code so that the host takes care of logging, so that my time-critical loops don't have to wait.
    I am currently using LabVIEW 8.5
    I have two questions:
    First, how can I programmatically call the data-logging subvi on the host so that it runs in parallel with the main vi which runs the experiment and collects data on the real-time? I have attached the test code that I have been working with to figure this out, but it does not run the logging vi continuously in the background. I am aware that there is better functionality for this in newer versions of LabVIEW, but I would prefer not to upgrade unless there is no other option. I would like to be able to run my data-generating vi and have it start the data logging remotely.
    Second, is there a way in the host VI to read values off the network variable using an event structure rather than polling it for updates?
    Any help would be sincerely appreciated!
    Attachments:
    testRemoteLogging.zip ‏124 KB

    VI server
    Mark the target VI as served on the machine on which it will execute and use VI server Call by reference to invoke the served VI.
    This used to be taught as THE way to communicate syncronously with an RT app.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Insert a DAQ assistant in producer consumer vi

    Hi,
    I am using a DAQ assistant to receive the measurements in the 10 digital ports.
    Hence I use the DAQ assistant icon in the vi s to get these data in to labview.
    Now I require it to convert these digital values from DAQ assistant into analog( this i have done )..
    Thse analog values are to be taken one at a time for further processing.
    I am trying to use this produces consumer loop for it..http://decibel.ni.com/content/docs/DOC-2431
    however i dont know where to fit in the daq assistant .
    Do i still need the DAQ create channel , sample clock etc?
    or do i simply place my daq assistant in the place of the create channelDAQ icon?
    thanks for any help..
     iam completely confused as to what to do with it!!...
    Regards,
    ruser

    Hi,
    Thank you for the suggestions..
    i am sending one vi here..
    this is my basic vi which gets the data from the DAQ and converts it into data ( angular info) we require ie angular position data of lower and upper encoders. This is a continuous real time prcess, which will stop when we press stop in the vi.
    Now i want to take the a set of data (input and output) each, send it to a vi which will receive this set of data; process it and repeat this for the second set of data etc..
    I am also attaching the lvm file . which is the data we are saving now.
    The first attachment is the vi where i am getting the data.
    The second attachment is the lvm data file.
    Thanks.. I would appreciate any help here...
    ruser.
    Attachments:
    absolute encoder.vi ‏805 KB
    LabVIEW Measurement file.docx ‏17 KB

  • Producer consumer loop only execute once?

    Hello here,
    In my VI, the producer loop seems working continuously, but the consumer loop only execute once.
    I haven't used producer/consumer pattern before, could someone give me some ideas why this happens?
    My code is in attachment.
    Thank you in advance.
    Yaqiong
    Solved!
    Go to Solution.
    Attachments:
    parallel - Copy.vi ‏72 KB

    That would be the poor choice of using an event structure in the consumer loop.  As set up you must generate a mouse Leave or mouse enter event on Waveform Graph for the consumer loop to finish its first iteration. 
    Delete the event structure.  you don't need it to update a graph.
    Jeff

Maybe you are looking for

  • How to find every 3rd Friday?

    I have a column of consecutive dates that span multiple months.  A second column list the day name for the date.  How do I find every 3rd Friday of any month?  I'd like to have it display some text in a 3rd column next to the particular Friday. If th

  • Disabling LaserJet 100 color MFP M175nw as a wireless hotspot

    Hello Bought HP LaserJet 100 color MFP M175nw. It announces ( broadcasts) its wireless network HP-Print-74-LaserJet100. Which interferes with my other wireless network, and makes quality of signal lower. Is it possible to disable wireless hotspot fea

  • Change color of pixels in a raster (png) image

    Hi, I have just begun using Illustrator CS6.  I have a very simple image (.png file) that I would like to annotate with some arrows and some text.  This file is what I guess you would consider a raster image (no vector graphics) that has a very limit

  • The New  PS CC Images / Size implementation

    Anyone else a little disconcerted by the new setup of 'Image/size' menu? Its lost one whole parameter that used to be there by default... Now you have to go find it by click on the drop down and selecting inches.... If I recall it used to show: heigh

  • How secure is master password?

    Hi I have very sensitive information on my iBook. I can choose master password after screen saver/sleep or FileVault. FileVault encrypts the info which I feel uncomfortable with as it may make it difficult to backup. Can the password be removed by a