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.

Similar Messages

  • 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

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

  • 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 add a state to an existing state machine?

    Hello,
    I have a state machine with 5 states. See attached vi (LabVIEW 7.1).
    Now I want to add another state ("wait") between state Druck Aufbau and Druck Abbau. How can I do that?
    I tried to add a state to the enum on the left and then I noticed that I would have to modify every enum in the vi and the case structure as well.
    Is there an easier way?
    Greetings Johannes
    Using LabVIEW 7.1 and 2009 recently
    Attachments:
    Hysterese_Disc.vi ‏75 KB

    You should replace all enums of the state machine with your type def'ed one. Thus, every change you make will be propagated throughout your state machine. When you need to add or delete states, change the typ def (so the Enum.ctl), and then all the enums will change. Thats the very reason of type definitions. In future, always use type defed enums.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • 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

  • How to Run a simple program using JMS Queue.!!

    Hi All,
    I am trying to run simple program on JMS Queue.
    Using SOA Suite 10.1.3.2
    I created a connection factory and queue using EM.
    Connection Factory => Domain : Queue JNDI Location : jms/sidConnectionFactory
    Queue Name : SidQueue JNDI Location : jms/SidQueue
    Tried running a simple java class to send the messages to queue.[Pls find the file attached].
    Getting this error
    javax.naming.NamingException: META-INF/application-client.xml not found (see J2EE spec, application-client chapter for requirements and format of the file)
    at oracle.j2ee.naming.ApplicationClientInitialContextFactory.getRequiredClasspathResource(ApplicationClientInitialContextFactory.java:239)
    at oracle.j2ee.naming.ApplicationClientInitialContextFactory.getArchive(ApplicationClientInitialContextFactory.java:161)
    at oracle.j2ee.naming.ApplicationClientInitialContextFactory.getInitialContext(ApplicationClientInitialContextFactory.java:111)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
    Can some one tell me how i need to create this file and where to place this[i.e is this need to be placed in  my project or some directory structure of <SOA-HOME>
    Thx,
    Siddhardha.
    Code:
    package demo;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Properties;
    import javax.jms.*;
    import javax.naming.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class JMSQueue {
        public static void main(String args[])
    QueueConnection queueConnection;
    QueueSession queueSession;
    //private MessageProducer producer;
    QueueSender queueSender;
    try {          
    String message = "Test";
    String connectionFactoryName = "jms/sidConnectionFactory";
    String destinationName = "jms/SidQueue";
    /*Do i need to use this .......
    * If so where is the error in below statements...
    * Properties env = new Properties( );
    // ... specify the JNDI properties specific to the vendor
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.ApplicationClientInitialContextFactory");
    env.put(Context.PROVIDER_URL,
    "ormi://localhost:23791");
    Context ctx = new InitialContext();
    // Get the connection factory.
    QueueConnectionFactory cf = (QueueConnectionFactory)ctx.lookup(connectionFactoryName);
    // Get the destination.
    Queue destination = (Queue) ctx.lookup(destinationName);
    // Use the connection factory to create a connection.
    queueConnection = cf.createQueueConnection();
    // Start the connection.
    queueConnection.start();
    // Use the connection to create a session.
    queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    // Use the session and destination to create a message producer and a message consumer.
    //producer = queueSession.createProducer(destination);
    queueSender = queueSession.createSender(destination);
    TextMessage msg = queueSession.createTextMessage(message);
    queueSender.send(msg);
    queueSession.close();
    queueConnection.close();
    catch (Exception ex) {
    ex.printStackTrace();
    * Attached following libraries to the Project
    * jms.jar
    * optic.jar
    * oc4jclient.jar
    */

    Hi,
    You need to change the INITIAL_CONTEXT_FACTORY to com.evermind.server.RMIInitialContextFactory.
    Regards,
    Sandeep

Maybe you are looking for