JKI State Machine Objects

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to use JKI SMOs

Hi, I'm fairly new to the JKI SMO framework and I have been looking at many examples online about how to use the framework (the HAL Webinar was very helpful) and I think I understand most of what is being presented but I'm having trouble making the next step of actually implementing it into my applications.
 
At a basic level I'm having difficulty with launching the splash screen SMO.  When I launch a splash screen using the created TestLauncher.vi it launches without difficulty, but when I try to create the Splash Screen SMO from another SMO, it gets stuck in the SMO.lvclass:Start.vi.  Particularly, the subVI StartProcesses.vi.  It's waiting in the Event structure for an event never seems to happen.
 
Any ideas as to what I'm doing wrong?
 
Thanks,
Bruce

0 Kudos
Message 1 of 6
(11,706 Views)

Hi Bruce, 

would you be able to post some code so I can take a look?
Also, which version of SMO are you using?

 

You are likely to get faster attention on the Github issue tracker: 
https://github.com/JKISoftware/JKI-State-Machine-Objects/issues

 

Francois

GCentral ChampionCLA
0 Kudos
Message 2 of 6
(11,656 Views)

I wasn't able to get my code to work, it seems I may be having trouble with the basic concepts of how to use multiple SMOs.  I was trying to start a Splash SMO from within another SMO and maybe that isn't the way to go with these.

 

I've been looking extensively at your Microscope Webinar and code, and it looks like you have 1 VI to start all of your SMOs.  So if I wanted to add a Splash Screen SMO to the Microscope controller, how would you go about doing this?  Would you add the Splash Screen SMO directly to the Microscope.TestLauncher.vi or would you add a higher level VI to launch Splash Screen and launch the Microscope.TestLauncher.vi? 

 

Attached is some code, but until I understand these concepts a little better it probably isn't worth your time to debug my code.

 

Thanks,

Bruce

0 Kudos
Message 3 of 6
(11,647 Views)

Hi Bruce, 

thanks for uploading this code example. The issue is that your splash screen never completes its startup process because the registration is occurring during the registration process of your caller UI.

There are two considerations to solve your issue.

 

First of all, the "Process: Sync" frame is extremely important in "Process.vi" for any SMOs. That's the step that notifies the framework that event registrations have completed and that your component will not miss any important messages such as state changes, errors or more importantly, shutdown or abort signals... The overall state of your state machine object will remain "Created" until the stack of children implementations all reach the Process Sync frame, at which point the SMO will transition to "Started".

 

2017-03-13_12-06-16.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In your "Acquire and Log UI.lvclass:Process.vi", you need to perform all actions instantaneously or asynchronously to allow your SMO to start (aka. reach the Process: Sync frame).

As you can see in the screenshot, your app currently waits forever in the "UI: Launch Splash Screen" and cannot sync, which is why it waits forever in the Start Processes vi.

2017-03-13_12-00-29.png

We will remove the blocking part (event structure) and interact with the splash screen asynchronously.

 

Secondly, it is not possible at the moment to Start a subprocess (SMO Splash in this case) while you are in the process of Starting your caller subsystem (Acquire and Log SMO). This means that you cannot call the "Start" method until after the "Process: Sync". But this is not what you want... so the current option is to call it before the Process.vi is called: essentially, you can override the "onStart" method to start your Splash screen before the process is launched. You can then use the "onStarted" override to close your splash screen.

Alternatively, I will be looking into a way to launch a component subsystem during the startup process: it is possible by making the Register Process method re-entrant... however I want to run unit tests to make sure this does not mess with other features, so this is not an option at the moment. 

 

Let us do a step-by-step walkthrough of the modification to do what you want:

 

  1. Let's create two overrides in your Acquire and Log UI class:
    • onStart.vi (this is called by the framework right before starting the process.)
    • onStopped.vi (this is called by the framework right after process has stopped.)
  2. Add a splash screen class object in the private data of your Acquire and Log UI class.
  3. Open "onStart.vi" and modify it to perform the following steps:
    • Create a splash screen SMO
    • Start it
    • Set a message to display
    • Show the splash UI
    • Store the reference in your private data.
  4. Open "onStopped.vi" and modify it to perform the following steps:
    • Close the splash UI
    • Stop it
    • Destroy it
  5. Go back to your "Acquire and Log UI" class process.vi:
    • Remove "UI: Launch Splash Screen" and "UI: Kill Splash Screen" cases. These actions are called by the framework through the overrides "onStart" and "onStopped".
    • Interact with your splash screen by accessing the reference stored in your private data. (see the UI: Simulate Loading Time case)

2017-03-13_13-43-41.png

 

I hope this helps.

best, 
Francois

 

 

 

 

 

GCentral ChampionCLA
Download All
0 Kudos
Message 4 of 6
(11,634 Views)

can anyone convert this project to LabVIEW 2015? I want to study how to write practical program using JKI SMO.

0 Kudos
Message 5 of 6
(9,316 Views)
0 Kudos
Message 6 of 6
(9,306 Views)