the queue question

Hello

How can I know the number of times that an item has been placed or removed in LabVIEW?

Thank you

dphan128

Do one of the parameters was count of how many times it has been queued.  You will need to follow the count separately and pass it as a parameter.  You could also include a timestamp as a parameter to say when it has been queued.  If you cannot convey a parameter, to a cluster with the elements being your normal setting, County and timestamp.  You must write a Subvi survey that takes care of incrementing the account and update the timestamp.  Then call the Subvi instead of the survey function normal.

Tags: NI Software

Similar Questions

  • The queue from table question

    I had a recent application where I wanted to take 100 samples of something then get the RMS of the dara. This is happening in a loop, and until the end of the program. Very basic stuff.

    • Method of the QUEUE:
    • Get queues with max 100 items.
    • Queue data (data arrive on every 50mS).
    • Get the status of the queue when the number of items is 100...
    • ... Empty the queue and get all the items (which of course will be a prison guard) and use the RMS funtion.
    • Repeat

    ---------------------

    • TABLE method:
    • Initialize the array with 100 elements of the DBL 9999.99 (it is a value that can only happen in the data)
    • Insert data in the table to help replace a subset of table
    • When 100 index isn't 9999.99, then...
    • ... Put the table in the RMS function, then re - initialize the full array of the 9999.99
    • Repeat

    My questions are, who should be faster, including better management of memory?

    Thank you!

    Why not just use the RMS PtByPt VI. In this way, you don't need to store data at all? This may require that marginally more calculation, but will require less memory.

    If you insist on the pad, I'd probably go with the table for simplicity. I think you can simplify your system to determine when to treat well. No reason to have all these 9999.99 is here.

    Chris

  • Writing in the spreadsheet with the queue

    Hello

    I am a beginner with queues and I have a few questions.  I have attached a simple example of code that I wrote to better implement a consumer who can queue data and write on a worksheet after running the code.

    First of all, I noticed that the queue still has residual remaining after the code ends.  It then writes this element to the file to run the vi.  I can't figure how to get rid of this element.

    Second, anyone have any suggestions to improve this code?  I've been playing with it for quite some time and I finally got to work like that, but it is certainly configured differently from the other examples I've seen.

    Thirdly, I am reading the number of items in the queue, but the two in the loop of the producer and the consumer, told me that there is no element.  How can this be?  My output file seems to work and I certainly put items in the queue.

    Finally, in the future I'll use data from the queue in two places.  Here I've implemented a notifier to do the job.  This is the best method?

    Thanks for your help!

    Jason

    The reason why you do not get the last element of the queue (at least not until you restart the VI) is that you have your automatic indexation tunnel that collects all the data to send to the writing on file SS service cable for moving to register.  So this last piece of data from the queue to get into the shift register, but it is not getting into the 2-D chart by the tunnel of automatic indexing up to the next iteration of the loop.  When you rerun the VI, as the shift register is not initialized, it is already there and became the first point of your next data execution.

    Why did you put the register shift in?  Just remove and just use the tunnel of automatic indexation.

    I don't know what you really want to do with the 2nd loop to say if the Notifier is correct or not.  But if you do not want to lose data in the other loop, then you need to use a second queue and have your producer loop enqueue data in the two queues, a queue for each consumer loop.

    With regard to the elements draws in the queue, seeing how your code is configured, the queue will almost always empty because the dequeue function will be ready to pull out the element immediately after the enqueue function puts in.  Unless you have your loop producer much faster than your consumer loop running, you will not see a build up of the elements.  (Try putting an expectation of more of 100 msec in your loop of consumer.  Then you will see elements accumulate in the queue.)

    I don't know why you put the spreadsheet feature writing after the loop.  Normal use for queues in an architecture of producer/consumer must transmit the data to a separate loop that contains the functions write file.  This way he can work at his own pace, but write the data and make sure that you do not lose it.  As you have now, if your code runs a long time, you may run out of memory when at the tunnel of automatic indexing table becomes too large.  And if your application crashes before you complete it with your stop button, then all data are lost because you did not it writes the file.

  • Sequential simultaneous writing of the queue

    Hello everyone, nice day.

    I have what should be a very simple matter.

    I'm currently implemented a producer consumer-consumption-consumer architecture. (Loop acquisition > write disk acquisition > read data from disk data > display of the user based on the data.) In plain language, I have a created the data loop, a loop of these data, a loop of disc storage and a loop displays a user interface. (This isn't supposed to be a real-time application, and I am aware of the charge created by the writing and the reading of the disc). Just stick with me on this one.

    So my problem occurs concerning the second loop. This loop is responsible to write the data be queued (produced in the loop 'Acquisition') on the disk. The problem is also, feeds on a queue to the loop of "reading disc". This configuration causes a few obstacles. The main obstacle arising from the nature of queues of LabVIEW. The loop "write to disk" writes only a part of the queue of the 'Acquisition' at the same time. This general is not really a problem, until you consider that this loop also determines the execution of the loop of "reading disc", with the use of queues. As a result, this loop determines the rate of the next loop and was therefore likely to slow demand and leave a large number of items in the queue. In addition, you must keep in mind, I'm only queueing about 7 MB of data per element, and my HARD drive has a write speed average of 60 MB with a 64 MB cache. Therefore, my installation I can only write one item at a time, therefore making me use only 7 / 60MB of bandwidth from my drive.

    My question is; It be possible to have the loop "write to disk" write several items in the queue at the same time. I hope that I can write simultaneously enough items that I can use my bandwidth 60MO together writing and speed up execution of any sub routines that depend on data written to disk.

    I know there is probably best architecture for this application, but for the moment, I am limited to this architecture. If you have any suggestions for other architectures, I'm more willing to listen to, but coming back I am looking for a way to improvise simultaneous tail reads and then write them to disk with my current structure.

    Thank you all, thank you for the help.
    Taylor S. Amarel
    Learning is alive.

    You can put your element Dequeue function in a loop For and set N to a number so that you get several items from the queue at a given time.  Turn on indexing and you will have a table of data.  Write the table in its entirety on the disc.  This should speed things up a bit.  Don't forget to use shift registers for the sons of the error and the reference to the queue in the loop For and also put a little delay in the loop to stop 100 percent CPU usage.

  • Prevent the structure elements of the queue of the event?

    Is there a way to prevent a record structure and the queues of the events of the event?

    I have a state machine with a structure of the event in one of the States - the State is waiting for user input before continuing - and I wish that the structure of the event to recognize the events only when the program is in this State. I understand that the current method to catch all events is sometimes (usually) the desired behavior... Heck, I use it to my advantage most of the time. However, this is not one of those times.

    Here is a small example of my configuration:

    (See attachment. I guess that's too big for an extract VI, so it is a standard PNG image)

    The question that I have, is that the Structure of the continuous event of events Records even after pass to the next State. This means that if 'String' is changed at any time, the next time the queue of event happens in the state machine, all updates of the "chain" will run.

    So, how can I implement the code in such a way so that the events will be only intercepted and queue when the structure of event loop is running?


  • Buffer could replace the queue in the design of producer/consumer model

    Hello

    I have a question to which the task of buffer to store the data and the queue is also of the same thing so we could use the inplace queue buffer in a design of producer/consumer model.

    No, these examples of buffer not almost equal to a queue, and never "replaces" queue at the producer/consumer.

    The advantage the most important of the queues for the producers/consumers (which none of the other mechanics buffer sharing), it is that it works activities to warn the reader that the data is available. So if you would simply replace the queue by mechanics of tampon too developed that you have attached to your last post, you will lose a large part of the object using producer/consumer.

    Thus, to compare the two mechanics:

    -Tail works activities, while the example of the buffer is not.

    -Tail must allocate memory during execution if several items are written in that corresponding queue. This also applies to the buffer (must be resized).

    -Given that the buffer is actually simply a table with overhead, memory management becomes slow and messy with the increase in fragmentation of memory. Queues to play much better here (but have their limitations, there also).

    -Overload of the buffer (the table manipulation) must be implemented manually. The queue functions encapsulate all the necessary features that you will need. So the queues have a simple API, while the buffer is not.

    -Given that the buffer is simply a table, you will have a hard time sharing the content in two parallel running loops. You will need to implement an additional charge using data value references to manage the buffer or lose a lot of memory using mechanics as variables. Lose the memory, you will probably encounter racing conditions so don't think not even on this subject.

    This led to four '+' for the queue and only a single point where 'buffer' is equal to the queue.

    Hopefully, this clears things up a bit.

    Norbert

  • Reference the queue and sub - VI

    Hey everybody.

    Hope you can help me once again. What I need is actually advice, because my code works, it's just that the examples I see around the internet reminds that I could do better.

    So I use QMD inspired by the very nice guide to http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/. My question is how to create queue references so that the queue name in the beam by name. The only way I can make it work is by using the function queue to get then turning the queue to a package by name, with this strategy than the unbundle name said only: "queue outside. See attachment (1 VI and two typedefs that are required for the VI to run). Since I have 5 different queues it is tedious to remember in what order I closed the...

    In addition, in my example I didn't a sequence around my Subvi as they do in the guide. Just because my code works fine without. Can someone explain the usefulness of the structure of sequence?

    I hope you can help

    Atamsih

    Hello

    I couldn't open your VI I did not LV 2011. However, I checked the image you posted.

    some of the answers for you:

    the structure of sequence around the slot screws (bottom of photo) is to ensure that the two sub start screw chasing the value False is written in the local output variable. in other words, when the output is initialized with the value false, the while loop and two void screws begin to run.

    to get the names of queue in the cluster, the name just constants reference queue to the function of bundle with the names you want

    to get the structure of package on the front right of the image, simply create constants of all the items you want to group and wire bundle as

  • What is a good way to use the queues for the model of consumers/producers?

    Hi all

    I am following the model of consumers/producers to use the queue to synchronize the following process: the producer is a loop to produce a number N, I will put each number generated in a table and after each 5 numbers generated, I put the table in the queue and pass it on to the consumer. I have to wait the use by consumers of the data and it will then remove the item from queue so that producers will have the chance to produce another 5 numbers. As I put the maximum size of the queue one, I expect that the producer and the consumer turns to produce / consume all five numbers and the opportunity to another. Here is my code

    When the checkbox is false, the code will be

    For the first 5 numbers, product will generate every thing right and put it in the table, and it's going to pass the array to the quere so that the consumer will have the chance to loop through the table. I except the procude loop will continue only when the queue is available (i.e. all items are deleted), but it seems that once the consumer starts the loop loop of the product will continue (if the indicator x + 1 and x 2 will be changed to numbers). But this isn't what I want, I know there must be something wrong, but I can't say it is.

    dragondriver wrote:

    As you say in 1, sequency structure to enforce the order of execution, that's why I put it here, in this example, the simple question, I replace the complete code with increase in the number, in the real case, the first markers + 1 and + 2 must be performed in this order.

    Mikeporter says:
    1. get rid of all the structures of the sequence. None of them are nothing but apply a work order which would have been the same without them.

    So even if you delete the sequence structure, there will be a fixed & defined order and it is because LabVIEW follows the MODEL of FLOW OF DATA.

    Data flow model (more precisely in the context of LabVIEW): a block diagram node runs when it receives the required inputs. When a node is running, it produces output data and transmits data to the next node in the path of the data stream. The flow of data on the nodes determines the order of execution of the VIs and functions on the block diagram (click here for reference).

    Now in your code, just remove the sequence structure will not make you order will be going to stay the same, but you need to do some very minor changes (as thread of the error in loop, before that he go to the node "Élément Dequeue").

    Come to the main point: it's a good way to use the queue for the consumer/pmodel that?
    The model you are using (and qualifying as consumer/pmodel) is much too deviated from the original consumer/pmodel which model.

    dragondriver wrote:

    For the second, Yes, it's my fault for delete, though. I'm actually the example of model of producer/consumer design pattern, but I do not pay attention to the while loop in the part of the consumer.

    While loops (two producers & consumers) are the essential part of this architecture and cannot be deleted. You can start your code using standard model.

  • Exchange 2003 Server kept receiving unknown Email sending out through SMTP and the paper jam in the queue folder

    Hello Sir,

    I have a problem with one of my SBS Exchange 2003 servers.

    At first, I was getting a lot of 3008 errors for a non-delivery report with a status code of 5.0.0 was generated for recipient rfc822; address email is removed from the privacy * all these repeated error messages from the event log, SMTP and Exchange Routing service...

    I looked around and discovered more than 10000 .eml in my x:\program files\exchsrv\mailroot\queue folder.  At first, I thought that my server or one of my workstations was compromised, but all workstations have local antiviral software (symantec endpoint protection), my server software also has antiviral and I have a mail server antivirus (symantec endpoint protection).  I scanned all of the computers on the network and even tried almost all of them closing to see if new entries have been created in the queue.

    Unfortunately, more than entries kept by appearing so I kept looking.  By opening one of the .eml, I discovered my own responsibility that I attach to outgoing emails if I have my server acted as a mail relay.  I checked for this and I have been clean.  I kept searching in the .eml and discovered different origins IPs of the Internet.  Am I right to assume that my mail server is BOMBED or attacked with emails with false return addresses and my mail server sends return NDR for spammers/compromised machines on the net?  I tried to stop the exchange services and tried to rename the vsi file 1 to something else as one of the suggested MSKB, but the file was protected.  How can I stop this, it's slowing down my mail server and fill out my HD.  I can't block the IP to shippers because it comes from everywhere.  Help!  There are about 2 to 5 new .eml created every minute!

    TKS and best regards,

    LT

    Hi Lennet,

    Your question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please post your question in the forum TechNet for assistance:

    Microsoft Exchange Server

    Hope the helps of information.

  • Best practices using clusters to create the queue/notifier/bundles?

    I'm in a block diagram, a queue, the notifier and several instances of cluster of bundle

    that all use the same data structure.   There is a typedef of cluster for the data structure.

    Of course, each of these objects (define the queue, set notifier, bundle)

    you want to know how do you define the cluster.

    What is considered best practices?

    (1) create a dummy instance of the cluster across data structure

    definition is necessary (and hide all on the public Service)

    (2) create only one instance and son at all places, it is necessary

    But there is no stream on this thread: it's only the cluster * definition *.

    which is used, so this seems to clutter the comic.

    (3) create only one instance of the cluster control and use local variables

    everywhere else the definition of cluster is required.  It's _value_ is never

    assigned or given read-so no problem with race conditions.

    (4) another way?

    If you were to clean up someone else's code, how do you expect

    See this Treaty?

    It occurred to me during this writing that here where I

    "unbundle...... code bundle" I could wire the original beam to the

    the two "unbundle" and "bundle" - but that would be too complicated

    and the size of the comics with useless thread?

    Thank you and best regards,

    -- J.

    Hi Jeff,

    I think that this question is about "sharing" the typedef and not how share data (?)  If the cluster control is registered as a typedef (or a strict typedef) but NOT SIMPLY as a CONTROL, then when a Diagram-constant of the typedef is created, it will be updated when you update the .ctl typedef!  (and there is no FP control to hide )  Of course if the typdef is already available "close" if necessary, you will be able to use instead - save a spacer of diagram.

    See you soon.

  • effectiveness of the queue

    So, I'm working on improving the efficiency and speed of my system of producer-consumer. I have two producers and a consumer (which, among other things, writes files to disk). I currently have two producers supplying the a queue which is then processed by my currently single consumer. Each item in the queue is a grouping of several types of data and contains everything you need to "consume." There are some cases where more complex queue items placed which take longer to treat and slow the process of consumption. I add a second consumer loop to run in parallel with the first to take the weight off the loop so to speak. My question is, it would be more effective to have both made consumers in the same queue, or would it be more effective to have each producer to feed its own queue. For the sake of the exercise assumes that I can guarantee you that the elements of the queue complex will come only from a particular producer.

    It is difficult to give a good answer without really knowing what is happening in your loop of consumer.  Order matter?  Some of these processes can actually be done in parallel?

    My first suggestion would be to make another loop (and corresponding queue) just for writing the disk.  Because that tends to be a "slow" process anyway, it should help releive your loop of consumption at least a part.  But, still, I do not know what that your orders 'complex' need you.

  • Structure of the event does not clear the queue after his release from the Subvi

    OK I'm not sure if this is a stupid question or not...

    I was trying just a few tips and stumbeled on this problem...

    So I created a sample (not exactly)

    In qqq_Main.vi just press PressMe

    (it opens a Subvi qqq.vi)

    There are two buttons to stop "Alt1" and "pylone2".

    To close the Sub - VI press either on "pylone2".

    or press "Alt1", then "pylone2".

    with the latter method of the value of closing change pylone2 is registered outside the while loop and after the closure of the Subvi should not it be erased? (Or should manually clear us it?)

    For this reason not clear, the second time I press 'PressMe' change the value of pylone2 even goes off before you press anything

    I can't look at your code at the moment, but according to your description, it seems that the system works as expected. I guess you do a completely static record of events (open the event configuration dialog box and select the controls and event).

    The first thing to clarify is your use of the term "registered". In this case, it's a problem, because the registration in the context of the protests means asking to receive the event when it happens.

    Now that you know it's important to understand where the recording is happening, because that's what determines which events are stored in the queue. When you use this type of static record, registration happens from the VI the event structure is in run mode (Note: this does not mean that the VI is actually running, but just that it's the of running or reserved for the race) and the cancellation of registration only happens when the VI mode of execution. Who is right for which you get the events in the queue of the previous run of the VI - the VI is still in run mode, then the event is added to the queue and still waiting in the queue until the structure of the event to run again.

    You can work around something like that by switching to dynamic registration of events, where you can unsubscribe to empty the queue at the end of the VI, but requires more code. Also, in 2013 LV there are a few features added to events that could allow to do this statically (I don't study all the additions, so I don't know if this is possible for static recording).

    There is a good presentation on the events of NIWeek 2013 by Jack Dunaway. You can find details of how to download the video here - http://lavag.org/topic/16091-ni-week-2012-videos/

  • How can move items in the queue of 1 printer to another

    the title is the question... There are 2 printers put in place, just one, the disposable items in the queue and I want to move them.

    Jobs that are already in the queue are files that were produced by the printer driver and therefore include the printer controls that are specific to this printer.  Directing to the queue print on a second printer will only work if the second printer can correctly interpret the commands to the printer to be the first printer.

    If the second printer is of the same type as the first, the simplest method is to temporarily redirect the port assigned to the second printer.

    1. Go to printers and faxes
    2. Right-click on the icon for the 'good' printer and select Properties, then click the Ports tab
    3. Scroll the list of ports and make a note of the port to which the 'good' printer is made (one with a check) click on Cancel to close the Properties dialog box
    4. Right-click on the "disposable" printer icon, select Properties, and then click the Ports tab
    5. Make a note of the port which is checked, uncheck it and check the port that you noted in step 3.
    6. Click OK

    If the printers are not identical models, but at least the same type (laser, inkjet, matrix), it can work.  The closest to the printers are, it is likely that the print job prints correctly.

  • Everything I print gets stuck in the queue, but the document is printed

    ORIGINAL TITLE: Spooler

    I installed a printer on a pc windows 7 64. Everything I print gets stuck in the queue, but the document is printed. The printer is on the network, I tried to restart the spooler and erased the record of the spooler, but perisisted of the question, given that the document gets stuck, no other agency will be able to print, remove the paper and print again to print but the file gets stuck again on the queue. I tried to change the IP address, but the same thing happened. Can someone help me?

    Hi, Omorguz,

    Printer brand and model, if you please.

    Start > run > type services.msc

    Press enter

    Scroll down to print spooler

    Select stop

    Let Windows stop the spooler

    Control Panel > printers and Faxes folder

    Right-click on the printer icon, then select open

    If you see pending orders in the queue, select the

    Click file > cancel all Documents

    If a job shows the deletion, but never finished, open the command prompt window

    Start > run > type cmd

    Press Ok

    Enter Net Stop Spooler

    Press enter

    Wait for the DOS window opens and is

    Open the command prompt window

    Type Net Start Spooler

    Press enter

    If that does not cancel the print job:

    Your directory of spools Windows XP is located at

    C:\WINDOWS\SYSTEM32\SPOOL\PRINTERS

    It will usually contain files like these:

    FP00008
    FP00008. SHD

    There are two files for each remaining print job.  Just delete these and restart the computer.  Your queue should now be provisioned.

    If you are printing over a network, and the queue is not clear after the above steps:

    Go to the computer that has the shared printer connected and perform steps 1 & 2 above.

    If this does not work, then go to the computer when he was sent to the printing of the task and perform the steps 1 & 2 on this computer.

    Run chkdsk

    Start > run > type CMD

    Press Ok

    Type C: chkdsk/r/f

    Press enter

    You will receive a message re: volume must be locked and you want to start scanning reboot?  Press y and press enter

    Type Exit to close the CMD window

    Restart the computer for the scan at startup

    This will check the integrity of your data on the hard drive of computer as well as find and fix errors that could corrupt your data or program files.

    I even recommend that you uninstall the printer and when you are done uninstalling, restart computer.

    When you reinstall the printer, reinstall it using the compatibility mode

    How to install a hardware device using the compatibility mode driver.

    http://social.technet.Microsoft.com/forums/en-us/w7itprohardware/thread/80cae5ee-dc98-4A2F-8284-a1ab826059b7

    It works on Windows 7 Professional, comprehensive and business - Windows XP Mode - it's free

    It's the best of both worlds: the new Windows XP Mode allows you to run Windows XP older right on your Windows 7 desktop business software.

    http://Windows.Microsoft.com/en-us/Windows7/products/features/Windows-XP-mode

    e FAQ or choose a link from the top of this page.
     
  • Last night, my laptop that runs windows xp blue screened and says something about the queue

    original title: help solve a mistake, please on windows xp

    Last night my laptop that runs windows xp blue screened and says something about the queue and to bring the computer out of which I did. I just tried to turn it on an hour ago, I use it now, and I got a message saying he had recovered from a serious error and I wanted to report to microsoft? I clicked Yes, but unbeknownst to me, I had no internet connection at the point of having to re-enter my our Verizon router WEP number in this laptop. I essentially self-taught myself much on computers that tell you, I'm not really computer literate, but if you can point me in the right direction, I can very well do. This is where to ask my question/problem. I went in the event viewer and found this error/explanation: Index information is corrupt and Indexing Service cannot re - index the content automatically. User action: stop and restart the indexing service using the following command:

    SC stop cisvc

    SC start cisvc

    Can someone tell me please how to do this?  I think I know, but I'm really not sure so please help... Thank you

    It really seems to me as if you had a temporary problem which has now disappeared and that you probably do not need to do anything.

    However, please click Start, and then click Printers and faxes and report what, if anything, you see in the window that opens.

    If you don't see an icon for the printer that you think should be there, you need to fix this.  On the other hand, if your printer icon is there - or if you do not have a printer attached to your computer - you need not do anything.

    If you want your computer to be a little faster and at the same time save space on your hard drive, read the LifeHacker article I linked in my previous post.  However, you need not to do, and you can erase [probably] regardless of the index corruption has occurred by starting and stopping the Indexing Service (cisvc) by entering commands in a command prompt window that I described.

    Yet once, you don't need to change your encryption WEP to WPA or WPA2 wifi, but doing so will make your network more secure wireless.  If you want to change your encryption, you would start by changing the configuration of your router from Verizon.  You should be able to find detailed instructions on the Verizon support site.  I don't know if you have Verizon FiOS or Verizon DSL service; This is a page of relevant support FiOS--> http://www22.verizon.com/ResidentialHelp/FiOSInternet/Networking/Setup/Security/124980.htm

Maybe you are looking for