A Variable-Step Rollback Algorithm Clause Samples

A Variable-Step Rollback Algorithm. We describe in CSP the rollback MA with variable step that is proposed in [BBG+13]. The sets of termination and discard events are as follows: rbTermEvs(i) = {|▇▇▇▇▇▇▇▇▇▇▇▇▇.▇.▇▇▇▇ , stepCancel.i, doStepOutcome.i.pending|} discardEvs(i) = {|doStepOutcome.i.discard |} i. pending is a termination event because this MA does not support the asynchronous execution of FMU steps. Function decStep decreases a step by some step increment and returns an optional: a ▇▇▇▇▇▇▇▇▇ if subtraction yields a valid step, and the empty set otherwise. decStep(stp, inc) = {stp — inc} if (stp — inc) ≥ 1 A FMI rollback algorithm needs to save the state of the FMUs under its control before executing a step. To support this, we introduce some channels to store a state of some FMU, to read the state of some FMU and to reset the state store: channel storeSt, readSt : ▇▇▇▇▇▇.▇▇▇▇.▇▇ We introduce set FMUStStoreEvs to capture the events that deal with the FMU state store. FMUStStoreEvs = {|storeSt , readSt, reset |} We introduce channels rollback and finishedDoStep, which act as internal events to the processing of simulation steps. Event rollback indicates that a rollback is required; finishedDoStep indicates that all FMUs have executed their simulation steps for some communication time point and step. Process rollback MA (RBMA) takes an indexed collection of FMUs to sim- ulate ifmus, a co-simulation interval cint , the simulation’s allowed max step maxStp and a step increment stpInc; it follows the general structure of MAs depicted in Fig. 4. RBMA(ifmus, cint, maxStp, stpInc) = let TriggerMATerminate = terminateMA SKIP Terminate = MATerminate(ifmus) Startup = StartupFMUs(ifmus, cint ) Execute = startMA Startup; Simulate within Execute Δ Terminate Above, following the MA structure of Fig. 4, we say that the MA execution is interrupted by MA termination. MA execution starts upon event startMA, which is followed by the setup of the FMUs and their simulation. Process Simulate manages the FMU state store in parallel with process Simulate0 synchronised on event set FMUStStoreEvs, which is hidden as those events are internal to Simulate. Process Simulate0 starts the FMU stepping (CarrySteps), which starts with the start time of the co-simulation interval (fst (cint )) and the maximum step size maxStp; if one of the ter- mination events occurs while doing Simulate0 then MA termination is trig- gered. termEvs = consFMIEvs(ifmus, rbTermEvs) Simulate0 = CarrySteps(fst (cint ), maxStp) Θ within Sim...