Queued State Machine skipping states?

Hi,
I started out writing my application using a simple state machine but I realized it was necessary to make the application more interactive and prevent the UI from freezing when interupted. For example, I want the user to be able to abort the test by clicking the stop button or a reset button that sends the state machine sequential flow to the reset state.
I implemented the my QSM by looking at the example in the link below.
https://decibel.ni.com/content/docs/DOC-14169
However, the problem now is that the state machine no longer runs sequentially as in my initial simple state machine. Sometimes a state is repeated and at other times a state is skipped. By skipped, I meant it didn't follow the order I tried to implement in my code. I flush the queue before any new user input so I don't know what's causing this behavior in my application.  Has anyone experienced this type of problem before? If so how can it be fixed.
Thanks

Hi
I'm still trying to find a solution to this problem. I was able apply a temporay remedy in an earlier application but in my current application, I'd have to find a permant fix to it.  This problem is described in comment number 4 of the community example code link below. I tried to apply the recommended solution but it didn't work. Perhaps, I was doing it the wrong way. How will the example code be modified to fix the problem described in the comment? I will appreciate any suggestions.  Thanks
https://decibel.ni.com/content/docs/DOC-14169 
Comment4
This pattern has a potential risk of get cycled or get into unwanted states. Let me explain it. When you click on button, an event occurs and typically an element is enqueued to the queue. But in the lower loop another element is enqueued (in this case Report or Process). So when you for example want to go to idle state by clicking on the Stop button, you go to idle state but then you go to report or process state because the element was enqueued behind the idle element as explained above. The solution is to check if the queue is empty before enqueuing the element in the lower loop:
If the queue is empty, it is safe to enqueue element in lower loop:
If it is not empty (this occurs when an element is enqueued in the upper loop due to event occurence), the element will not be enqueued:

Similar Messages

  • Simple State Machine Vs Queued State Machine

    Using LV2009 + WIN7+Pentium 4 @ 2.5Ghz with 3 GB RAM.
    I have a machine control code inside a 10mS main loop that has 7 ( yes seven ) Queued State Machines (  QSM) and I find the  Finished Late boolen keeeps poppping often. Not a very good sign if you ask me.
    And the code itself does not have too much of computation or FP activity. But it has four Graphs with one plot on each of them. These are updated once every 10ms. Can slowing this update ( say once every 250ms ? ) help ? 
    A simple query : In terms of performance overhead, does a QSM  demand more than a  Simple State Machine ( SSM ) ? Can I avoid the Finished Late warning by switching over to SSM at least in three of the cases out of the seven ?
    Thanks 
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    I think your question demonstrates my point.  Unfortunately, I don't have a good example to point you to and don't have the time to write one.  I will try to explain better.  Let's take a simple example - a landscape watering controller (sprinkler controller).  This controller will have several states (e.g. initializing, waiting, watering, closing). Each of these states will accept several commands, but not all commands are accepted in all states.  For example, if the system is watering, a command to start watering could be ignored.
    In most programs, at least some states should be interruptible.  For example, if it starts to rain, the watering system should stop watering immediately instead of watering for a set length of time.  However, if the system is in the initialization state, this will probably not be interruptible (but also short).
    As you said, the classic LabVIEW way to implement such a thing is to have a case statement to represent the state, and a case statement (usually queue driven) in each state frame to handle the commands.  You thus have a loop with a double case structure.  This can get somewhat unwieldy for large programs.  Note that which case structure represents what will be determined by the relative number of each item. For example, if you have fifty commands and three states, the state should go into the command case.
    So how do LabVIEW classes help?  They can eliminate one or both levels of these case structures through the use of dynamic dispatch.  This is done as follows.  A parent class is created that is a generic command.  It has commands for each state.  For each actual command, a class is derived from the parent class.  There are VIs in the specific command class for each state.  A command is generated by creating the correct object for the current state, then calling the parent class command.  Dynamic dispatch will execute the code for the correct command.  The command execution loop is then reduced to a single command VI which dynamically dispatches based on the actual command and the current state.
    In practice, things as usually not quite this simple, and you may want different cases for either different commands or different states so that you can change the connector pane of the dynamically dispatched VI as needed.  Look up the LabVIEW examples on dynamic dispatch to see this in action.
    I am afraid I have still not made myself clear.  Keep asking questions and I will try to keep answering.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Queued State Machine, not a state machine?

    I've been reading up a bit on design patterns that seem popular among LabVIEW users, and I have a question with regards to the design pattern described in the following article:
    http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/
    I don't see how this is a state machine at all. To me it just looks like a producer/consumer pattern for queuing up actions (what is described in the article as states) to be executed in the consumer loop. I don't see where a state machine comes into play, determining state transitions based on current state and inputs, like shown in the following:
    http://zone.ni.com/devzone/cda/tut/p/id/3024
    Am I completely off?

    Yeah exactly.
    I was thinking a nice way to implement something QSM-like would be to produce instances of a message handler object that maintains its own state and a message queue. You could produce a new object for network I/O that inherits from the general message handler, one for managing the UI, data aquisition etc. They would communicate in a network by passing messages back and forth to their respective queues and each would be a true implementation of a state machine.
    Has to be right up LabVIEW's visual alley
    Edit:
    Now that I come to think of it, this would be almost exactly what could be done compactly with LabVIEW event handlers and user-generated events.

  • Double Click Property Node not functioning with Queued State Machine

    I am writing an application which relies on input from the operator to start different steps in a process of steps.  I am using a queued state machine, however I cannot get the Double-Click property of my listbox to function with in this Queued state machine.  I have tried Creating a refrence to the Listbox and creating a property node from that refrence.  I have tried a property node of the control.  The double click functon works only if the queueing is not occuring.  It has something to do with the queue but I am at a loss as to what is causing it.  Any help would be GREATLY appreciated.  I have attached a simplified version of the state machine with the double click function.  Thanks for any help on this.  It is written in LV7.1
    Attachments:
    Test Q.llb ‏55 KB

    Hi
    Its  Simple....
    Your Properrty node is not getting read..... dont understand how..
    see the attachment...
    now laugh at your small mistake... (even i have the habbit of making such small mistakes ;-) )
    Message Edited by Tushar Jambhekar on 01-11-2006 11:38 AM
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog
    Attachments:
    Test Q.llb ‏55 KB
    Picture.JPG ‏44 KB

  • Need help with basic user events in Queued state machine example

    I have written a little queued state machine example to try to teach myself about creating and using user events.  The objective of the machine is to periodically choose a number (I'm doing it now with a control instead of a random number generator for troubleshooting), and compare that number with the number I have set in a control.  When they match, I want to cause an event to fire so I can do something about having found a match.  The examples in the LV Help file references show the events within the event structure, but I want to reach out of a state and cause an event ....
    Can someone point me in the right direction here?
    Thanks
    Hummer1
    Solved!
    Go to Solution.
    Attachments:
    User Event Generator Example01 snip.png ‏102 KB

    Yep....That was it...I had tried to do that but got fouled up with the variant definition...so defined the user event using a boolian and did the same in the case structure where I wanted to create the event and it worked great...
    Thanks.
    Here is the final version...not bulletproof, but does have a queued state machine using a user event to cause an event to fire.
    Hope you find it useful.
    Hummer1
    Attachments:
    User Event Generator Example01.vi ‏45 KB
    Operating States Enum Example01.ctl ‏5 KB

  • Exit of queued state machine

    Hello,
    i have probleme existing an queued state machine vi :
    I can't see how to do to make my vi stop before the wainting time here example is 3s (splitted in 25ms) .
    I
    thinkthere is a probleme flush queued or course competition  something like that
    but i a little new to this kind of codind that i'm a little bit lost.
    here zip file of a minimized programme to isolate part that make me crazy
    For the moment to make it run in a trash mode i put the 25ms wait out of case structure , it works but it means that every case take 25ms
    and is not  good job , because i have something like 20 cases in reality  
    Thank you for help
     Best regards
    Tinnitus
    CLAD / Labview 2011, Win Xp
    Mission d'une semaine- à plusieurs mois laissez moi un MP...
    RP et Midi-pyrénées .Km+++ si possibilité de télétravail
    Kudos always accepted / Les petits clicks jaunes sont toujours appréciés
    Don't forget to valid a good answer / pensez à valider une réponse correcte
    Attachments:
    Ma distribution du code source.zip ‏97 KB

    Well..
    I was not able to get events you have registered with event structures. And also couldnot understand properly because of french texts.
    Anyway, you are facing this problem due to the STTM Q MGR_new.vi in the consumer loop. You are queing more elements in each iteration. This causes your loop to hault untill this vi finishes execution although you have dequed exit case in the end.
    So is it really necessary to have this vi outside the case structure? cant you use this vi to que elements in the producer loop? (loop above?) 
    . Or you can queue required elements inside the case structure of consumer loop.(Place this vi in whichever cases necessary)
    As shown in the figure,  move that vi either inside the case, or you can just que those when the user action takes place in the producer loop.
      I hope i am clear in what i am trying to say. Your lower loop will never stop untill the STTM Q MGR_new.vi stops its execution, so it is necessary to meve as mentioned in the figures
    Attachments:
    Deque.PNG ‏64 KB

  • LabVIEW Queued State Machine as Parellel Process Enabler

    Hi
    LabVIEWs Queued State Machine Architecture is a detailed article on its application for parallel process programming geared to take advantage of LabVIEWs hyperthreading capabilities and multi-core processor PCs of today.
    I am writing future book chapters as blog articles so your critique/comments are appreciated.
    Anthony L.

    I have really enjoyed the articles on ExpressionFlow.  I also like this one, but I think it could use just a little work.  I think that the content is good.  However, about 1/4 of the way down, you have:
    A general layout of QSM-PC architecture comprises of the four objects annotated by the encircled numerals 1 to 4 shown in Figure 1.
    These objects are namely: (1) Queue reference object; (2) User events
    object (optional for head-less embedded applications that require no
    user interaction); (3) Main state machine object; (4) One or more
    parallel processes subVI objects.
    You then go on to have
    Item (1) The Queue Reference
    Item (2) Consumer Object State Machine
    Item (4) Parallel Process SubVIs
    You need to reconcile the two.  I think that a separate (probably earlier??) chapter/article on event structures including dynamic (user) events could be referenced as item 2.
    Thanks for the articles and I hope that this helps!
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • How to cancel task which are in Queue state in SCOM console?

    Hi All,
    When I start any task it does not execute. It show task is in queue state. How can I cancel or execute this task?
    Thanks

    To cancel Task, you can use following steps:
    In the Monitoring workspace, expand Operations Manager and then expand
    Agent Details.
    Click Agent Health State.
    In Agent State, click an agent.
    In the Tasks pane, click Flush Health Service State and Cache.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"

  • Essbase process started in background is going on "In Queue" State

    Hello,
    I am using 11.1.2.1. Any Essbase process started in background is going on "In Queue" State. And the process never starts.
    Any help would be appreciated.

    Hi,
    Try the following steps..
    1. Stop EAS
    2. Delete all the contents of WebLogic temp folder
    Location: EPM_ORACLE_INSTANCE/../domains/EPMSystem/servers/EssbaseAdminServices0/tmp/ --> delete all the content under this folder
    3. Start EAS server
    Hope it helps...
    KosuruS

  • [SOLVED] Mailbox import requests stuck in 'queued' state

    We have a small Exchange 2013 environment with one server having all roles. I try to import archive mailboxes from an Exchange 2010 environment. It has worked quite well for a while. However, all import requests are now 'stuck' in 'queued' state. Restart
    of Replication service, transport service and even server reboot didn't help.
    When I run
    get-mailboximportrequest | Get-MailboxImportRequestStatistics -Includereport | fl
    I observe that PositionInQueue value tells me that there are 85 import requests waiting :
    ItemsTransferred                       :
    PercentComplete                        : 0
    CompletedRequestAgeLimit               : 30.00:00:00
    PositionInQueue                        : 85/90 (Position/Queue Length)
    InternalFlags                          : None
    FailureCode                            :
    There should be no requests waiting as I removed all requests in advance before I issued new import requests:
    get-mailboximportrequest | Remove-MailboxImportRequest
    How can I really reset an import queue by zeroing PositionInQueue ?
    Any suggestions/tips?

    Hi,
    Glade to hear the good news. Thanks for your update.
    Best regards,
    If you have feedback for TechNet Subscriber Support, contact 
    [email protected]
    Belinda Ma
    TechNet Community Support

  • SMA Runebooks stuck in Queued state

    I'm having problems with a jobs not processing at all. They say they are in a queue state when you look at them in the console but when you run "Get-SmaJob -WebServiceEndpoint 'https://smaws.mycompany.com' -port 9090 | where-object {$_.jobstatus -ne
    'Completed'}" the jobstatus comes back as new. I tried to cancel them with "stop-smajob -id 5a8fc19f-4158-433b-a3a9-7a22398f4eed -WebServiceEndpoint 'https://smaws.mycompany.com' -port 9090" and I get this message 
    stop-smajob : Could not stop job 5a8fc19f-4158-433b-a3a9-7a22398f4eed: System.Data.Services.Client.DataServiceClientException: <?xml version="1.0" encoding="utf-8" 
    standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code></code><message 
    xml:lang="en-US">System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&gt; 
    System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---&gt; 
    System.Data.SqlClient.SqlException: Error 50000, Level 11, State 1, Procedure UpdateJob, Line 110, Message: The requested update for the Job is not allowed. The job has 
    already a PendingAction.&#xD;
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)&#xD;
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)&#xD;
       at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, 
    TdsParserStateObject stateObj, Boolean&amp; dataReady)&#xD;
       at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()&#xD;
       at System.Data.SqlClient.SqlDataReader.get_MetaData()&#xD;
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)&#xD;
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, 
    Task&amp; task, Boolean asyncWrite, SqlDataReader ds)&#xD;
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, 
    TaskCompletionSource`1 completion, Int32 timeout, Task&amp; task, Boolean asyncWrite)&#xD;
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)&#xD;
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)&#xD;
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)&#xD;
       at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)&#xD;
       --- End of inner exception stack trace ---&#xD;
       at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)&#xD;
       at System.Data.EntityClient.EntityCommandDefinition.Execute(EntityCommand entityCommand, CommandBehavior behavior)&#xD;
       at System.Data.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)&#xD;
       at System.Data.EntityClient.EntityCommand.ExecuteScalar[T_Result](Func`2 resultSelector)&#xD;
       at System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters)&#xD;
       at Orchestrator.ResourceModel.OrchestratorApi.UpdateJob(Nullable`1 jobKey, Nullable`1 jobId, String jobStatus, Nullable`1 setjobStatus, String pendingAction, String 
    pendingActionData, Nullable`1 setpendingAction, Nullable`1 partitionId, Nullable`1 setPartitionId, Nullable`1 ownerId, Nullable`1 setownerId, Nullable`1 
    workflowInstanceId, Nullable`1 setworkflowInstanceId, String jobException, Nullable`1 setJobException, Nullable`1 forceUpdate, ObjectParameter 
    jobStatusUpdateResult)&#xD;
       at Orchestrator.WebService.ActionContext.UpdateJob(Guid jobId, JobPendingAction jobPendingAction, String pendingActionData)&#xD;
       at Orchestrator.WebService.ActionContext.Stop(Job job)&#xD;
       --- End of inner exception stack trace ---&#xD;
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)&#xD;
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)&#xD;
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)&#xD;
       at EntityFrameworkActionProvider.ActionInvokable.&lt;&gt;c__DisplayClass3.&lt;.ctor&gt;b__0()&#xD;
       at EntityFrameworkActionProvider.ActionInvokable.Invoke()</message></error>
       at System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)
       at System.Data.Services.Client.QueryResult.EndExecuteQuery[TElement](Object source, String method, IAsyncResult asyncResult)
    At line:5 char:1
    + stop-smajob -id 5a8fc19f-4158-433b-a3a9-7a22398f4eed -WebServiceEndpoint 'https: ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Stop-SmaJob], InvalidOperationException
        + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.SystemCenter.ServiceManagementAutomation.StopSmaJob
    I've tried the steps here, but no long so far. http://www.concurrency.com/infrastructure/sma-runbooks-stuck-queued-status/
    Any ideas would be helpful.
    Matt

    Hi,
    with "Get-SmaRunbookWorkerDeployment -WebServiceEndpoint https://WebServer.domain.com" make sure there are registered Runbook Workers. At at that host(s) make sure that the service "Runbook Service" is running ...
    Regards,
    Stefan
    www.sc-orchestrator.eu ,
    Blog sc-orchestrator.eu
    I can see all three of my SMA servers but they dont have lookup names. Not sure if that matters or not. They are all on the same domain and vlan so there isnt a firewall between them.

  • Crystal reports always stay in queued state

    When I run any crystal report, they stay in queued state forever.I have rebooted the appserver and process schedulerand cleared the cache,but the same problem persists.
    Application:FSCM 8.8
    Tools:8.47
    What might be the problem and how can i rectify it?

    It's possible that you have some previous Crystal processes that are in a non-final status. They may be 'stuck' in Processing or Initiated status. If the number of these incomplete processes has reached your maximum concurrent process level, then no additional Crystal processes will run until those incomplete processes are cleared out. I have also seen situations where 'Error' or 'Canceled' processes can prevent future processes from running.
    If you have Crystal processes in anything other than 'Success' status, try deleting those processes through Process Monitor, and see if that allows your queued processes to start.

  • HELP: UCCX 7.0(1)SR05 CSD Queue Stat Display

    CSD doesn't display the overall queue stats. Agent status/state okay, just no overall CSQ stats display in the Real Time Displays.

    Thanks for the quick response. I checked and there's no other options. I saw a screen-print on what is should look like, but there's no options under "Skill Groups". Granted we're not using skills, just a resource group ... but from what I understand that's where it should show the name of the CSQ, but ours is empty.

  • UCCX 10.X Unable to get Queue Stats to write from a script to an HTML file

    We upgraded from CCX 7.X to CCX 10.5. After the upgrade I am unable to get a Queue stats web page working. I have changed the 'create doc' step to 'set doc' but I cant seem to get it to work. I have uploaded the SYDNEY.html file to the document repository. I have attached the script and web page.
    Any info is appreciated
    Thanks!

    Thanks for the response. There was a unrelated problem with the server and I restarted the engine and it is working now.
    The script works and can be used as a sample.
    The only change I made was I updated the HTML file with the following line so that when the page refreshes it points to the correct URL.
    <meta http-equiv="Refresh" content="5;url=http://10.20.8.51:9080/SYDNEY"/>
    Thanks!
    Craig

  • Time Machine will not let me restore from backups after June, 2013.  I can see the files on the external hard drive but Time Machine skips all of them and goes back to June, 2013. Does anyone have any idea what the problem is?

    Time Machine will not let me restore from backups after June, 2013.  I can see the files on the external hard drive but Time Machine skips all of them and goes back to June, 2013. Does anyone have any idea what the problem is?

    rtilghman wrote:
    telling me to buy a new router is NOT a solution.
    And why not? Apple is selling these things like BigMacs. They can't make enough of them. You've been suffering since May because you refuse to get a decent router.
    Can you imagine if a company that makes a refrigerator told me that I needed to upgrade my electrical system to rectify a problem with their device? What kind of response IS that?!?!
    What if the problem with their device is that it requires a new-fangled "grounded" outlet and your circa 1890 house doesn't have grounded outlets. Would you refuse to purchase a $ 25 adapter on principle?

Maybe you are looking for

  • Yosemite random reboots on macbook mid 2012

    Well I've read thoroughly all the posts related to this kind of issue and it seems it affects a wide range of devices. Either mac minis or 2011 macbooks and so on. I would like to explain my experience and ask for any advice available. I am experienc

  • Ipod Classic with Itunes 12.1 - Warning

    First off, Known issues - immediately after 12 dropped, pretty much all functionality involving Ipod classics was broken. Mac OS recieved a patch that fixed this, Windows has not, and there has been no addressing this issue thus far. My stuff: Ipod c

  • Javascript in URL

    Hi: I am using Apex 4.0. I have a horizontal report that I am using for a page. I need to call javascript in the link to set an item on the page. My code does not seem to be working. Here is what I have done... How must the javascript for the link ap

  • Assigning Different Style Classes to Portlet Columns

    Is it possible to use the CSS mill to create a style sheet that assigns certain properties to particular columns in the portal body? For example if I wanted the third column in my page layout to tell portlets to turn their borders off and have a gray

  • WANT TO USE M1217 printer on fax server but modem driver could not find

    Dear All I want to install HP Laserjet M1217 MFP on Window Server 2012 r2 and Use on windows Fax and Scan utility. but i think i need modem driver to use on this utility. therefore i need assistance  how can i use this dvice on Fax server. best regar