Transactions can clone themselves. Each Transaction, together with its clones, forms an Assembly set.
Transactions of the same Assembly set can wait for each other. Their proceeding through the model can be synchronized. After being separated,
they can also be gathered and put together again.
With the means reviewed so far, a direct exchange of information between Transactions is impossible.
This problem can be solved by assigning a Transaction to a Group. The parameters of these Transactions are then accessible by other Transactions.
Others can then read the former private parameters or assign them with new values.
In addition to Groups of Transactions there are Groups of values. These are sets for which several set operations are available.
Assembly Sets
An Assembly Set is a number of Transactions which have emerged from cloning or splitting an original Transaction.
For such Xacts, there are different possibilities for synchronizing their proceeding.
Function of Assembly Sets
In a lot of real-life situations, so-called actors (people who take action) have to coordinate or synchronize these actions.
Synchronization means paralleling the sequence of events of two different processes.[Meyers Neues Lexikon Leipzig 1964]
or to parallel the clock. [Großes Fremdwörterbuch Leipzig 1980].
ge("Beispiele","Examples") ?>
Passengers of a bus get off at a motorway service area and continue their journey after getting on the bus again.
An Assembly is put together when all components needed are available.
During the manufacture of two different components there is a time when someone checks if the two fit together.
It is likely that one component has two wait for its matching partner.
There are similar situations at a railway station: Trains wait for each other, so-called connection trains.
At an Airport, passengers and their baggage take different ways. At their destination they wait for each other.
In a restaurant, despite different cooking times, meals ordered at the same table are served at the same time.
In order to reconstruct such processes, GPSS offers the concept of Assembly sets
of Xacts.
An Assembly set is a number of Xacts which have emerged from cloning or splitting an original Xact. They can be gathered, synchronized in pairs
at different positions in the model or be reunited after gathering.
Blocks for Assembly Sets
The Blocks SPLIT, GATHER, MATCH, ASSEMBLE
refer to Assembly sets of Xacts and are described in the following. You will also find examples
for usage of each of these Blocks.
SPLIT
is a Block which creates copies of Xacts belonging to the same Assembly set.
The following table informs about the operands of this Block.
Operand
Content
Description
A
xpr
Number of copies to be created
B
xpr
Block to which the copies are to be branched out. For each created Xact, this is calculated separately and
can therefore take the changing values for the parameter specified in operand C into account.
C
xprPint
Parameter number and -type for continuous numbering of created Xact clones.
The original and each copy get a parameter value incremented by 1.
empty
no numbering
D..G
xprPany
Parameter numbers and -types for clones. If possible, the parameter values of the original are adopted.
empty
Parameter set and -values are adopted from the original.
Xacts of the same Assembly set are linked ring-shaped backwards. The latest Xact points to its predecessor;
the original points to the
lately created Xact. Take a look at the CEC to make sure this is correct. If clones enter a SPLIT Block, clones are created that belong to the original Assembly set.
Example 1
Which numbers do the Xacts get?
ASSEMBLE
is the counterpart to SPLIT:
A number of Xacts belonging to the same Assembly set and specified in the operand A are assembled in such way
that only the Xact which entered first is kept and all others are destroyed.
The first Xact entering an ASSEMBLE
Block has to wait there until the requested number of Xacts of the same Assembly set
has entered this Block as well.
Each Xact entering the Block later than that will immediately be removed from the Assembly set
and be destroyed. Only parameter values of Xacts which entered the Block first are kept.
An ASSEMBLE
Block can deal with several Xacts at a time.
Example 2
Passengers for a flight check in their baggage prior to departure. At arrival, they have to wait for each other.
is a Block in which Xacts of the same Assembly set wait until a number of Xacts defined in the operand A have entered
this Block as well. After reaching this number all gathered Xacts are added to the CEC
according to their priority and entering time.
MATCH
is a Block able to synchronize the proceeding of two Xacts of the same Assembly set. In its operand A the second MATCH Block is given with which it has to be synchronized. That Block must now refer to the first Block of the Match-pair.
OTTO MATCH PAUL
...
PAUL MATCH OTTO
is an example of such a pair. If a Xact enters a MATCH
Block and there is no matching Xact of the same Assembly set in an comparative state in the second Block,
the following operations are activated:
The Xact is removed from the CEC. The comparative bit is set by which the Xact is converted to the comparative state. If an Xact enters a MATCH
Block and there is an Xact of the same Assembly set in the comparative state in the second Block,
the comparative bit of this Xact is set back and the Xact is added to the CEC as the last one of its priority class.
The change-state-bit is set which causes the restart of the CEC before the next update of the system clock.
Example 3
At a railway station two trains have to wait for each other.
Find the equal departure time for both trains!
It is hidden at the end of the text window above.
Example 4
In a restaurant there are different synchronization problems.
First, the waiter/waitress waits until each guest has chosen their meal.
In order to serve the meals at once, the meals wait until the last one is prepared.
Then they wait until two waiters/waitresses are free.
The table is normally cleaned when all guests have finished their meal.
Example 5
The game Happy Families works like this: You have to try and get two or four cards of
the same Assembly set. Using simulation, one can find out how many rounds are necessary to finish the game,
if a certain number of cards, players and certain rules are given.
Groups
Xacts which more and more stand out as the dominating model elements and for which
it becomes more and more obvious that they can be universally used, are still not able to communicate with each
other as described so far.
So far, their attributes, the Parameters, are private. They can make them public e.g. by writing the values of their parameters
into Savevalaues, yet the direct exchange of information between Xacts has not been discussed so far.
Another deficit in the description of GPSS so far is a missing set concept. To find out if a number
is already included in a given set of numbers has been a rather complicated task so far.
The GPSS Group-concept offers a solution for both problems.
ge("Gruppen","Groups") ?>
Groups are permanent, static model elements to which Xacts or numbers belong to. The following Blocks are related to Groups:
Operation
Content
JOIN
Assigning to a Group
REMOVE
Call off Group membership
EXAMINE
Testing Group membership
ALTER
Changing the value of Parameters of Xacts in a Group
SCAN
Read the vaule of a Parameter of a Xact-features in a Group
Groups have only one Numeric Standard Attribute:
G
describes the current number of members or elements in a Group.
In the following, Group-related Blocks are going to be introduced in detail and their usage will be
described by examples.
JOIN
is a Block which assigns a Xact or a value to a Group. Both forms exclude each other. The type of the Group
(Xacts or numeric values) is set when the first Xact enters the Group.
Operand
Content
Description
A
xpr
Name or number of Group
B
xpr
Value to be added to the Group
empty
Xact becomes Group member
Later, if trying to add a numeric value to a Xact Group or a Xact to a Group of values, an error message is produced.
EXAMINE
is a Block, which checks the Group membership of an Xact or a value. It controls the movement of entering Xacts according
to the result of the membership check.
Operand
Content
Description
A
xpr
Name and number of Group
B
xpr
Value of expression is checked for Group membership
empty
The entering Xact is checked for Group membership
C
xpr
Name or number of Block to which Xact is to be moved in case of non-membership
Example 1
For a lottery, 7 out of 49 numbers have to be withdrawn randomly. It is not allowed to withdraw the same number twice.
ALTER
is a Block which allows the alteration of Xact-Parameter values if the Xacts are members of a Group. It alters the Parameter value of one or more Xacts selected by some criteria.
Operand
Content
Description
A
xpr
Name or number of Group
B
xpr
Number of Xacts for which a Parameter value has to be altered
ALL
The Parameter given in operand C has to be altered for all Xacts in the Group.
C
xprPint
Specification of the Parameter to be altered
PR
Change the Priority of selected Xacts of the Group
D
xpr
New value for Xact(s) Parameter
G
xpr
Block to which the entering Xact is transfered, if no Xact is found in the Group
As an operation supplement to ALTER, a comparative operator (L, LE, G, GE, E, NE) or either MIN or MAX can be added. In the first case, the E and F Operands have the following content:
E
xprPint
Specification of a comparative parameter for Xacts of the Group.
The maximum number for which the alteration can be made is the number of Xacts given in B.
PR
Comparative Priority
F
xpr
Comparative value
In the second case, (MIN, MAX
) the operand F is not needed. G contains an alternative exit in case the Group is empty.
Example 2
Some passengers arriving at the central railway station in Magdeburg want to get home by cab. The driver is told the destination.
Therefore the following code is used:
Sudenburg
Buckau
Südost
Cracau
Neustadt
Texas
Stadtfeld
Olvenstedt
In the example above, a Transaction alters the parameter values of another one. In a similar way, for a Transaction it
is also possible to find out the parameter value of another Transaction and put it into its own parameter.
For this, the Block SCAN
has to be used.
SCAN
is a Block which allows an Xact to ask for a parameter value of another Xact, given the fact that it is a member of a Group. SCAN asks for the parameter value of an Xact which has certain features. As an operation supplement, a comparative operator (L, LE, G, GE, E, NE)
or either MIN or MAX can be added. In the first case, theoperands are:
Operand
Content
Description
A
xpr
Name or number of Group which the questioned Xact belongs to.
B
xprPint
Parameter value of the Group member which has to be included in the comparison.
PR
Priority value has to be compared
C
xpr
Comparative value (search for the first Xact in the Group for which the comparison is true).
empty
C remains empty, if MIN or MAX
are given as operation supplements.
D
xprPint
Parameter of the first Xact of the Group fulfilling the term.
PR
Priority of this Xact
E
xprPint
Parameter of the Xact entered in SCAN
which should adopt the value read.
F
xpr
Transfer destination if search failed
Example 4
The running of the restaurant described earlier can now where the exchange of messages between waiter, guest, cook and buffetier
is possible, be modeled as follows:
The last Group-related Block to be introduced is REMOVE.
REMOVE
is a Block, which calls off the membership to a Group . That can either be done term-dependently or independently. As an operation supplement, the comparative operator (L, LE, G, GE, E, NE) or either MIN or MAX can be added.In GPSS/H this is only allowed for Groups of Xacts.
Other GPSS-versions (e.g. SIMDIS) also allow this operation supplement for numeric values and thereby offer
a wide range of selection- and check possibilities for sets.
First of all, the usage of these Blocks for Groups will be described.
Operand
Content
Description
A
xpr
Name or number of Group from which the Xact has to be removed. If no other operand is occupied,
the entering Xact is removed from the Group specified in A given the fact that it is a member.
B
xpr
Maximum number of Xacts to be term-dependently or independently removed from the Group.
ALL
All Xacts have to be removed
C
empty
For Xact-Groups
xpr
Value to be removed
D
xpr
Parameters of Xacts of the Group or their priority as comparative object in connection to the operation supplement.
Those Xacts are removed whose comparative object fulfills the given term. If MIN or MAX are given as the operation supplement, it is searched for the Xact with the smallest or biggest number
as comparative object.
PR
Priority of Xact to be removed
E
xpr
Comparative value to select Xact(s) to be removed
empty
If MIN or MAX are given as operation supplement, E has to be kept empty.
B
xpr
Block as Transfer-destination, if
the Group is empty
no Xacts of the Group fulfill the term
the number given in B is not reached
empty
definitely next Block
For Groups of numeric values A specifies the appropriate Group. The value to be removedis given in the operand C.
Special Functions
There are possibilities to reduce the extent of GPSS/H source code and to modularize programs when using functions of type S and E.
FUNCTION
is a definition statement (already described earlier) for functions of different types.
The operand A always describes the argument in all types of functions. The function type is specified in the operand B.
Functions of the type S
can be used for the assignment between numbers and names of model elements.As symbols there are F, S, Q, L, CH, G, XF, XL, XH, XB, MF, MH, MB, ML, T, FN, V
and BV allowed. For the given model element classes, GPSS/H searches for available matching series of numbers when compiling.
These series can then be given to model elements of these classes.
FTYPS FUNCTION PH1,S4,F,S,Q
1,OBJ1/2,OBJ2/3,OBJ3/4,OBJ4
gives the four names to four facilities, Storages and queues OBJ1 ...OBJ4
and assigns matching internal numbers to them. The order of numbers is arising, but doesn't necessarily have to be unbroken.
That's why the usage of SELECT and COUNT
on such element series is not advisable in general. In connection with such a Function it makes sense to name
the argument values ( e.g. the values of PH1)
as relative numbers and the Function values (internal element numbers) as absolute numbers of the models involved.
Functions of the type E assign current values of Numeric Standard Attributes to their arguments.
FTYPE FUNCTION XH2,E3
2,SM$SAAL/5,QA$KASSE/7,XF13
can have different current function values during each run.
To conclude with, there is a part of a program given below which refers to the restaurant model.
In the extract it is described how the kitchen- and buffet model can be integrated in a single segment.
* 3. W A I T E R*
.................................
ADVANCE V$BTWEG
BORD FUNCTION PH4,S2,XB FUNCTION VALUES: BLOCK NUMBERS2,ORD/3,VTERM
SPLIT 1,FN$BORD
TRANSFER ,BDIEN
.................................
*
* 5. K I T C H E N A N D B U F F E T*
ORDTP FUNCTION PH4,S2,F,V,G,C COMPONENTS FOR BUFFET AND KITCHEN1,BUFF/2,KOCH
ORD SEIZE FN$ORDTP BUFFET/KITCHEN TAKES OFFER ADVANCE V(FN$ORDTP) PREPARATION TIME RELEASE FN$ORDTP BUFFET/KITCHEN BECOMES AVAILABLE JOIN FN$ORDTP
LINK FN$ORDTP,FIFO BEVERAGES/MEALS READY TO BE SERVED VTERM TERMINATE DESTROYING DONE ORDERS*
.........................
With the description of the Group concept, the very Block- saving technique of subprograms and with functions of special types,
our introduction to GPSS/H has now come to an end. In the following chapters GPSS serves as a base for model- and program examples.