% The MatlabGPSS toolbox represents a modified subset of the GPSS block set in MATLAB. % Moreover, it supports the combination of classic GPSS commands with MATLAB % expressions and it contains extensions for modeling and simulation of hybrid % systems using MATLAB's ODE solver or the SIMULINK engine. % The toolbox was originally developed using MATLAB version 5.3. % Later it was ported to MATLAB version 7.5. % If you are using the toolbox, check the integrated example models. % This is version 1.2, June 2009 % % Copyright (c) 1997-2009 % Institute of Automatic Control, University of Rostock, Germany, % Research Group Computational Eng. & Automation, HS Wismar, Germany. % All rights reserved. % Authors: W. Drewelow, T. Pawletta, S. Pawletta, M. Kirchhoff, R. Kaehler % % % Toolbox directories % GPSSFULL-BASIC1.2 ... tbx. home (~) directory % ~/DOC ... simple documentations % ~/EX_DISC ... examples of discrete models % ~/EX_MIXED ... examples of hybrid models % ~/MYMODELS ... two very general discrete models, % moreover it is a good working directory for your models % ~/NEW ... new tbx. developments % ~/PARSER ... the MGPSS parser % ~/RAND ... random number generators % ~/SNA ...Standard Numerical Attribute & Xact Parameter fcn. % ~/SNA_NEW ... more SNA fcn., but not fully tested! % % Integration of the tbx. into the MATLAB system % Adapt the path definitions in the variables GPSSPATH and MPATH in ~/setpath.m % and invoke the script setpath % % General hints & working procedure % In a MatlabGPSS program classical GPSS block commands and MATLAB expressions % can be combined in a nearly unlimitted fashion (see examples in ~/EX_DISC and % ~/MYMODELS). % Moreover, hybrid models can be simulated. Continous model parts have to be % coded as MATLAB odefiles or in SIMULINK (see examples in ~/EX_MIXED). In this % case the GPSS scheduler works together with the MATLAB solver ODE23 or the % SIMULINK engine. % A MatlabGPSS program has to be coded as script file with file extension gpss. % A good template may be the program ~/MYMODELS/00EXAMPLES.GPSS. % A model file *.gpss has to be executed by the runtime commands PREPARE and % SCHEDULE at the MATLAB prompt or by calling them from a MATLAB program % (see Runtime commands). % A MatlabGPSS program can consist of 3 different sections, introduced by % declaration controls (see Declaration controls for model description,...). % MatlabGPSS programs can define specific input and output arguments (see % Declaration controls for simulation input and output parameters). % Static entities are defined by numerical identifiers or named identifiers. % Named identifiers have to be declared (see Declaration controls for static % entities). % % Runtime commands % Translation of the model source file .gpss into the internal representation: % prepare('modelfile.gpss') % Simulation: % [outparameters]=... % schedule(termination_counter,debug_flag,inparameters) % Presentation of the statistical results: % printstat % ATTENTION: Only one internal representation at the same time is possible. % Schedule executes the last generated internal representation. % Prepare is not a compiler! Most Syntax errors are first % recognized during model execution by schedule. % % Declaration controls for model description, initial and final commands % (starting in 1st column of the source file): % model ...introduces model section % init ...introduces initialization section % final ...introduces finalization section % ATTENTION: GPSS commands or MATLAB expressions have to be coded % in one line (also structured expressions like if,else,end). % % Declaration controls for simulation input and output parameters % (starting in 1st column of the source file): % inparms % outparms % % Declaration controls for static entities % (starting in first column of the source file): % facilities % storages % queues % logicals % chains % ATTENTION: Use a unique identifier (name) for each static entity. % % Block commands % (should not begin in the 1st column of the source file !!!) % (identifiers beginning in the 1st column are interpreted as controls or labels!!!) % (all parameters have to be defined, no default parameters) % generate(A,B,C,D,E) creates Xact % terminate(A) destroys Xact % advance(A,B) delays Xact % seize(A) captures facility % release(A) releases facility % enter(A,B) captures storage % leave(A,B) releases storage % queue(A,B) enters queue % depart(A,B) leaves queue % split(A,B,C) creates copies in the assemble set % gather(A) collects Xacts of the assemble set % assemble(A) collects and summarizes Xacts of assemble set % priority(A) sets priority of Xact % mark(A) sets time stamp % logic_s,_r,_i (A) changes state of logic switch % gate_fnu,_fu (A,B) branches depending on the facility state % gate_lr,_ls (A,B) branches depending on the logic switch state % gate_se,_sf,_sne,_snf (A,B) branches depending on the storage state % buffer reordering of the current event chain % link(A,B,C) moves Xact from CEC to user chain % unlink(A,B,C,D,E,F) moves Xact from user chain to CEC % preempt(A) preempts a Xact controlling a facility % ret(A) ends the preempting of a facility % transfer(A) unconditional jump % transbr(A) calls a subroutine % retsbr returns from a subroutine % selectmax(A,B) gets the index of the largets element % selectmin(A,B) gets the index of the smallest element % MATLAB commands can also be used as blocks % % Discrete blocks for hybrid simulation % detect(A,B,C) % c_hold(A) % c_operate(A) % % Real time clock commands % sync0() initializes real time counting % sync() delays Xact until real time has reached sim. time % % Random Number Generators: % (Parameter genno means random generator number) % cuniformd(genno,a,b)........continuous uniform distribution % duniformd(genno,a,b)........discrete uniform distribution % contrandd(genno,prob_tab)...continuous empirical distribution % discrandd(genno,prob_tab)...discrete empirical distribution % expod(genno,mue)............exponential distribution % triangd(genno,a,b,c)........triangular distribution % ATTENTION: For repeateable and compareable simulation runs use this % generator functions. All uniform distributions generated using % parameters A and B of GENERATE and ADVANCE blocks are based % on the same random number stream. % % Property & Standard Numerical Attribute (SNA) FCN. % T..............gets the current simulation time % P(idx,Value)...sets value of the Xact parameter specified by Index % P(idx)....gets the value of the Xact parameter specified by Index % Q(idx)....gets current length of the queue by Index % QA(idx)...gets mean length of the queue by Index % F(idx)....gets the state of the facility by index % FR(idx)...gets the fractional utilization of facility by Index % S(idx)....gets the current contents of the storage by index % % For more SNAs see ~/SNA_NEW (ATTENTION: Not fully tested!), % documented in ~/DOC/doc_SNA_en.html