Simulation gets gradually slower if two simulators have different step sizes.

Issue #27 resolved
Stefan Scherfke
created an issue

If two simulators in a scenario have different step sizes (e.g., 1 minute and 1 hour), the simulation gets gradually slower.

Minimal example:

import mosaik


sim_config = {
    'CSV': {
        'python': 'mosaik_csv:CSV',
    },
    'PyPower': {
        'python': 'mosaik_pypower.mosaik:PyPower',
    },
}

START = '2014-01-01 00:00:00'
END = 3600 * 24 * 2
PV_DATA = 'data/pv_10kw.csv'
GRID_NAME = 'demo_lv_grid'
GRID_FILE = 'data/%s.json' % GRID_NAME


def main():
    world = mosaik.World(sim_config)

    pypower = world.start('PyPower', step_size=60*60)
    pvsim = world.start('CSV', sim_start=START, datafile=PV_DATA)

    grid = pypower.Grid(gridfile=GRID_FILE).children
    pvs = pvsim.PV.create(40)

    world.run(until=END)


if __name__ == '__main__':
    main()

If the step size for PyPower is set down from 60 * 60 to just 60, the effect is absent. It becomes more apparent the more the step sizes of both simulators differ.

Note, that the two simulators don’t even need to be connected!

I guess this is some crazy bug in the scheduler.

Comments (1)

  1. Log in to comment