Changes between Version 29 and Version 30 of Java API

Show
Ignore:
Timestamp:
06/09/15 11:11:34 (10 years ago)
Author:
jorisborgdorff
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Java API

    v29 v30  
    140140In MML, submodels are governed by a Submodel Execution Loop. Interpreting this for MUSCLE, this looks like: 
    141141{{{ 
    142 while (true) { 
     142do { 
    143143    state, timeOrigin = init(t0) // we are allowed to receive messages 
    144144    while not endCondition() { 
     
    147147    } 
    148148    finalObservation() // we are allowed to send messages 
    149     if  not restartSubmodel() { 
    150         break 
    151     } 
    152 } 
     149} while (restartSubmodel()) // initial condition has a next message 
    153150}}} 
    154151Reading this code step by step, a submodel can be restarted any number of times depending on the couplings, this is what the outer loop does. Next, each time a submodel is started, it has an initialization phase where it determines the initial state and what the simulation time of this initial state should be. Then it enters a while loop while some end condition is not met. Each iteration it sends some observation of the state, and it computes the next state. When the end condition is met, it is possible to do some cleaning and to send a final observation. At the end of the submodel it decides whether it should restart. 
     
    197194 
    198195If restartSubmodel is overridden and returns true, then again init will be called, etc. If the state needs to be stored after restarting, this can be done by setting a field of the class. 
    199  
    200196=== Mappers === 
    201197