Exercises in Co-simulation timing¶
A few simple exercises about co-simulation timing
Key Parameters¶
Period: The minimum time resolution a federate will allow.
Offset: a shift in the period. Allowed times for federate grants after time 0 are
offset+N*period
, whereN
is a non-negative integer.Time_delta: the minimum time between grants, i.e. if a federate is granted time T, the next possible time is
T+Time_delta
.
Modifier Flags¶
Uninteruptible: a federate can only be granted requested times
wait_for_current_time_update: specify that a federate should wait until all federates executing at the current time have finished.
Federation Setup [A: period=1; B: period=2; C: period=3]
a. Following time 0, which federate could execute next? A at time 1
b. If all federates execute at all allowed times, what is the next time Federate B could have access to data from Federate C. 4
c. What is the next time all federate will be able to execute simultaneously? 6
Key Principle: Federates are interrupted if there is updated data available and allowed time prior to the requested time
Federation Setup [A: period=1,
wait_for_current_time_update
; B: period=2; C: period=3]a. At what time will the data from Federate B published at time 2, be available to Federate A? 2
b. Federate A requests time 4: Federate B publishes at time 2. What time is Federate A granted? 2
c. Federate A requests time 2: Federate B publishes at time 2. What time does Federate A receive the data? 2
e. If A did not have the
wait_for_current_time_update
flag active, what time would Federate A receive the data? 3Key Principle: Federates are granted the next allowed time after the time specified in a request if they are not interrupted.
Federation Setup [A: period=1; B: period=2,offset=1,time_delta=2; C: period=3]
a. After time=0 what is the next allowable time for Federate B? 3, time=1 is not allowed due to time_delta
b. Federate C requested a time of 4, what time is Federate C granted? 6
Federation Setup [A: period=1; B: period=2,uninterruptible; C: period=3]
a. Federate C Publishes at time 3, Federate B requests time 6, what time will it be granted?6, B cannot be granted anything other than 6 due to uninterruptible flag
b. If Federate B were not uninterruptible what time would it be granted? 4
Federation Setup [A: period=1; B: period=2; C: period=3], Federates will send an update when they have received an update from the all other connected federates. Federate A sends an update at time 0, what is the Update sequence
Time |
Federate(s) |
---|---|
3 |
C |
4 |
B |
4 |
A |
6 |
C |
6 |
B |
6 |
A |
9 |
C |