90 likes | 242 Views
Advantages of Modular Models. Safe experiments Optimization of efficiency Easy reconfigurability Reuse of modules. Module. Modules. A module handles elements A channel connects two modules A channel is used for exchanging either Elements or Events. Channel. Module. Module.
E N D
Advantages of Modular Models • Safe experiments • Optimization of efficiency • Easy reconfigurability • Reuse of modules
Module Modules • A module handles elements • A channel connects two modules • A channel is used for exchanging either • Elements or • Events Channel Module Module Module Channel Channel
Abstract Module Types • A module is either • Active • Active link • Active consumer • Passive • Passive link • Passive consumer Active Module Passive Module Get Element Active Module Element Event Element
Specialized Module Types • Passive • Conveyer (parameterized length) • Press • Active • Robot (parameterized behavior)
C2 Conveyer S S ActiveConsumer Channel B Channel P Environment R S Robot Press S C1 A A/B Channel B Conveyer Channel Channel S Modular model of case study
Initializing the model(Static configuration) system CS instancevariables publicstatic conveyer1 : Conveyer := new Conveyer(); publicstatic conveyer2 : Conveyer := new Conveyer(); publicstatic robot1 : Robot := new Robot(); publicstatic press1 : Press := new Press(); publicstatic consumer1 : ActiveConsumer := new ActiveConsumer(); publicstatic attachments : seqof Global`Attachment := [ mk_Global`Attachment(conveyer1,<p2>,robot1,<p4>), mk_Global`Attachment(robot1,<p2>,press1,<p1>), mk_Global`Attachment(press1,<p1>,robot1,<p2>), mk_Global`Attachment(robot1,<p1>,conveyer2,<p1>), mk_Global`Attachment(conveyer2,<p2>,consumer1,<p1>) ]; cpu1 : CPU := new CPU(<FCFS>,1E06); cpu2 : CPU := new CPU(<FCFS>,1E06); cpu3 : CPU := new CPU(<FCFS>,1E06); […] bus1 : BUS := new BUS(<FCFS>,1E06,{cpu1,cpu2,cpu3,cpu4,cpu5,cpu6,cpu7}); operations public CS: () ==> CS CS() == ( cpu1.deploy(conveyer1); cpu2.deploy(robot1); cpu3.deploy(press1); cpu4.deploy(conveyer2); cpu7.deploy(consumer1); ); end CS
Initializing the model(Dynamic initialization) dcl ms:setof Module := {}; ( for a in CS`attachments do ( a.Source.attach(a.SourcePos, a.Sink, a.SinkPos); ms := ms union {a.Sink,a.Source} ); forall m inset ms do start(m) );
Measuring Delay • Timestamps are added to elements • Input time • Output time • A sequence of elements are fed to the first module CS`conveyer1.putElement(mk_Global`ElementData(1, time, 0)); duration(1000)skip; CS`conveyer1.putElement(mk_Global`ElementData(2, time, 0)); duration(1000)skip; CS`conveyer1.putElement(mk_Global`ElementData(3, time, 0)); • Outgoing elements are logged by consumer module • Logfile: [ mk_Global`ElementData( 1, 2444, 11013 ), mk_Global`ElementData( 2, 3812, 16765 ), mk_Global`ElementData( 3, 5142, 23105 ) ]