Changes between Version 29 and Version 30 of Java API
- Timestamp:
- 06/09/15 11:11:34 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Java API
v29 v30 140 140 In MML, submodels are governed by a Submodel Execution Loop. Interpreting this for MUSCLE, this looks like: 141 141 {{{ 142 while (true){142 do { 143 143 state, timeOrigin = init(t0) // we are allowed to receive messages 144 144 while not endCondition() { … … 147 147 } 148 148 finalObservation() // we are allowed to send messages 149 if not restartSubmodel() { 150 break 151 } 152 } 149 } while (restartSubmodel()) // initial condition has a next message 153 150 }}} 154 151 Reading 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. … … 197 194 198 195 If 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 200 196 === Mappers === 201 197