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.

Tags: NI Software

Similar Questions

  • State machine running in the mess

    I'm under Labview 2014 with a card USB-6212.  My card/code is used to control a stepper motor and a linear actuator with a built-in potentiometer.  I created a state machine to control the sequence of events and synchronization between the two engines.  What is the general flow of the program. (The program ultimately will save the data, but this feature is not yet written.)

    (1) Init

    (2) take data

    (3) take out the cylinder according to the desired distance.

    (4) increments the position of the actuator to the next desired position.

    (5) repeat steps 2 through 4 until the next desired position is greater than a maximum distance.

    (6) actuator back to the starting position.

    (7) raise the stage with engine step by step an increment.

    (8) repeat 2 to 7, up to a maximum height

    (9) returns the height of the platform to zero.

    I have three main problems with my state machine.

    Problem 1) the counter mentioned in step 4 (found on the case of the ACTUATOR OUT/RECORD DATA in the program) does not invariably increment.  Most of the time, he eventually incrementation of twice the distance that she is supposed to.  I can watch the indicator on the façade increment twice while the linear actuator moves only once.

    Problem 2) program runs correctly in the sequence or consistantly.  Step 7 usually occurs prior to step 6

    Problem 3) program rowed a lot and freezes before it finishes.

    I have worked on this all day and could really use some help.

    Thanks in advance.


  • 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

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

  • State machine gets stuck (small problem)

    Hello

    I have a problem with the state machine, I have atteched dummy code that my problem can be considered. When I hit the exit button and the menu popup appears, the YES button works as it should, but when I type no., my program gets stuck. I tried initializing controls, but no effect

    Thank you for your help.

    I think it will be easier to use a case OPI event.

    Jean-Marc

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

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

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

  • Problems with the implementation of State machine enemies spawn

    Hi guys,.

    I am developing my own 2D shoot-em - up and using a book called "The essential guide to Flash games" as reference to create my own state machine enemies spawn where the game keep enemies spawning (game will always until the player dies). I tried to trigger each enemy spawn that occur at the level of the game with a variable called 'chance '.

    With my current attempts, the game does not an enemy and does not other or not spawning all enemies at all. I was wondering everyone here has suggestions/advice for this question, I will have?

    Here is the sample code from the book that I used:


    public void Main()
    {
    Level = 1;
    score = 0;
    chance = 0;


    enemies = new Array();
    makeEnemies();

    }

    public function makeEnemies (): void {}
    var chance: Number = Math.floor (Math.random () * 100);
    var tempEnemy:MovieClip;
    If (< 2 + level of luck)
    tempEnemy = new EnemyImage()
    tempEnemy.y = 435;
    tempEnemy.x = Math.floor (Math.random () * 515)
    addChild (tempEnemy);
    Enemies.push (tempEnemy);
    }
    function checkCollisionWithEnemies(bullet:MovieClip)
    {
    If (enemy.meter.width < 1)
    {
    Enemy.Stop ();
    swapProperies (enemy, b);
    removeChild (enemy);
    enemy = null;
    level ++;
    }

    Occurring in the book lines:

    "var chance: Number = Math.floor (Math.random () * 100);"
    "If (< 2 + level of luck).

    should create + 2 enemies according to the level of the game, but no enemies to reproduce at all. I also tried a different method with "if (level > = 1)" but that creates a single enemy.

    Anyone have any suggestions of what I'm doing wrong? Any help would be greatly appreciated.

    Thank you

    Jonesy

    > is not new spawning enemies when the former enemies are killed

    You have nothing to create new enemies in the function "checkCollisionWithEnemies()".

    > three enemies are created in the beginning instead of one

    The for () loop based on makeEnemies() is configured to run 3 times (I I = 0, 1, 2)

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

  • 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 pink icons

    I just started studying advice Lab, I m trying to build a state machine to a tutorial to the free rhythm. My problem is that I Don t know how to get the icon in pink inside of the case state. I've attached a file

    Thank you

    In my view, that icon Pink is a local variable for an indicator of the chain.  It is probably an older version of labview, because the icon is different now.  Right click on the indicator, Create > local Variable.  Drag the icon on any on the block diagram.  Then right-click the local variable, Create > Constant for the constant string.  It's great that you are be studious.  Good luck with your learning.

  • How to transmit DATA between several state machines.

    Hi I'm doing a project that needs to acquire data from a simulated data file and display it on a graphical interface. Two of them are manufactured in a state machine. I wonder if it is a good way of communication of data between two state machines? It would be very appreciated if you can provide a few examples. Thank you very much.

    OK, there are plenty of ways to communicate, but who are these state machines in the same project? Same VI? All LabVIEW?

    I like functional global variables due to the functionality that can be included in the. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Work of local variable, but I try to clear them tsar when possible. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Queues are pretty popular to connect, but try to stay with fixed size data, if you think that the limits of memory could be a problem.

    If you speak through the eyes of network to published static Variables (do not use these unless you have a stable network) network, TCP/IP, UDP, or Web Services flow (you need experience in this field. It is not just together.

    LabVIEW is a good way to program, but this kind of key options.

  • event and state machine

    Hello

    I have a problem when I want to set up an event in my state machine.

    The state machine is reading communication series through different States 10 +.

    The problem came when I tried to add an event inside the State number 10. In the number of State 9 code seems to work only partially (an option button is not possible to change the value on).

    It seems almost that it is frozen but when I select the code I can see it works well (option button isn't).

    It is strange that when I remove the event in condition 10 all is well again? The event code is not yet performed yet because it is in the frame after!

    Any thoughts?

    I'm under LabView 2013 on a Windows 7 PC.

    I'm trying to figure out which of the two cases is the one who seems to hang if the name would be better than a number.

    When using am event structure you don't we want to use a local variable.  In fact, you should only use local variables on rare occasions that they break the flow of data.  The event structure is fine for the entry.  The problem is the way you treat things after that the button is pressed.  Again, I think you have to look at a design model of producer/consumer with a machine of the State in queue.

    The best way to have a writing occur only after a button must have the code for writing in a case that is active when the button is true and is simply empty, when it has the value false.

Maybe you are looking for

  • TB crashes when I try to save the attached photos - save all attachments (not answer)

    I received an email with two photos (2.5 megs together). If I try to save the photo, or both at the same time, Thunderbird freezes and I have to end via Ctrl Alt Delete. I tried Safe Mode and disabled all add-ons nothing helps. This is the first time

  • NetBook will not start

    Hi, so I got a virus on my netbook a few days ago. I was going to get rid of it, but I'm lazy and waited and tried to start it until today. I got a blue screen, and I think that the error was bad_system_config_info. It is difficult to say because it

  • Satellite 1800-100: bad XP drivers?

    I visit the pages of pilot official Toshiba via the homepage of support, but as this link and Satellite 1800-100 pilots are wrong with OS compatibility:I selected and download drivers for Windows XP, but none of the drivers can be installed under XP

  • Can someone please reset my password XBOX LIVE please?

    I got a new xbox today and I have forgetton my live password xbox, could someone please reset this?

  • Vista - Error Code: 0 x 80070490 (cannot install SP2)

    Hello! I'm trying to help a customer with a problematic SP 2 upgrade. We get the error message as above. Tried with Win Update and download the SP (Swedish). I ran this http://support.microsoft.com/kb/947821 Thank you very much for your help!