State machine with polling loop

I asked a similar question before, but I realized that I was being unclear, so I ask my question again in a more concise and clear format.

Two loops:

-1 loop: run a state machine to produce data (a table 2d)

((- 2nd loop: 1) survey the user regarding who rank in the 2d array (past 1st form loop) to display and 2) display the line on GUI

I don't want to use the question mark on my 2nd loop.  I try to use the queue, but I don't think that is my request too much, since I was to pass data and query the user input.  In the end, I thought that it would be for the best if I just create a functioal (FV) variable to display the data and pass data of loop 1 loop 2 loop 2 based on the user input received through surveys in loop 2 (Yes, mark!).  Is there a better way?  What do you think?

Take a look at this example.

Tags: NI Software

Similar Questions

  • State machine with acquisition different modes/loops

    Hi all

    I did a machine design to State (as described here) to organize three (mutually exclusive) process / States: idle, measurement of calibration and continuous measurement. Calibration must be performed before measurement, because the result of the calibration is used for measurement. The data entry is a camera that should run continuously, also in rest mode.

    The problem however is that this state of calibration and continuous measurement (should) have another method of data acquisition. The measure is continuous and the images are processed in real time. To calibrate a number N of images should be accumulated and treated (simply create a background image).

    In the state machine as I have now (see attached image), I have the acquisition of vision outside the state machine in order to have a live view at any time. The problem now is that the inner loop in the State of calibration (the loop that must accumulate the framework) accumulates of course that the first framework N times, it is not question for all new managers during this State.

    Of course, I could fix this with an if/else statement in the first calibration mode accumulate images (if I< n,="" accumulate="" frame="" in="" buffer="" and="" continue),="" but="" i="" am="" not="" convinced="" that="" having="" a="" lot="" of nested="" loops="" is="" the most="" elegant="" way="" to="" do="">

    This also got me thinking, is the state machine, as I built it here all the best way to manage these two processes/acquisition modes? Or are there better ways to do this?

    Contributions and comments are very much appreciated!

    Note: I know that loop as scheduled now in State calibration is wrong with shift registers. It was a test before I realized that the fault was in the interweaving of the state machine altogether.

    Please do not attach pictures, but rather post executable code, screws (easier) or as extracts from LabVIEW (which became the screw when you drag in a block diagram).  If you have more than three attachments, compress the folder and attach the ZIP file.

    I was once describing a system similar to yours, and one of my students, who was a computer science major, said "it's not a State Machine."  I had a similar situation to yours, where I had a procurement process which took time and a 'Stateful' routine that does different things with data (in your case, use it for calibration, waiting to 'Go', absorbent, etc.).

    I understood that it was correct.  I ' D 'opposite' model, with the Acquisition, always running and "driving", the calendar and make 'Appropriate Action' on each set of data, where the Action could (and did) vary according to other conditions.  So I renamed my state machine 'Action engine', and everyone was happy.

    So I won't bother looking at your code (a quick glance showed me that I have only would be frustrated by the limited view), but will give you a suggestion for an alternative architecture.

    You want to (ideally) two parallel loops.  A single loop simply acquires the data (images) at some rate.  For each Image, it signals the loop else it's time to 'Action' on the acquired data (to do this, use a queue or the notifier).  You want that engine of the Action to perform independently the Acquisition loop, just in case a particular Action takes, say, 1.2 times sample to complete - you don't want 'Miss' samples!.

    The loop of the engine of the Action is a unique, appropriate Action at the time, on the newly acquired data.  If you are in the 'State' calibration, the Action will be "add to the calibration.  When you have accumulated enough data to do calibration, set the following Action to (for example) 'wait to start the Signal.  When you receive the Signal to begin, take Action to "acquire, process and save data.  And so on.

    As it happens, I did my code exactly in this way, but it was the idea General - Acquisition was the 'King', he ran the clock and led the ' Machine/Action State engine' to 'do the right thing, appropriate to the time' with the data.  See if this type of model is appropriate in your situation.

    Bob Schor

  • State Machine with PID control

    Hi, I currently have a problem with my state machine, I control two cylinders double effect in sequence that works very well. However, there is one point I need to increase the pressure in the cylinder and to maintain this pressure through the sequence of State machine, however when the state machine transitions to the next indicate the PID controller resets, how can I solve this problem? Everything in is also allowed to apply the pressure in the cylinder another (same node IO accessed).

    Thank you I joined my project in a WinZip file, then it will have to be extracted. The two main VI to watch is 'Park Brake FPGA VI New' and 'park brake host VI update 2 "(new)

    Thank you.

    Nevermind I solved the problem with a parallel loop.

  • creation of structures: state machine with controls

    Hello, I wonder if someone can help me with something. I have a sequence, followed by the event structure / while loop.

    someone can help me. I want to create a STATE MACHINE.

    Here's a basic outline of the current structure, I. and this is what I want it to be. I wonder if its possible and how.

    I'm using labview 7.0.

    Thank you

    This is what I want?

    I looked at your Executive VI.  I don't have an easy way to save in LV 7 now so I'll try to describe in words how I would approach this mess.

    I think it can be done with two loops, a structure of the event, a case structure and not global or local variables.  In fact, there is probably some small business structures and lines inside some of the case, but nothing like as layers of ~ 12 nesting, you're struggling now.

    Look at the design model of producer/consumer (events) as a starting point.

    The loop of producer (event loop) will have the structure of the event.  It will be a case for each control that requires immediate action.  Those that I could identify: get telemetry, side, open Journal printing, abandon, press tank Mode (?) Temp tank (?), Scan, Stop, wait, Step (?) unique, continue and Execute. Most of the buttons must be set on the mechanical action of locking and placed terminals in the case of the event appropriate. So no local population is necessary to reset them.  Those with (?) have no event.  You can have a case of timeout to display Date and time, eliminating which (painful to my eyes) loop.  I don't know about the other stuff in the case of a timeout, but most likely, it is up to the other loop.  If the room 1, 2,... buttons change during trips, they may also need event.  Inside of each event is exactly one element: the Enqueue function.  Create an enum command and make it a typedef. Enqueue this enum value. The queue will be read in the loop of consumer where all the action happens.

    The consumer is your state machine. It has a Dequeue function to get a new order for the structure of the event.  It has several shift registers to transfer data from one case to the other.  These removes your global and local variables.  I'd shift for each of the following registers: the State (typedef enum), cluster of error, temperature (table), pressure (table), results (table), Stat results (table grapes) and a big cluster Indicators_Flags (typedef).  The cluster Indicators_Flags everything that is in the cluster you initialize in the black image sequence (and then never reuse) would have more all indicators except the berries in Maj separate records as well as all your globals and no status indicator, you might need.

    The structure of matter is the heart of the state machine.  All shift registers through it.  It will be the case for what the program does.  Everything in this black initialization setting in about 15 cases of Init.  The while loop to the right of the boot image goes away, but the case inside to become some of the cases of the state machine.  Chassis temperature cycling code goes into 1-3 cases. Mode code pump and read the pressure of your case of timeout event are 1-3 cases.  Code of telemetry: 2 cases.  Print the Page before: 1 case.  Excel code.  Abandonment of code.  Temperature and pressure cycling code of main program: 5-20 cases.  Graphics, record in file: more cases.  Break: 1-2 cases.

    I would like to make a list on paper anyway, you think that you may need and allows to create a typedef enum to control cases.  By making a typedef, it is easy to change without running all over the code looking for the constant in all cases of change.  Enum names will appear on the structure of matter as strings.  Create the loop, shift registers and the structure of the case.  Moving is part of both the original thread can duplicate the case until you have a case for each value in the enumeration of the State.  (Do not use the case of the mark for each value option because it will empty cases that you will then need to wire through.)

    Then copy code from various places in your existing code in the case in the new VI.  Try to avoid copying inhabitants that it will create new controls.  Name bundle to get data in and out of the big bend cluster registry and use ungroup by name.  This provides a free documentation of the data used.

    Check in a month when you have other problems. This will not be a quick fix.  But it will be useful to have a program that works and is easy to manage.

    Lynn

  • State Machine with queues

    Probably a stupid question, but if I'm not asking that I not just guess.

    I have a well-organized State Machine and I am in the final stage - data record. The saved data might be pretty long (a good 15-20 seconds) due to the latency on our LAN and I think that the best way to address this would be to use queues. I was wondering what things I need to look out for or is it as simple as pass the data to the consumer?

    I would need just two pieces (a field ID and its actual data - two string values) of data for each record that could be transmitted through a 2D array.

    Sounds like a normal of the producer/consumer for me.

  • State machine with the help of event

    Hello everyone,

    I have a question on how to achieve the "Timeout". In the diagram below, you can see 2 different situation:

    1. in the 1st case, I used the state machine, it starts in State 1, that contains a case of event. From there, it will first be determined, if the input value has changed in 10 seconds, if it didn't, the state machine will go to State 2, if it is changed, will also be determined, if the value equal to 3, if so, input the distributor of State will in State 3, if not, go back to the State 1. (this VI I've done it before, you can take a look at the attachment).

    2. my question is in the 2nd case. He also started the State 1. Here, the input value can also be changed (once or several times) or not. If the value has not changed within 10 s, or even if it's been changed many times within 10 seconds, but it was never equal to 3, the state machine will go to State 2. only when the value of the entry within 10 seconds equal to 3, he can jump to State 3.

    This problem, I do not know how to solve, everyone has no idea or improve methods?

    Thank you very much!!

    My bad, dint tested before posting (in addition to kills confidence)...!

    Let me know, if it works this time...!

  • State machine with analog output

    I have a vi designed to generate an analogue signal to an actuator and now I just want to add in some calendar items. My intention with the attached vi was to provide signal 1 for a certain period of time, then switch to report 2. I'll add a little time to wait between the two afterwards.

    What's not here? I have not changed the DAQ assistant or any material. I watched this while loop, shift register, structure combo deal on another thread. Signal graph displays correctly the signal, but no signal comes out of data acquisition. I'm sure its something simple, I'm not the best to use labview with elegance.

    Thank you

    I'm not even sure you need calendar screws in there.  You are generating a data value of 1 second and then say data acquisition for output data.  Who takes a second to do.  Therefore, the DAQ Assistant takes over your second time.  Therefore, simply switch your boolean.

  • Machine condition with timed loop?

    Hello world

    Is it possible to have a state machine with timed loop? i.e. on the last State, wait us here until the end of the period to return to the initial state again.

    Thank you

    crazycompgeek wrote:

    Hello world

    Is it possible to have a state machine with timed loop? i.e. on the last State, wait us here until the end of the period to return to the initial state again.

    Thank you

    Yes.  However, when the loop is running, there is no way to stop the program or do any other action.  But if this is what you want, yes it is possible.

  • Structure of the event in a state machine

    Hi all

    I have a state machine with a sort of stand-by, where a user can select the next button state. I tried using a structure of the event with changing the values to select the next case, but when the state machine is in a specific case and the button of another State on the blocks of all things. I've attached an example, the lights simply stating that you are in the State.

    Thx for your time,

    Bert

    Edit: actually, I miss-clicked

    1. you have not need a while loop around the structure of your event.  With no wired time-out, you will never get a timeout event.

    2. your button events are set to 'Lock Front Panel until end of the event'.  Uncheck the box which.

  • Register to offset State Machine

    Home is a state machine, I created to illustrate a problem I have with a larger program.  It doesn't do much, but the concept is the same.

    I created two buttons program (run & abortion).  If I cancel countdown (suspension on the resting State), then select run it begins the countdown of the previous counter value.  I need to start the countdown to 1 min.

    The shift of the state machine register abandon everything in value during the last loop by selecting the button.  I need state machine while the loop shift register reset whenever the run button is selected in the standby mode.

    THX

    There is no "loop of inactivity.  You have a slow case.  Instead of wiring by the count of the left shift register.  It is enough to feed a constant to the wire that goes to the shift register on the right side.

  • Stop correctly with While loop

    Hello

    I can't stop the information that moves in stages with a while loop I created (see below). I joined the program (LabView 8.5) for reference, just in case.

    Currently, whenever I press the stop button designated for the control of the scene, the stages will not stop until the last part of the scene movement pattern is complented (in this case part 7 of the stacked sequence). Now, I have tried various things, but it was the best I could do to make the stage stop at all. (all other attempts resulted in a clumsy scene movement afetr the boss or not at all stop). Any ideas on what I can do? I'm positive that comes to a while loop on the stacking sequence was probably not a good idea. I also stacked sequences are usually wrong (or it seems) but I it is rather tedious otherwise.

    Thanks for the help, Amend sorry if this question seems pretty basic, I haven't used LabVIEW much until last week.

    It's one of the reasons why the stacked sequences should be avoided at all costs!   They can ALWAYS be replaced by a state machine with several advantages.  No. 1 among the benefits to replace a sequence of stacked with a state machine is the ability to STOP a stacked sequence between state transitions should complete each picture before stopping.

  • How to start and stop the video capture in a state machine

    Hello

    I am a student of neuroscience and this is what I try to do: 1) trigger a camera to GigE (200 FPS), 2) start the video capture, 3) triggers a light that stays on for x milliseconds, 4) trigger a valve that will blow an air puff, 5) stop the tone and the valve at the same time and 5) stop the video capture 1 second after 4). For this, my VI is a state machine, with a State for each trigger (ex, 1 State for trigger camera 1 State of light of trigger, ect) and a statement to "stop" and a "time-out State." Everything worked except the video acquisition - the program could trigger the camera but only acquire a frame, because it was not running in a while loop and this is my first question: for an acquisition video is it always necessary to have a while loop?
    I guess the answer is Yes, so I built a loop of 'consumer' for the camera. A queue of the pre-trial 'trigger camera' in the loop of producer, I was then able to start the video capture, but now the problem is to stop it at the right time. I have an another queue in the State of 'stop' in the loop of the producer, but is not able to start the State 'stop' in the loop of consumer, I think that maybe it's because the loop of consumer gets "stuck" in the whole loop.

    I hope you can help me, the VI is attached. Thank you!

    Hello

    First of all, in your loop producer: STATE 'Stop', you use the flushing line, then there is no need to use 'item queue at the opposite end. You can use the enqueue function.

    Secondly, you said "I moved the command stop inside the while loop as you said, but it did not work. But if you look closely, you moved "Enqueue function" inside the while loop. Instead you should use Dequeue function. Please, look at the picture I posted an orderly manner.

    And remove the circled (i.e. function. Enqueue function loop of consumption, where I wrote 'Why stop here').

    Try now.

  • Scalability state machine

    I am sure, there is a simple way to do it, but so far, I have not been able to find. I want to create a state machine, where I am not sure if I will need other States on the line and have had the problem of having to modify selectors and others, according to the new States. I thought of an idea I read somewhere on the storage of the constant in a sub - VI then it auto upgraded in all instances, but can't seem to wrap my head around it. In practical terms, what I would like is:

    -Creation of a state machine with n States I am sure I need now law (business architecture)

    -States for the selector says storage somewhere I can update only once and see which is reflected in all of the VI

    -In the future, if I want to add more States, add to the database 'master' only once and without having to update the former selectors

    White papers or threads, I miss the guys?

    States are generally defined by an Enum.

    Just 'Type defines' the Enum. When values are added, it will update all instances.

    (Right-click-> Type def. do in later versions of LabVIEW.

    Just be sure to save the new Type FED.)

    Steve

  • How to easily add a State in a State Machine

    Hello

    In my project, I implement a state machine to the constant help of the Enum similarly indicated in the attached file in vi.

    It works fine, but the problem is that I need to know the number of tests (or the names of tests) initially for the copy of the Enum even again and again for each new State.

    Lets say I have a state machine with 3 States only.

    If I want to add a fourth State after the vi is not already so I have to update ALL 'States' Enums with this new State, otherwise the vi is broken. In the case of a project with a large number of States, this can be very time consuming... It seems not to be the best way to update each Enum in the vi whenever I want to add a State.

    Is it possible to update all Enums in my project at a time? Is there a better way to implement this?

    Thanks in advance,

    Mentos.

    Hi Mentos,

    See this link please.

    Mike

  • 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.

Maybe you are looking for

  • noon; How do I hear midi on mac pro book files

    I want to play a MIDI on my Mac Book Pro; I can't. Quick Time, said a codec is necessary and seems that I'm not presented with any solution by Apple store or online help. El capitan 10.11.3 (15 d 21) MAC Pro book 2.5 GHz Intel Core 2 Duo 4 GB 667 MHz

  • Webcam stopped working for one user, still works for another user

    I use 2 UserProfile on my laptop.For 1 user, software of the webcam works as expected.For 2nd user webcam no longer works. For this user:-Webcamsoftware automatic start does not (traybar).-Manual start does not work either.-I can see that for each at

  • Problem with the published parameters between the movement of FCPX

    Hello I have a little problem with the settings published between the movement at FCPX. For some reason, the published parameters have different values within FCPX in movement. For example, in motion, a parameter is - 187.04 and in FCPX is-0,19. What

  • Please help, convert this string to a number format

    I send orders via RS232 to my machine and the machine sent back with a display of the number "40" in display normal in my image attatched. I tried to use the string conversion to digital tools, but there is nothing happen just '0 '. I wondered with i

  • Calculating the value of output with custom scale

    Hello I defined a custom in MAX scale. I want just to calculate the value of an input applied with this scale value. Process is simple: X-online custom-online output value scale in the process of Is there a way to do it simply (reminder: custom scale