AntaresSimulatorTeam / Antares_Simulator

Antares-Simulator is an Open Source power system simulator to quantify the adequacy or the economic performance of interconnected energy systems, at short or remote time horizons.
https://antares-simulator.org
Other
58 stars 24 forks source link

Simplification of of ISimulation design #1540

Open sylvlecl opened 1 year ago

sylvlecl commented 1 year ago

Description

Class ISimulation has a complex design for no added value: it inherits from a template implementation type, which contract is not explicit.

Instead, we should use a very simple design with composition:

class Simulation {
public:
...
private:
    std::unique_ptr<SimulationImpl> implementation;
};

class SimulationImpl {
public:
    virtual void setNbPerformedYearsInParallel(uint nbMaxPerformedYearsInParallel) = 0;
    bool simulationBegin() = 0;
    bool year(Progression::Task& progression,
              Variable::State& state,
              uint numSpace,
              yearRandomNumbers& randomForYear,
              std::list<uint>& failedWeekList,
              bool isFirstPerformedYearOfSimulation) = 0;
    void incrementProgression(Progression::Task& progression) = 0;
    void simulationEnd() = 0;
    void prepareClustersInMustRunMode(uint numSpace) = 0;
    void initializeState(Variable::State& state, uint numSpace) = 0;
};

class Economy : public SimulationImpl {
...
};
class Adequacy : public SimulationImpl {
...
};
payetvin commented 4 months ago

would reduce compile time