Norm Kirchner

TLB' - Top-Level Baseline Prime Application Template

24 posts in this topic

Hi Norm,

I have yet to find a good example of how to use the nested Event Structures in the TLB template. Could you (or someone) point me to some code that demonstrates this unconventional approach? I'm interested in seeing how this is used since at this point in time I've only been successful in freezing the UI. Also, the current download of the TLB doesn't seem to contain the "Prime" improvements. That is the state machine contained within the Primary Execution loop. I'm running LV2011 so perhaps this update is only for 2012 as you demonstrate using 2012 in your videos?

Thanks!

Craig

Share this post


Link to post
Share on other sites

I was going through the process of modifying QuickVIew today and realized it was a prime opportunity to expose the thoughts and process for tweaking a program based on TLB`

Video Part 1

http://screencast.com/t/MgrPRMq0a

Video Part 2

http://screencast.com/t/ZgJ6yQmNxR16

I hope this helps you all understand how to do a minor modification to a program and how nice it is to separate the mental process of flow from what is going on in the system.

Share this post


Link to post
Share on other sites

This could be a newbie-type question (as I am one relative to the average user base on LAVAG) but would you recommend this approach to an application that runs automated testing with no user input? My applications will typically never involve event-driven structures, though I do appreciate the sound thinking behind this approach.

Share this post


Link to post
Share on other sites

This package seems to install v3.0.0.4 of the AMC library (and two dependencies), which is newer than (and is incompatible with) the version (2.1.4.5) library (and its own dependencies) that generally seems to be available here and that I had already installed. It is confusing to me that new projects built with the tool use a copy of the AMC library (i.e., it resides in the directory of the newly created project), but the tool itself uses the AMC library from user.lib. Since the new AMC library is incompatible with the old library, it seems that the tool itself should also use its own copy of the library to avoid conflicting with an installation of an older version of the library.

Furthermore, is the newer AMC library availble independently? The only reference I have been able to find for it is here, which explains that it is not available publicly yet but will be available "2011 Q4 or 2011 Q1".

Share this post


Link to post
Share on other sites

Jeff,

I didn't realize that the version that I have is unreleased.

I never liked the idea of forcing the copy of the AMC library into the templates and such, but has proven very useful over time.

I think I only use the current version of the AMC in either the template creator or in the QuickView example.

If it is wrecking your world then I suppose I could build a unique version that has no dependencies, but if we could do that just for you for the moment, that'll work. Hit me up w/ a PM and we can go from there.

It should be quick enough for me

~Norm

Share this post


Link to post
Share on other sites

Hi, Norm,

I can change springboard code myself, so it's not a big deal. But if this tool is intended to be used by the general LabVIEW community, the code should use the older "official" version of AMC to keep it compatible with the AMC library that people may already have installed. Or perhaps it (and the example) should use its own private AMC library, just like the generated code does. Then the code will work no matter which AMC version you have installed.

I previously thought that it would be better to have the generated code refer to the user.lib copy of the AMC library than its own private copy, but I see how having its own private copy avoids any potential conflicts with the user.lib copy.

By the way, do you know if and when the new AMC library will be "official"?

1 person likes this

Share this post


Link to post
Share on other sites

Due to many requests I have added the QSM evolution code shown in the video detailing why the common design pattern of the QSM is a faulty bridge.

 

The attachment is added along w/ the original post up top

Share this post


Link to post
Share on other sites

Nevermind... :)

Edited by Bryan

Share this post


Link to post
Share on other sites

Hello,

 

Apologies if this has been dealt with elsewhere but, is there a TLB' package available for Labview 12, 64-bit running on Windows 7? At present the package manager reports the link near to the top of this discussion is incompatible.

 

Thanks,

 

James

Share this post


Link to post
Share on other sites

Hi Norm,

 

Apologies for the extended delay.

 

Running 12.0f3 64-bit the download above installs fine with VPIM into the 64-bit LV installation. When using LV 64-bit is opened there is no option in the tools menu to create a new TLB' in the same way that there is in the 32bit equivalent.

 

Cheers,

 

James

Share this post


Link to post
Share on other sites

James, I think the above link is wrong.

In VIPM what version of TLB` Are you working with?

Hi Norm,

 

Apologies for the extended delay.

 

Running 12.0f3 64-bit the download above installs fine with VPIM into the 64-bit LV installation. When using LV 64-bit is opened there is no option in the tools menu to create a new TLB' in the same way that there is in the 32bit equivalent.

Share this post


Link to post
Share on other sites

Hi Norm,

 

It's tricky to say. I've installed the VPIM package in your prior reply and it claims all is well, but nothing appears in the list of installed packages for my 64 bit edition of LV 2012. So I tried re-installing it - without any attempt at removal - just to see if anything would happen differently. The resulting screen shot at the point just after the second install is at:

http://www.iceamplifiers.co.uk/randomstuff/LV642012TLBprime_ss.png which I think only shows packages that already existed beforehand.

 

So, very hard to say. It's not clear that any version exists as far as 64-bit is concerned. On the other hand it doesn't throw any errors when installing.

 

On the same machine I have 32 bit LV2012 (same version) with TLB' that reports itself as "TLB Prime - Application Template v1.0.0.11 by NI Systems Engineering"

 

Thanks,

 

James

Share this post


Link to post
Share on other sites

Hi,

 

With this structure, is it possible to handle parallel threads?  Like let say that I have an application work flow that is like a state machine, but I also would like the user to be able to do some action on the front pannel (ex. change a parameter in a user menu, update a maintenance list on the front pannel.)  

 

Of what I understand, if the Action is busy executing a certain task, I'll have to wait that this task is done before executing another action.

 

Thank you for your help.

Share this post


Link to post
Share on other sites

Hello, Coolaid.

 

You are correct.

 

Note though, you can have events defined in the event loop (upper middle on the block diagram) which will en-queue triggers (blue queue wires). For example there is a custom event registration when the TLB' starts up that looks for changes in the front panel and then en-queues "cache user parameters" to the trigger queue. If there is a case for the "cache user parameters" trigger in the present state of the machine (inside case selector on right hand side of the TLB' block diagram) then an action or set thereof may be en-queued to the action queue (which is run by AMC pink queue wires). These actions will be de-queued in the action loop (main loop in the lower middle of the TLB' block diagram) and code held there will be executed to perform the functionality required. You can en-queue multiple actions per trigger if desired.

 

The idea is that this happens all the time, and so fast that the user doesn't notice any delays.

 

Best,

 

James

Share this post


Link to post
Share on other sites
Hi Norm,

 

It's tricky to say. I've installed the VPIM package in your prior reply and it claims all is well, but nothing appears in the list of installed packages for my 64 bit edition of LV 2012. So I tried re-installing it - without any attempt at removal - just to see if anything would happen differently. The resulting screen shot at the point just after the second install is at:

http://www.iceamplifiers.co.uk/randomstuff/LV642012TLBprime_ss.png which I think only shows packages that already existed beforehand.

 

So, very hard to say. It's not clear that any version exists as far as 64-bit is concerned. On the other hand it doesn't throw any errors when installing.

 

On the same machine I have 32 bit LV2012 (same version) with TLB' that reports itself as "TLB Prime - Application Template v1.0.0.11 by NI Systems Engineering"

 

Thanks,

 

James

 

So no other packages give you grief when trying to install to 64 bit?

Also, am I correct in reading that, everything is working ok for the 32 bit version?

 

~Norm

Share this post


Link to post
Share on other sites
Of what I understand, if the Action is busy executing a certain task, I'll have to wait that this task is done before executing another action.

Coolaid

Make sure to segregate your nomenclature. Actions and Triggers.

 

Actions get Queued up by the State machine on the left, in response to Triggers and current Shifter data and design.

 

So yes, only 1 action can be performed at a time, because any list of actions happen on a transition (even if the transition is back to the same state)

That and only 1 transition can happen at a time.

The ideal is that any transition happens fast enough for  your system to be able to timely respond to a specific trigger.

 

If a particular transition can't be broken up to iterative transitions (think, instead of a transition being an entire sweep, it's just 1 iteration of the sweep)

then there is the ability to interject interrupt actions which give you the ability to go back to the brain to see if an important trigger has come in that needs to be handled NOW.

 

If it's a matter of UI updating some kind of UI magic, I would recommend making a Brat VI outside the loops to handle the interaction

Share this post


Link to post
Share on other sites

I love this design pattern. Gotta practice with it when I can.

Share this post


Link to post
Share on other sites

Okay, Norm,

 

I'm soon to embark on a journey through your minds. I'm planning on refactoring an automated test system into using TLB`. Generally speaking, the current program takes a start command from a front panel button OR a boolean output from a VI that runs in a loop that samples an input to a DAQ from a switch. Then it goes through a series of steps like engaging a couple solenoids, reading from a laser displacement meter while adjusting a servo, making adjustments to device parameters, and displaying and logging results.

 

To put it in your framework (tell me if I'm mistaken), I would trigger the start by either an event that catches the start button press and fires off a trigger to "start test", or by having the VI that reads my DAQ's switch input live in the "Idle" action case of the main loop and - what? Have a case in the idle action that sees this and enqueues the "start test" trigger itself?

 

What about subsequent test steps? Should I have the "start test" system trigger case in the idle state case enqueue "first test step, update display" into the action engine (terminology?), and "testing" into the state, etc? Or should I have the transition completion after each action while in the "testing" case result in an "update display" action, possibly using an element in the mothercluster to signal to provide the next step in the test? I guess what I'm really getting at, is how to I intersperse regular display updates in with the steps of a test sequence, or, how do I keep the sequence running without enqueuing all the actions at once when the initial "start test" system trigger is sent?

 

Ryan R.

1 person likes this

Share this post


Link to post
Share on other sites

CoolaidMake sure to segregate your nomenclature. Actions and Triggers. Actions get Queued up by the State machine on the left, in response to Triggers and current Shifter data and design. So yes, only 1 action can be performed at a time, because any list of actions happen on a transition (even if the transition is back to the same state)That and only 1 transition can happen at a time.The ideal is that any transition happens fast enough for  your system to be able to timely respond to a specific trigger. If a particular transition can't be broken up to iterative transitions (think, instead of a transition being an entire sweep, it's just 1 iteration of the sweep)then there is the ability to interject interrupt actions which give you the ability to go back to the brain to see if an important trigger has come in that needs to be handled NOW. If it's a matter of UI updating some kind of UI magic, I would recommend making a Brat VI outside the loops to handle the interaction

Hi Norman, I have been following your TLB prime framework closely. I think it is an excellent framework to use as compared to QSM and other traditional templates that I have come across. There is one concern as you mentioned about a caveat of interrupting actions. I wish to know please how do we overcome this challenge? Do you have a sample program to illustrate this? I am now trying to implement the retired CLD exam on the car wash controller but find it quite hard especially the simulated switches or the elapsed timer condition. Appreciate your reply soon.

 

Alex See

Edited by Hagioteam1

Share this post


Link to post
Share on other sites

Hi Ryan,

 

I have exactly the same question. How do I run a contiguous step of test sequences without enqueuing all the Actions at one go, under the same processing State. Interspersing the Actions with updates and cache user parameters please? Appreciate if Norman or anyone can explain how to go about this. An example I can think of is the retired CLD EXAM on car wash controller. The action of each cycle may be interrupted by the simulated 3 switches (underbody, main pressure and Air Dry).

 

Appreciate any comments or reply please?


I hope there is some sort of support for using this TLB prime framework. It is highly appreciated if there is some help here.

 

Alex See

Edited by Hagioteam1

Share this post


Link to post
Share on other sites

Hi Ryan,

 

I have exactly the same question. How do I run a contiguous step of test sequences without enqueuing all the Actions at one go, under the same processing State. Interspersing the Actions with updates and cache user parameters please? Appreciate if Norman or anyone can explain how to go about this. An example I can think of is the retired CLD EXAM on car wash controller. The action of each cycle may be interrupted by the simulated 3 switches (underbody, main pressure and Air Dry).

 

 

Alex and Ryan et al.

 

There is a basic coding principle that should apply to the 'car wash example' and other ones as well.

"No one action should take longer than is acceptable for the program to react to a new request/trigger"

 

So in short if you need to dwell at a point, as with the car wash example, you should have an idle, <no trigger> transition behavior that goes out, checks the timer and then comes back to the state.

 

For the case where you're not just dwelling on an action and you need to perform a series of actions along a transition that will inherently take longer than what you need to have the program respond to, then there are a few other options.

  1. Make intermediate states that exist along the transition, thus enabling checking new triggers while moving through a transition.

    if no trigger happened that should get in the way of the transition, push the trigger back into the trigger Q and continue on with the next part of the trasition

  2. Break  your one transition into multiple transitions which go into and out of the same state, and have some system variable which can help the state logic know which transition to move to next
  3. You could put some logic inside of the "False" case of the "transition complete" structure of the state machine portion of the code. from there it's up to you how to best complete the rest of the transition you're on given what you're trying to accomplish
  4. As ONLY a last ditch effort, you could actually access the action queue, and jettison your current action. BEWARE however, it is now upon you to be very explicit in ensuring that you end up back at a safe state from wherever you were along the transition.

The most important perspective and question to ponder,

MUST I handle this trigger immediately, if so,

WHAT must happen to handle the trigger,

CAN I break the handling of that trigger up into two sections which would leave the system safe (one that catches and informs the user it will be handled shortly, and then the rest that can be handled down the line in the normal state machine flow.

 

Keep in mind, that most programs that you interact with have some kind of delay for a lot of actions (fractions of seconds to seconds) and they are often glanced over.

Must your program respond faster than what most people are used to having programs respond to. Can it just wait to the end of the current transition

And if your transitions are taking a long time, then that's an indicator to me that you might have too much going on in a single transition.

 

I ran across this last point very recently, where a colleague was prompting the user along a transition in which measurements would be made as well.

For a variety of reasons, (including choosing 'Cancel' in the dialog) it made sense to have a separate state in which  the prompt would be given on the way to the new state (thus preparing the system to be in that new state) and then the idle transition in that new state, which finished up the remaining measurement actions and then at the end of that transitioning back to where he was.

 

See some of the diagrams below for some color

post-208-0-32388600-1422546213.pngpost-208-0-56413400-1422546375_thumb.png

Share this post


Link to post
Share on other sites

Hello Norm or anyone,

 

I am considering adding more User Events to the Framework Data part of the Shifter.  That way, I can make the sequence of actions (in response to some user activity) depend on the outcome of one/some of the early actions.  In the snippet below, the user pushes a button to do a calculation (add two numbers).  If the result is a particular answer (four), something more happens; if not, nothing else happens.

post-4616-0-00203600-1424964737_thumb.pn

 

The thing I don't like about what I've done is that there is no way to encode data into my Paul Event.  I tried changing the User Event definition to be something other than Generic LV Object, but, short of wiring the User Event wire directly through the Primary Execution Loop (maybe that's what I should do?!) I couldn't do it.

 

I guess what I would do next is add a variant or string to the User Data in the shifter.  Then I could put whatever important results I got from the first action(s), into that variant or string.

 

This feels dumb somehow.  Please tell me a better way to go.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now