Discrete Event Simulation using McSimAPN.
MJMcCann-Consulting

Petri Net basis chosen for McSimAPN
MJMcCann-Consulting Logo

Methods of Discrete Event Simulation.
Discrete events are modelled as taking place at instants of time and when they take place the model system instantaneously changes state.
For example:
a server (assistant) becomes busy with a customer.
a computer programme starts work on a procedure,
someone joins a group (set membership changes)
That state persists until a subsequent time when another event takes place to change it.
For example:
In starting work the end time is defined,
Some event modifies the time at which another event will take place,
One way to represent such activities in a computable model is to keep a list of event times (called an event chain ) and corresponding actions, keeping the list updated whenever something happens to define a future event. Such modelling systems can be very powerful (Simscript, Simula, ModSim and others are examples. They are special programming languages. They require code to be written to define the events and and state changes. In operation computed time moves by leaps and bounds to the time of the next event.

An alternative is a Petri-Net approach, in which the key events are transitions. Tokens move through them from one place (holder, container) to another. The listing of the tokens in the places is called a marking. The idea was formalized by Carl Adam Petri in the early 1960s.. You can find out more at the PetriNet website or from texts such as "Peterson, James L., Petri Net Theory and the modeling of systems, Prentice hall, 1982, ISBN 0-13-661983-5" .
My choice of Petri Nets was somewhat accidental. I was trying to make a minimalist programme to compute the behaviour of an automated factory having found that the original model used by the builders was seriously deficient.
I concluded that to represent the multiple processes where product was mated with tools and worked on, passed along conveyors and put through inspections and batching, I needed modules that had at least two input and two output connections to link them to places where the products and tools could reside between the process operations. The programme worked OK.
A couple of years later a friend pointed out that what I had was really a Petri Net, and pointed out its use in the design and proving of computer programmes.

Specifically the McSim Petri Nets are timed, monochromatic PNs. "Monochromatic" because the tokens are indistinguishable. However, their location (place, in a container or in an A- B- or D-block) is implicitly definitive of their type and behaviour.
Conservation Law: If you make sure that all tokens are either circulated or at least never destroyed, then they can be counted at any time to verify the model at least has that right.
"Timed" because the key component, the Activity block type, has an input transition into a place with a defined residence time. The token leaves by a second transition if the next place is clear, otherwise the second transition can be blocked.
The other essential block type is the place or container which always has some maximum nominal capacity.
A conveyor belt can be modelled by a set of the activity blocks with shared (end) containers but more flexibility comes from making it a special unit.
I have added a diverter (originally envisioned as an inspector or test equipment), so the block types are:
A: Activity/Action: a process that takes time (but zero time is allowed)
B: Belt (conveyor): Moves tokens along at a chosen rate
C: Container (place): Passive, Stores tokens or provides a constant value
D: Diverter: randomly delivers tokens to either of two places (containers)
Individual A, B and D blocks look after their own timing, waiting till the independent time variable reaches their own next event time so no event chain is needed and the blocks can be used in conjunction with analogue computer blocks. The overall effect is that a network of blocks stands for a network of physical (or computational) processes and its behaviour in time is displayed in the movement and accumulation of tokens. They can be timed randomly or regularly and A-blocks can act instantaneously (zero time delay) to provide routing control. For this see the discussion about operation.

Variants and extensions
The default idea is that each Activity looks for an available token on each of its (if connected) input links.
The extension is to allow it to look for either full loads in the relevant containers or require a certain number of tokens to be taken in. This allows batching (packaging) of items.
As the whole McSim APN programme uses floating point numbers, this is naturally extended to requiring specific quantities (e.g. of materials).
Activity blocks can dump full loads to recipient containers if there is room.
Belts have similar input properties, taking in either individual tokens (default) or full loads only or up to a limited level.
For example: a bus in service can pick up travellers only up to its own capacity. The sequence of buses is like a conveyor belt which can have random event (movement) times.

The merging of a Petri Net modelling format with the block structured continuous systems (analogue) modelling framework in the rest of the McSimAPN repertoire allows Activity Blocks (and conveyor Belts) to link to integrators (which are naturally accumulators) in both input and output directions as well as to Containers (places).
The analogue computer components or the Excel programmable user block can can measure the performance of and control the Petri Net processes.

MJMcCann-Consulting

Help Index:
Index/Search

Background
Simulation Concepts
Continuous Systems
Discrete Systems
McSimAPN Structure
McSimAPN Operation

Using McSimAPN
Start McSimAPN
Save Model,data
Create Blocks
Run-Hold-Reset
Link Excel+VBA

PetriNet Block Types
A activity/action
B belt conveyor
C container/constant
D diverter(random)

Analogue Block Types
E exponents
F flux/flow
G function Generator
H hysteresis
I integrator
J inductor
K logic element
L logarithms
M memory
N note/label
O oscilloscope/graph
p not assigned
Q quantizer/rounding
R relay on/off
S sin/asin/atan
T timer/clock
U user link Excel
V visual voltmeter
W sWitch selector/MUX
X multiply
y not assigned
Z random (fuZZ)
& signed summation
% division/difference
@ access/move values

Invitation. McCann can help if you have a design or operational problem that needs some technical support that is outside your team's experience, some quantitative assessment of what is really the cause of the difficulties, some design alternatives or just a fresh look by an intelligent interrogator.
If you have a problem with the behaviour of a market sector, plant, process or item of equipment and would like to get a quantitative handle on it to improve yield or optimise performance, then contact us. We are always ready to give a little time to discuss a new puzzle, in confidence, of course. We'll only worry about fees when we have some defined work. We can be flexible about how we work with you.
Top
MJMcCann-Consulting,
POB 902,
Chadds Ford PA
19317 USA.
T: 1 302 654-2953
F: 1 302 429 9458
E: mjmccann@iee.org
Request. Please let us know how you found this software and your interests by sending an email to mjmccann@iee.org Thank you Date: 2012.02.26
File: discr.htm