30.07.2015 Views

Proceedings in pdf format. - Sociotechnical Systems Engineering ...

Proceedings in pdf format. - Sociotechnical Systems Engineering ...

Proceedings in pdf format. - Sociotechnical Systems Engineering ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Cycle : (# do Loop: INNER Cycle;restart Loop; :Loop #);A Loop labelled imperative will execute thedescendant's imperatives and then re-run the Loop.A descendant of Cycle could make sure the loop doesnot last forever:TermCycle : Cycle (#Term<strong>in</strong>ate : (# exit TRUE #);InnerAction : (# .. #);doInnerAction;(if Term<strong>in</strong>ate then leave TermCycleif);#);A TermCycle <strong>in</strong>stance will first call the do part ofCycle and after INNER is reached the do part ofTermCycle is activated. After the InnerAction is f<strong>in</strong>ished,Term<strong>in</strong>ate function is asked whether a condition forleav<strong>in</strong>g the loop is matched. If it is, the TermCycle haspassed so the Loop <strong>in</strong> the Cycle super pattern will not berestarted.In this case only a little or no work is saved forprogrammers if they use the Cycle pattern. Its advantageis however well arranged and unified approach to cycl<strong>in</strong>gthrough various structures without the need of know<strong>in</strong>gthe details about what is done <strong>in</strong> the loop and what areterm<strong>in</strong>at<strong>in</strong>g conditions.THE BETASIM FRAMEWORKThere is no support for build<strong>in</strong>g simulat<strong>in</strong>g models <strong>in</strong>the Beta. But it is support<strong>in</strong>g corout<strong>in</strong>es with its quasiparallelsystem.The corout<strong>in</strong>es <strong>in</strong> the Beta are active objects, whichexecute their task and then may suspend. The suspensiondoes mean that the current corout<strong>in</strong>e is pass<strong>in</strong>g theapplication resources to another liv<strong>in</strong>g corout<strong>in</strong>e and thenext corout<strong>in</strong>e is then attached to the program executionstack. When there is no other active corout<strong>in</strong>e wait<strong>in</strong>g <strong>in</strong>the queue the application will term<strong>in</strong>ate. There is nosupport for suspension of a concrete corout<strong>in</strong>e whereas aconcrete corout<strong>in</strong>e may be attached.The BetaSim framework is an abstract layer, whichbr<strong>in</strong>gs the comfort of the Simula programm<strong>in</strong>g languageto simulation models build<strong>in</strong>g <strong>in</strong> the Beta. Thecorout<strong>in</strong>e's <strong>in</strong>terface is enhanced us<strong>in</strong>g a new basic classthat has to have the <strong>in</strong>terface of the process <strong>in</strong> Simula. Itdoes allow to be passivated, cancelled or put <strong>in</strong>to await<strong>in</strong>g state.When the new class supports the “suspension fromoutside”, so a corout<strong>in</strong>e A can send a message to suspendcorout<strong>in</strong>e B, it has then to support schedul<strong>in</strong>g to behavelike <strong>in</strong> Simula. So methods like runAt, runBefore,runAfter have to be added to the framework somehow.A few other Simula capabilities are then added likedistribution functions for random numbers generat<strong>in</strong>g orma<strong>in</strong> process, current process, nextEv process, or lists ofprocesses to the framework to be completely ready forthe use.Of course the BetaSim build process is done alreadyso the programmer users don't have to do the corout<strong>in</strong>esynchronisation and related implementation issuesthemselves and can build a discrete simulation model <strong>in</strong> aquite comfort manner:BetaSIM (#Loader: @|Entity(# ... doL: cycle (# ... #);PASSIVATE#)Discharger: @|Entity(# ... doL: cycle (# ... #);PASSIVATE#)CCar : Entity(#Distance, Velocity, Load<strong>in</strong>gTime,Unload<strong>in</strong>gTime: @<strong>in</strong>teger;Init::< (# ... #)doL: cycle (# doLoad<strong>in</strong>gQueue.<strong>in</strong>to;(if Loader.getIdle thenLoader[]->run if);PASSIVATE;(Distance / Velocity)->HOLD;Discharg<strong>in</strong>gQueue.<strong>in</strong>to;(if Discharger.getIdle thenDischarger[]->run if);PASSIVATE;(Distance / Velocity)->HOLD#)#)Load<strong>in</strong>gQueue: @WaitQueue (# #);Discharg<strong>in</strong>gQueue: @WaitQueue (# #);doAnnual <strong>Proceed<strong>in</strong>gs</strong> of Vidzeme University College “ICTE <strong>in</strong> Regional Development”, 2006122

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!