Race conditions manifested in the state machine in queue

Hello

I ' am developing a vi in which I use a design of producer-consumer model.
the producer s enqueue States for the consumer. but at a certain point in execution of I want to enqueue the next state of the statemachine consumer, within the State of the consumer himself. This causes a problem?
in other words I have given queue in the loop of consumer can also. so the man the next state of consumers will depend on the data in queue

Thank you

I make extensive use of Handleres of Message queue where the "producer" and the consumer enqueue for the same queue.

A "Firinstance" of work today: here are two screenshots of a part of the same code

The top loop controls the State of a semi autonomous process where data is collected.

  1. an event is detected, triggering the start of the measuring cycle
  2. Data are being gathered
  3. Another event tells the top loop that it's time to stop collecting data and "Analize" is sent to the end opposite to the consumer
  4. The buffer empty analize, formats the data and continues to the State of "Log".

The thing to remember is to use a priority queue.  Enqueue to place free and flush properly, in front of end control.  See also 'A trip to Grandma's House'.

It is a very powerful technique for applications where you want abstract on the 'what' and 'When' the how and just leave a "do".

And Yes, if I had chosen a unrestricted data (string, var) rather than an enum type and built the lower loop as a child class, you have a "player".

Tags: NI Software

Similar Questions

  • Tips to remember when using the state machine in queue

    I was able to work through the convert my architecture of State Machine for a BAU, thus eliminating the use of nodes of property/local variables to send data values to my machine of the State, but rather to send through queues.

    I would like some advice/tips on taking to serve perfectly. Especially, "is not to make" things with queues and how to effectively release a queue, etc.. What is the convention when using queues? Thank you!

    V


  • For the State Machine logic makes me Mad, ideas?

    Hello

    I am a complete newbie to Labview and up to the help of kind people on the forum and tutorials tips, State where I implement a state machine.  However, I can't it behave using logic.

    What I try to do is to test the relay using an automated test procedure.

    The procedure takes the following measures:

    1. a card reader and transistor NI9472 DO turns the relay power via the power of the coil (needs of the variable time period). (It's OK)

    2. account of how can cycles the relay contacts worked, it will easily exceed 100,000 cycles. (It's OK)

    3. every 10 cycles (new variables), the contacts are held closed, load circuit "15A in the state machine" (the current relay is switching, which will be 15 a at 30V) is turned off.

    4. While the State of 15A is off, I need to switch to 'State of 1' and the 'State of the measure' , that it allows the measure to take.

    5. Finally, the "State measure and the"State of A 1"must be turned off and the"15A State switched back on .

    6. this process continues for another 10 cycles and repeats.

    I tried to do by using the States and the logical selection function for different States, where she part works, it does not seem to flow completely.  I'm I missing logic.

    Hoping someone may be able to help, thanks

    Andy

    I really didn't thing you want to be returning this Boolean value in all States.  You should probably also have a different evolution register for each line of output.  Then you simply adjust those that you need to.

  • Buttons does not return to the early state in the state machine.

    Hello

    I downloaded a program that is used to back up data. I used a machine to States with different States. State 1 is initialization, where it moves automatically select the State, which allows to select one of the remaining States to copy the data. The selection is made by command buttons. Once u pressed a button, it goes to that respective State and in this state when you press the backup, the backup of data occurs. Once the backup is located the program goes back to the selection state. So far, it works fine. The problem then. Once he returned to the selection state after that copy was made, then none of the buttons are working properly. Then when it goes back to select State and I tried to select a State, nothing happens, not even the stop button works. I don't know why this is happen. Please help me solve this problem. Thanking you in advance.

    You have many States where you have the event structures ("All data" "given more older that '" young data that ' 'Defined Data') (worse there are two of them in "Data set")

    Each of these event structures are for a "Backup" mouse event down.  A singularity is now why you use a mouse event down on a button.  This really should be a value change event.  But this is not the big problem.

    The big problem is that all of these structures events are set to lock the front until the end of the case of the event.  Well, when you click the mouse down on this button, all 4 of these structures tail event this event.  If you are luckly, one of the event will execute and process the event.  Others, that you will never run because the state machine will not get through these cases.)

    You have multiple structures of event you VI and certainly not buried in the event.

    Reading guard and recommendations when using events in LabVIEW

    Then fix your VI architecture.  You must limit the structures of the event or a separate parallel loop, or to a single case of your state machine that your code will frequently return to, without any other user interaction, in order to service the structure of the event.

  • State machine in queue

    Hello

    I use a State Machine in queue which is controlled by a Structure of the event. In this example, the State Machine has 3 cases: inactive, State 1 and State 2.

    I need to trigger execution of State 2, in the Interior of the State 1.

    Thank you

    Dan07


  • Closure of a state machine in queue event with several parallel loops

    I am trying to find the best way to stop a program that consists of an architecture of State machine in line waiting for event with several parallel loops. Can anyone recommend the best way to achieve this in my attached VI? (To browse the forum, this seems to be a frequently asked question, but I have not found a solution that works for me.)

    I look forward to any comments on my as well code, if someone is willing to offer it.

    My program needs:

    If the user press the 'Stop' button, the program should prompt the user with "are you sure you want to stop the program?" and then return to a State of rest or move forward to stop the program. In addition if there is an error, the program should prompt the user to ' clear the error and continue, or stop the program. Then back to the idle state or move forward to stop the program.

    Architectural details:

    The program consists of 3 parallel loops: (1) a loop of event management that places different States of a queue of the State, (2) a State Machine that enters the State that is removed from the queue of the State and (3) a loop error/Shutdown, which deals with errors in the error queue management.

    During normal shutdown, where running handling loop in the case of event 'Program.Shutdown' and 'Shutdown' and the 'Idle' States are added to the queue of the State. In the state machine, the State of 'Stop' is invoked. Special "5000" error code is added to the queue of the error. In the loop of error handling and stopping, "5000" error triggered a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the State of 'Stop' and 'Program.Shutdown' event case with notification 'Go '. If the user decides to stop, the Notifier sends the notification "Stop". Loop and event management State Machine ends when they receive the notification "Stop".

    In case of error, the program behaves in the same way: If the user chooses to clear the error and continue, the program returns to the status "pending".

    HOWEVER - if the user chooses to stop the program, the program crashes. The author of the notification that is sent to stop the loop of events and State Machine management cannot be read because event Program.Shutdown and the stop State (which contain the function "Waiting to notify") are not active.

    I was able to activate the stop State by Queuing in the loop of error/Shutdown management. But I don't know how to activate the "Program.Shutdown" event by program and thus access the function "Waiting to notify" inside.

    I tried to put the function "Waiting to notify" outside the structure of the event, so the event-handling loop never ends. Placing timeouts on the "wait for declaring" and the structure of the event makes the programme of work, but I want to avoid using timeouts because I don't want to turn my event program into a program of polling stations. I would also avoid using variables or nodes property to stop loops, because that requires the creation of a control/indicator for something that the user does not need to interact with.

    Thank you!

    First of all, close the notifier outside loops with your queues.  Second, you must use a user event to send the message to the event structure loop so that it stop in the case of the stop on an error.

  • Helps the state machine

    Hello everyine,.

    I'm working on a state machine. I saw a few videos of the same thing and I need help.

    I have attached the code below.

    My problem is that I can not jump since the first case at the last.

    After the execution of the first case I want LabVIEW to check fot the Boolean control attached to the function select. I used an operator oux during the operation. If the condition of "TERMINATE" is satisfied that I want him to be the last case of local variable is used to turn off the START light.

    at the moment I can't go to the latter case. I want the code to keep control of the State, and whenever the user presses the button END the LED should turn off little matter the time of execution.

    PL suggest ways to accomplish a task... am still a beginner

    Concerning

    Jalashwa

    Hi Sindhurakshak,

    You are welcome. I think that the problem still resides on the Structure of the event to the State "WBS". I can suggest the following (say that everything always ends by WBS what I understand of your current code):

    Remove select it and create a new case event for Boolean switch «end». Location of the enum to cancel in this case, as shown below:

    The above change means that if the value of "end" Boolean switch is changed (assuming that this will change to true), the case of the event will be held event 'end', which will then the enum value 'End' to the transition of change. Let's say that if the Boolean key 'end' has not changed (which means that has not been pressed), it should run the rest as shown below:

    I'll leave the enum value 'WBS' in the time-out period, assuming you want the State to always run the "WBS" idle state, unless you press the key 'end' to trigger the transition "Terminate".

    It may be useful

    Warm greetings,

    Lennard.C

  • problem with the state machine

    Hello! I have a VI to monitor a storage tank. I tried to do by creating a simple state machine that changes the value(on/off) of some faucets based on 2 conditions:

    -When a certain temperature reaches a predetermined value AND its derivative is<0, the="" state="" must="" change="" from="" on="" to="">

    -When some time passes, the State should change from off to on.

    Unfortunately I can't get this working as it never changes state (by example, if I start with him always stay on 'on' and vice versa).

    Could you please tell me what I'm doing wrong? I enclose the screenshots of the 2 States.

    Thank you!

    Sounds like your shift which could not not be wired properly.

  • Use the state machine to fill cluster

    Hello

    I am trying to create a state machine that is running two States, each State has two items up to a Bundle function and in the cluster. I want the two elements of the State first across, then the second State should run and pass the last two items. Currently, I get only the data of the final State. I have one the vi attached.

    Thank you

    Chris

    You don't actually have a state machine.  What you have is a simple loop, and nothing of what is happening in the previous iterations of the loop is spent in later iterations.

    You must create the cluster in the loop itself and maintatin into a shift register.  Use the bundle by name to update the respective elements of the cluster in each picture of the structure of the case.

  • string does not update in the state machine

    Help

    I'm pulling my hair out on this one.

    I have a control over the channel I want to get the value that out of the front at a certain point in a type of State machine architecture, but the value contained in the string of LabVIEW not updated during the enforcement program for the purposes of the block diagram.

    I checked that the VI is not corrupted by creating this simple VI to illustrate what I'm doing. (otherwise empty)

    The length of the string, or the indicator related to the local variable, or updated a probe on a wire connected to the string if during 2 seconds after the start of the VI, something is typed in the control of the chain.

    LabVIEW 2009 version

    Windows 7 operating system

    This could be and OS related issue? -J' I normally use XP not Windows 7 with 2009 and I've never noticed this before.

    Any quick feedback this weekend would be greatly appreciated

    Thank you

    James

    Try setting the chain control to "update the value while typing". (right click...).

  • How relabel case designated enum in the state machine

    Hello

    I have a state machine application in which typedef enum is used to refer to the names of the case.  Is there a faster way to rename one or more cases to match the typedef enum edited instead of having to rebuild each of them (the case structure loses all enum names if I try to edit in any way)?

    Thank you in advance,

    Oliver Barrett

    www.LinkedIn.com

    One thing to add, once your custom/constant in your block diagram control, if you decide to add a new case after case is added, you can simply go file > apply changes in the control to customize window and they will all up-to-date in your block diagram.

  • Problem adding values to a table with the state machine architecture

    Hello

    I currently have a problem that I have to build a program using state machine architecture and now I want to add a value in a table whenever you press a button, but I would like the table to add the new value, rather than deleting the last value. I can't seem to figure out how to make this work without using while loops and similar. It doesn't seem to work properly.

    It is in the case of measurement.

    The idea is I draw several lines then it records the length of the lines in a table and then I'll take one average this so I can convert pixels into real life SO units. But right now I can't seem to add the information in the table.

    There is a little screw Sub, but I think that they should not be important for this question please!

    What's the problem with just the table help build?

  • Need help created the state machine which is based

    I need assistance with my labview program. My goal is to write a program that allows the user to activate a switch. When they do this, it will start a loop witch goes on a digital switch for 45 minutes and then 30 seconds and so on until the user did switch the switch off. The time doesn't have to be precise. I use the NI 9476 digital output card.

    I wrote the code to activate the on/off switch. I know add fuction in loop for 45 minutes a stop 30 seconds. I guess that the most effective method would be to use a state machine, but I struggle to understand.

    The program that I wrote so far without loops is attached.

    Thank you

    Barrett

    I couldn't open your vi because I do not have some of the Subvi.

    Nothing wrong with the first example posted, but I interpreted the specification a little differently.

    Edit: There was a small bug in the first zip file.

  • Elapsed time delay does that once in the state machine

    Hello.  I have problems using the delay to show the seconds remaining on an expectation not in a simple state machine.  I have a front panel countdown indicating the time remaining for the step.  I thought that the delay of elapsed time was the way to do.  The problem is the vi work correctly the first time.  But then after that the calendar does not seem to reset at the time I had put.  If I remove the delay and just stick a waiting time in the State, the vi is exhausted because I expect.  This is just to give the user an idea of the time remaining.  What I missing when using the passage of time, or it's just the wrong tool for the job?

    A small question, is that I would like to move the tasks, in this case the LED outside of the loop, so I don't have to repeat the code.  But when I tried moving them outside with only allow constants within the State, they do not work as I expected.  If you have tasks such as operating a set of Boolean values that you are used in several States, what is the the cleaner way to do it without repeating the code?

    Thanks for the help.

    See how it works for you.

  • In the state machine loop counter

    Hi all

    I have a state machine, and one State in particular is very busy.  I want to State in a loop several times.  I thought about that, but I don't like them.  Let me know if you have a better idea.

    1 Add a registry to offset as a counter for the State.  The State will keep looping to himself, while decrementing the counter.  If the counter is reset, it will go to the next State.  If this isn't the case, it will keep the loop.  I don't like this, because I'll have to add a register to offset.  If I have a little more State requiring a different number of iteration, I'll have to add a counter for that State.  My main VI will be too shift registers.

    2. Add a loop around the code in my case for iteration.  I do not, because too many wires will be going in and out of the loop.  I don't want to do cluster either.

    Yik

    jyang72211 wrote:

    Node of a feedback by counter I need?

    Yik

    With precision.  See this example, each State 5 times before moving earrings.  Beats having 5 shift registers and all of these threads passing through other cases.

Maybe you are looking for

  • HP Z840: radiator z840

    Hi all First post here. I am looking for a replacement radiator / fin Assembly for my HP Z840 (screw type) cpu cooler From the factory, it only has one, and I would get a second processor in there. Anyone who has done this in England, and if so is it

  • Can LabVIEW Embedded for ARM works with any Board or just with a few predefined?

    Hello Can LabVIEW Embedded for ARM works with any evaluation committee or just with a few predefined (MCB2300, MCB2400 and EK-LM3S8962)? I ask this question because even if I chose "another processor" in the definition of the new project only 3 optio

  • ni4882_302

    I have downloaded the new ni4882_302 package gpib driver. This is an executable file, but it does not start. I tried to run it on Windows computers different (Win7 64 bit) and Win - XP 32-Bit. On Win7, I at least get an error message that says that t

  • BlackBerry Z10 unable to update / Cancel Update

    Hello.. Just, I got my z10 2 days ago and has been invited for the updates to Version 10.0.10.82. I tried twice and failed both during step 2 (installation). He would then give me a message "downloading the software has been interrupted. Please try a

  • I can't import after effects CC 2015 files into my project adobe still CS6

    HelloI want to animate a menu in my Bluray and when I try to import my effects after file, I have this popup:"The software that is used to decode the media is not available on this system. Install the correct decoders for files that you use can help