Another chart update rate issue (using a state machine)

Hi all!

I'm develiping a pilot for a new instrument.  I have the basics of work based on the vi tree tutorial.  Now, I'm creating a basic example.  I started by watching a tutorial of State machine (a soda dispenser).  I have 3 States, basically init/reading data/check buttons & writing. Everything works great, reading and display of data. I would now like to add a chart for one of the data (SAP in this case).  Try to implement the method using the loop counter.  Loop cycles at 100 ms for now updating in 5 seconds (later must be user input).

So basically, I have a simple state machine that updates the values on the screen in a certain State.  I need these data at the top level for trace or possibly turning most of these (less graphic) in a self-contained vi.

Anyway, I have a Boolean LED in the main loop that flashes every 5 seconds. So far so good.  Except that the graph updates apparently at random?  Put the prog in sleep mode and I have seen the updated table when the data has been read (inside the red box). He has every time.  I'm just creating a local variable inside the red zone...  I see sporadic updates in the charts, maybe 5-10 updates every 5 seconds.  What Miss me?  If I change the iterations of the loop to a faster number (e.g. 10 ms) graph updates like crazy (although the CASE is false).

Hi Steven8R,

The chart will update any update a fact local variable refers to the table.  If the chart should be updated each time the code in red box runs.

The code you have in the structure of the business is not doing anything.  It's just whatever data, the graph contains the reading and writing in itself.

Something you might try to do instead is wiring the output of the amp VI get directly to the table AMPS inside the 5 second delay of the case structure.  This will update the chart as the most recent data point every 5 seconds.  Is that what you want?

Best,

Tags: NI Software

Similar Questions

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

  • problem of data flow in the case structures (using a state machine)

    Good day everyone.

    I'm having a problem with the flow of data between the structures of the case.

    I try to use an example of a state machine for this simple problem. but when I try to send data of a box structure to change the State of the code. It will change not in the desirable output, instead, it offers the possibility that the exit options emul.

    could someone please point what I'm doing wrong here. Any kind of help would be very appreciated.

    With a quick glance at your photos a question you have is that you use not data flow. You write your status updated in local variables value. Your State should pass through the case structures are a single wire. Playback of your order "Enum", happened in the register shift on the right side of your loop probably get running and reading before any processing occurs within the structure of your business. That's why you're reading the old value of the State and not the update. or have a classic case of a race condition in your code.

  • 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


  • Engine using a state machine control logic

    Hello

    I'm trying to implement motor control using the logic of the state machine. My requirement is simple. I have a voltage from data acquisition value that corresponds to the couple (initial value = 5). I need my feeding motor a positive (right-hand rotation) and negative (counterclockwise rotation) speed depending on whether the value of this tension is between the top (7 V) and the lower thresholds (3 V).

    In other words, the motor starts to turn in a clockwise direction at the outset; the voltage is declining, as soon as we get to <= 3="" v,="" it="" changes="" direction="" and="" moves="" counterclockwise="" till="" it="" hits="">= 7 V, then changes direction again and this repeatedly for, say user-defined number of cycles. I tried to write this logic, and when I run the program it starts well, is to see the first time, entry happens under a low threshold, changes direction but oscillates at the same position. He won't until > = 7 V.

    I enclose the code for your reference. Logical machine state in queue can be of any help? Also, can I present a State in which after that user-defined cycles are more the engine back to a position where the voltage is 5 V.

    Thank you very much.

    Ravens fan is OK.  You need to know which direction you are moving before deciding what to do comparison.  Look at this simple diagram that shows how to use a shift register to keep track of which direct that you use.

  • Problem updating my state machine, using the emg signal

    Hello

    I have problems with my code. My entry is an EMG signal that I gather from three different electrodes using usb 6008. In the program, I divide the signals and display them in a chart that is unique. What I want now is to read the signal, and if a signal passes a threshold I want an LED lights. This must remain lit until there is another signal that passes the threshold.

    To put it simply: "large enough signal--> lamp on--> stay informed--> enough large signal--> lamp--> stay off the coast and then start again."

    I tried a few different approaches, but I decided using a state machine. Now, the problem is that when the signal to enter the state machine the program crashes. I think it's because the table that I use to convert the signals does not update when I get my state machine, so the signal stops to come. But how to get around this problem? It is even possible to code what I want?

    I have attached the code. All the tips are welcome, I have been struggling with this for some time now.

    Thank you

    jenmich

    The problem is internal while the loop is run until the stop condition is true, but he never does a new Boolean entry. So that it remains for always in the same State. Remove the inner loop and put the shift register on the outer loop instead.

    You must also use a daqmx configures the element, and then set the properties of daq. The read.vi can be set to read a number of samples of each iteration.

    Also: you can expand the table to index for several items of output. If you want that element number 0, 1, and 2, you have yet to wire the index entries

  • Help with State Machine user Sequentail events

    I'm trying to create a program using the state machine which include events genreated user to jump between States. Also, I want the program to require a sequence of events to be genreted before entering in some States.

    For example:

    States: Init, idle, a-1, A-2, A-3, B - 1 and stop

    If a-1 State is selected, the user must enter the setting and select the condition A-2.
    The user cannot directly jump without having to access the mode a-1 to A - 2
    If the user selects the a-1 State, he should have the possibility of not input parameter and jump to another State as B-1 or Stop

    State A-3 can be entered automatically by State A-2.

    How to program the machine in order to do what I want? I've updated a sampling program. I'm not sure if I impleted the program properly. The user Panel hangs if I enter State a-1, and then press the Stop button. It does not allow me to leave the a-1 State and forces me to go to State A-2.

    A few other questions:

    -How to initialize all values of boleean to 0 during my Init State?

    -Why is a timeout value?

    Hey there, I developed example of Jacobson on a bit here to illustrate the case "Idle, how far to walk, ' your state machine diagram.

    Some keys on the front panel when you are in the bad condition will do nothing, as you can see, because I only check for buttons, I would like to respond to each State. For example, by pressing "Start on" the State of market won't do anything because this isn't a valid button, but pressing "Quit" will bring you to Idle. To implement the rest of the state machine, it is up to you!

  • STOP button for program waiting in a state machine

    Hello

    I am trying to create a state machine in order to control a conveyor, mixer pump and linear actuator. Each component runs in sequential order all the time, so I thought that using a state machine would probably be the best architecture program.

    The problem that I am facing, it's that there are States that require more time before the start of the next State. For example, I need to be able to run the pump or mixer for an another period of time. I understand that simply using the VI of waiting is not a good idea because it removes the option to stop the program on the chance that something goes wrong (at least until the end waiting for execution function). I tried to use clock calendar in order to force the program to wait for a term between States, but I found myself with all nested in loops for each State that require stop buttons separate who ends up doing the complicated program (this is what we see in the attached VI).

    I looked at other threads mentioned using notifiers or the structures of the event, but since I use a state machine, I don't know how to use them with several States.

    If there is a way to force synchronization between States while maintaining control of stop button and, eventually, the ability to run any code while you wait, please let me know. I have attached the VI I train, and the emphasis is on the 'wait to hatch open' State.

    Thank you.

    That your state machine shift register is a cluster.  First point is an enum for say the next State to go to.  Second element is a digital that defines how long to wait if the next State is a wait.  Third point is an another enum as first to tell what State to go after the wait ends.

    Start of the loop of State machine, ungroup the first point to know what State to go to.  In your state of waiting, when you have determined the wait is made, ungroup the 3rd point.  Set the first element of the cluster machine of the State to be this enum even if he goes on the next State.  Basically leave wire to move the machine of State wear with it another State of the State, not only the next State, but also what would be the next state when the next State is completed (in case there are several choice.)

  • State machine, controls, and indicators

    Hey everybody,

    I'm working on the conversion of a VI to use a state machine architecture. In other words, there are several buttons that trigger States through a structure of the event in the standby mode. Two States need write values in the same set of indicators, but the rest should be left alone. Several States also contain a Subvi, which takes a cluster entry. The cluster is composed of about 10 digital/boolean controls. I wonder what is the best way to deal with these two problems. I could use local variables or references, but that seems to be discouraged for most cases. I do not have access to the VI himself at the present time, but it might send more later if necessary.

    You could go with the local population, in this case it should be ok, or have an update-state indicator.

    I have probably to take the easy road and go with local to a simple state machine.

    /Y

  • State machine - unexpected synchronization problem

    Hello - as usual, a problem is solved another appears! I built a simple state machine to take a measure for a period defined by the user of the time (X) and pause/wait for a period defined by the user of the time (Y) before taking another measurement. It works perfectly well if X > Y, but for some reason when X

    Look closely. It does work in both cases.

    The problem is that it resets and counts your "wait time" as part of its "beat of the measure.  Then put 10 sec measurement, wait 9 sev and you will see that it measures only for 1 second after the first measurement.

    Release the auto on your timer, rather redefined and when I = 0.

  • 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


  • programmable state machine

    I have a sort of display driver who, at the present time, uses a state machine and goes from A, B, C, etc and cycles again in A after the whole alphabet.

    I can get to spell words by editing the diagram from the State to the point I want to some letter (IE State) using the method of normal state machine.

    However, is there a way to prorgammably change the state machine, so I can type in say a Word and it changes the State next to that required in a general program without having to change the state machine each time. Obviously I would need to disable change the next sort state based on my data. Suppose I typed the word FACE. It would then start the letter F instead of A and then jump to A and C and E and back again to F.

    If your enum actually contains {'A', 'B', 'C'...} instead of through the strings property to convert 'F' to 'F', use the Scan function.  Wire a constant 'default' enum of entry and the value of the format string '% s '.  The output value will be the corresponding enumeration value.

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

  • PID state machine problem

    Hello.

    I have a problem with my design of State machine and I need help to know what to do.

    I m using a state machine six steps for HVAC test machines. Password-> Idle it down-> Run-> Acquire-> Report--> Shut. Run and acquire the States have PID controls in them (almost identical States) and very fast three-way-valves they´re for the desired control of the temperatures of the water mixture. I m running try to get static values for temperatures and I m satisfied with them, moving to acquire the State to get the data in the report. My problem is that when the race to acquire, PID control outputs from scratch and at that time there static temperatures have disappeared. Worst case is that the tested machine HVAC stops following liquids from bad weather and I start from the beginning.

    Is there a way to tell the PID.vi the release of starting a specific value? In this case, continue to the last value that they released in the State of enforcement?

    I know that scheluding of gain would do (machines would be not closed) but I Don t want to use it because the original problem would still be there.

    Arctic_Fox wrote:

    So PID vi:s remove from the state machine, placing them inside the while loop that surrounds the state machine and leaving all necessary writing DAQmx-functions inside the race and the States Acquire would make corrections on the positions of the valve only on those two States. Right?

    It is a good idea.  I leave the DAQmx functions outside the state machine as well.  If you need to write a fixed value for the outputs when the PID is not running, use the PID that you already have to determine the value to write (output PID or anything else) on/off switch.  In addition, I would make sure the reset of PID entry is true whenever the PID is not running.

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

Maybe you are looking for