Folgendes Posting habe ich auf dem usenet in der Gruppe "comp.realtime"
gelesen. Das ist eine gute Gelegenheit die Methodik von VIS auf dem Internet
zu demonstrieren!

Gruss John

----------------------------- forwarded message --------------------------------

Path: starbase1.ping.ch!swidir.switch.ch!univ-lyon1.fr!jussieu.fr!oleane!pipex!
 howland.reston.ans.net!math.ohio-state.edu!news.cyberstore.ca!vanbc.wimsey.com!
 sanjuan.islandnet.com!news
From: johnd@islandnet.com (John Dammeyer)
Newsgroups: comp.realtime
Subject: Re: State Machines
Date: Wed, 14 Jun 1995 09:00:56 -0700 (PDT)
Organization: Automation Artisans Inc.
Lines: 115
Message-ID: <3rmtin$5ds@sanjuan.islandnet.com>
References: <D98uK5.3Gn@freenet.carleton.ca> <D9EBMp.GEI@news.cern.ch> <3quehn$7em@ixnews3.ix.netcom.com> <D9p7CG.Cwp@news.cern.ch>
NNTP-Posting-Host: thetis.islandnet.com
X-Newsreader: Forte Free Agent v0.38


>many people have expressed their interest in this code. I'll try to
>summarize the status and availability of the thing.

>My work started from that of someone else (Paul Jay Lucas at AT&T,
>Paul.J.Lucas@att.com).
>He developed a statechart language extension for C++ in his master
>thesis, the language definition was very nice, and the algorithms
>used for the run time support system (the statechart semantics) were
>wery well done. Neverthanless, this language had several limitations,
>the statechart was global to the C++ source file, therefore you could
>have only one instance of it at a time and couldn't be used in libraries,
>just to model application behaviour...

I'm sorry,  perhaps I am just showing my ignorance here and will end
up looking like a fool but I just don't understand your 'cooked'
example.  Perhaps the use of variable names makes it misleading as to
what is what but I am really confused.

ie: 
machine Stupid : ...
machine Simple : ...

test machine;

machine.Simple::Beta()

I don't understand which machine is which or if machine is simply
overloaded three times and the context determines the ultimate
definition.

Could I ask for a different example such as this simple project:

Lets make a small machine that needs to weigh (or inspect, change,
addto etc.) products and move them to one of two places based on the
result of the operation.

I would construct three state machines to do this:  the first to
handle the processing of the product;  the second to handle the
movement of the product;  the third to handle the product at the main
destination.  The other destination is a large garbage bin.

State machine 1:
Turns on a Request lamp when it wants  a product.

Has a sensor to detect when a product is available.  The product
vibrates a bit so a delay is needed before an accurate weight can be
taken.

It turns off a request lamp,  turns on a weighing lamp, weighs the
product and then tells the second state machine where to take the
product.

It turns off the weighing lamp, waits till the product is gone,  via
the sensor,  and then  requests a new product by turning on the
request lamp.

State machine 2:

Has a mechanical pickup arm and an intelligent controller with three
destination points programmed into it.  The controller waits for a
command to move to the LOAD,  OFFLOAD or GARBAGE position and when the
movement is complete it responds with a 'complete' signal.

It returns to the LOAD position when another product is available;
NOT before,  because then the operation on the product cannot proceed;
the arm gets in the way of product processing.

So in other words,  the arm waits at the OFFLOAD or GARBAGE position
until a product is ready.

The Arm can also be commanded to pickup or drop the product.  This is
a simple on/off control but does require time so a delay is needed.

State machine 3:

Once this state machine is told that the product is available it also
measures the height of the product and if the heght sensor is blocked
it energizes a trapdoor that drops the product into a bag.  If the
height sensor is not blocked it energizes a pusher to push the product
into a bag.  For this example the bags can hold an infinite number of
products.  

Note! 
In a real life machine there would need to be a way to stop and start
the entire sequence when bags were missing or full but I really want a
simple example that demonstrates your OOP technique.

Using conventional case statements and a predefined state machine
block of 'standard boiler plate' code I can have this machine running
and tested in about an hour;  most of the time would be spent typing
and documenting.

Consider this an academic exercise so anyone else that has ideas on
how to solve this problem it might be interesting if you also post
your solutions to this thread.  Leave out initial reset conditions and
intialization so that the solution is obvious rather than buried under
layers of safeties and 'what if the motor doesn't move?' problems.

If I have missed something in the design specifiction let me know too.

On your mark,  get set,  CODE!

John.

PS:  One other little rule.  The implimentation must be readable and
modifyable.  A solution in FORTH that reduces down to three words in
the dictionary is allowed but the defining words in the dictionary
must also be clearly understandable.

The end user may just ask for an inbetween step in motor movement to a
PAUSED position so make your statemachines serviceable.
