Closed markaren closed 3 years ago
No, I'm pretty sure it is correct. If we didn't increment the step count between them, then all simulators would be expected to finish their individual step within one "group" step.
Here is an example of how it's supposed to go, assuming we have two simulators A and B with decimation factors 1 and 2, respectively:
stepCounter_ = 0
.algorithm::do_step()
call:
stepCounter_ % info.decimationFactor == 0
for both A and B, both get their do_step()
functions called. (Now note: only A is supposed to finish within the current time step. B needs two steps.)stepCounter_
to 1stepCounter_ % info.decimationFactor == 0
only for A, we only add A to the list of finished simulators and later transfer its variables.algorithm::do_step()
call:
stepCounter_ % info.decimationFactor == 0
only for A, only A gets its do_step()
function called. (B is still working on the step that was initiated earlier.)stepCounter_
to 2stepCounter_ % info.decimationFactor == 0
for both A and B, we add both to the list of finished simulators and later transfer both simulators' variables. Aight, got it. Seems valid.
https://github.com/open-simulation-platform/libcosim/blob/237178e6aec4dc6f741cda43b5db43e517c0eb2e/src/cosim/algorithm/fixed_step_algorithm.cpp#L208
stepCounter
is incremented between two for loops that checks its value. This has to be wrong? Would lead to data not being transferred at the correct step?