Visit the LabVIEW Wiki Application Design & Architecture Portal
Tags |
(This content has not been tagged yet)
|
![]() |
Feb 12 2004, 01:01 PM
Post
#1
|
|||
|
1 more post to go! Member Posts: 9 Joined: 10-February 04 From: Southampton, U.K. Member No.: 261 LV:7.0 |
Firstly, this is just an extension of Jack Hamiltons ideas on the State Machine Architecture, so credit where credit is due.
I have taken the queued message handler from the NI examples and added a variant to the queue. This enables you to pass data directly to a state, this saves memory if this data only has a short lifetime. It also alows the introduction of a general error handling frame. I have also added the event structure with a 50ms timeout as a frame in the main application. Best thing is to look at the example.. Has anyone employed this architecture before, if so how did it pan-out? Otherwise it would be good to hear your views on this idea. Must stress, I haven't used this in anger yet; i am posting it here for comments. Thanks, Tom. [EDIT: Just spotted some mistakes in the first version i posted here, have updated the file.] This post has been edited by TomWP: Feb 13 2004, 10:59 AM
Attached File(s)
|
||
|
|
|||
| Ad |
Feb 12 2004, 01:01 PM
Post
#
|
||
|
|
|
||
|
|
|||
Feb 18 2004, 11:18 AM
Post
#2
|
|||
|
1 more post to go! Member Posts: 9 Joined: 10-February 04 From: Southampton, U.K. Member No.: 261 LV:7.0 |
OK, have coded an example using this architecture, see below.
Please feel free to download it and comment on it. This post has been edited by TomWP: Feb 19 2004, 02:04 PM
Attached File(s)
|
||
|
|
|||
Feb 18 2004, 04:23 PM
Post
#3
|
|||
|
More Active Member Posts: 26 Joined: 16-February 04 Member No.: 274 LV:7.1
|
QUOTE (TomWP @ Feb 18 2004, 06:18 AM) OK, have coded an example using this architecture have posted it at: www.big-tent.co.uk Please feel free to download it and comment on it. Is this an advertisement? I use the queued state machine and the event structures almost to the point of over use. One method I use passing information in a comma separated string. State,other info. When I dequeue the element I can run the string through a match pattern to match the "," The before match is always the initial state case. The After substring is passed into the state. The state called handles the substring. Variants are useful as well as passing clusters in the queue. I have used both methods but the string approach still is my favorite method. I never worry about needing to change the cluster when I need to pass more information than originally planned. Just add another match pattern inside the state that requires more information.
|
||
|
|
|||
Feb 18 2004, 04:30 PM
Post
#4
|
|||
|
1 more post to go! Member Posts: 9 Joined: 10-February 04 From: Southampton, U.K. Member No.: 261 LV:7.0 |
Sorry, wasn't supposed to be an advert. Have changed it to a post rather than a link. Was just trying to save posting it here.
|
||
|
|
|||
Feb 18 2004, 07:18 PM
Post
#5
|
|||
|
More Active Member Posts: 26 Joined: 16-February 04 Member No.: 274 LV:7.1
|
The download seems to be missing a few files. Program looks clean.
|
||
|
|
|||
Mar 10 2004, 07:37 PM
Post
#6
|
|||
|
I've come back for more. Member Posts: 2 Joined: 10-March 04 Member No.: 301 LV:7.1.1
|
I am not sure I see the the advantage of using variants as compared to flattening and unflattening to string since each data type used to transform the variant back to a the data type is held inside the case structure. The only advantage is the "to variant" primitive is a smaller symbol that "Flatten To String".
OK I am new to the group. How do I get the smiley faces on the note.
|
||
|
|
|||
Mar 11 2004, 04:46 PM
Post
#7
|
|||
|
More Active Member Posts: 26 Joined: 16-February 04 Member No.: 274 LV:7.1
|
As this statement will probably prove I have not used the variant data types much. Yet one advantage I see is the ability to package attributes with the data. Say, what device the information comes from, the date and time information is sent, data type. This information may be set or retrieved and moves with the data. Variant functions seem to be more forgiving. You can coerce a double to an I16 numeric type using the variant functions. Flatten a double and try to bring it back as an I16.
Whether or not one would consider the things I mentioned as an advantage is entirely up to the programmer and the application. I tend utilize the string functions more for queue element and find that when I resort to clusters sooner or later I regret it. As far as using variants is concerned I can see a few possibilities for the variant data type and glad the option is available.
|
||
|
|
|||
Mar 12 2004, 09:11 AM
Post
#8
|
|||
|
More Active Member Posts: 45 Joined: 4-March 04 Member No.: 292 LV:7.0 |
I always use clusters for the queue elements and haven't had any problems aside from transient idiocy on my part.
Are you using strict typedefs for your clusters? -------------------- Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK.
|
||
|
|
|||
Mar 12 2004, 01:20 PM
Post
#9
|
|||
|
More Active Member Posts: 26 Joined: 16-February 04 Member No.: 274 LV:7.1
|
Usually it is the feature creep monster that bites my clusters. Plus it is a hold over from programming on 486 machines with limited resources, keeping the data as flat as possible was more important then.
|
||
|
|
|||
Mar 12 2004, 02:01 PM
Post
#10
|
|||
|
More Active Member Posts: 45 Joined: 4-March 04 Member No.: 292 LV:7.0 |
In conjunction with bundle/unbundle by name everywhere, yes.
-------------------- Dr. Craig Graham, Software Engineer
Advanced Analysis and Integration Limited, UK.
|
||
|
|
|||
Mar 23 2004, 03:42 PM
Post
#11
|
|||
|
Instant Human, just add coffee Premium Member ![]() Posts: 889 Joined: 31-January 03 From: Waterford, CT USA Member No.: 45 Using LabVIEW Since:1992 LV:8.2.1 ,7.1 ,8.0.1
|
QUOTE (Paul A. Rochefort @ Mar 10 2004, 02:37 PM) I am not sure I see the the advantage of using variants as compared to flattening and unflattening to string since each data type used to transform the variant back to a the data type is held inside the case structure. Since the variant carries data type information with it it is possible to create a generic unpacking VI. Also by passing an array of variants rather than just one, (or a cluster) you can have a generic variable/data list that can be passed to subVIs in the State Machine. These subVIs can have a strict typedef VIServer interface _or_ free form front / connector panels and still communicate with the State Machine. This lets you implement the subVIs as plugins. Essentially, with a little extra work you can have arbitrarily complex subVIs plug in to your State Machine, add new ones at any time and never have to change the main state machine interface definition to the subVIs. For a hint of the interface power of variants look up the Universal_Probe.vi that Jim Kring did. This has a generic variant parser built in, which populates a tree control with whatever data type you point to. -------------------- ************************************************************* "Always listen to the experts, they'll tell you what can't be done, and why. Then go do it." ~The Notebooks of Lazarus Long (by Robert Heinlein) *************************************************************
|
||
|
|
|||
Mar 23 2004, 07:00 PM
Post
#12
|
|||
![]() Confucius say: Crowded elevator always smell different to midget Admin ![]() Posts: 2367 Joined: 13-October 02 From: Planet Earth Member No.: 2 Using LabVIEW Since:1994 LV:8.5 ,8.2.1 ,7.1.1
My Blog
My Gallery
|
QUOTE (Michael Ashe @ Mar 23 2004, 10:42 AM) Since the variant carries data type information with it it is possible to create a generic unpacking VI. Also by passing an array of variants rather than just one, (or a cluster) you can have a generic variable/data list that can be passed to subVIs in the State Machine. These subVIs can have a strict typedef VIServer interface _or_ free form front / connector panels and still communicate with the State Machine. This lets you implement the subVIs as plugins. Welcome to the forums Michael Yes, I agree with you 100%. Using variants is much more flexible. I use the array of variants implementation you mention as the main pipeline for passing data to test modules in a test engine. Check out this related post: Passing variant data through string comm link. --------------------
|
||
|
|
|||
![]() ![]() |
| Time is now: 1st December 2008 - 06:48 PM |