Antares Simulator
Power System Simulator
Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType > Class Template Reference

Base implementation for time series variables using CRTP pattern. More...

#include <timeseries_base.h>

Inheritance diagram for Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >:
Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >

Classes

struct  Statistics
 Compile-time statistics calculation. More...
 

Public Types

Type Definitions
using NextType = NextT
 
using AncestorType = Variable::IVariable< Derived, NextT, VCardType >
 
using ResultsType = typename VCardType::ResultsType
 
using VariableAccessorType = VariableAccessor< ResultsType, VCardType::columnCount >
 
- Public Types inherited from Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >
typedef Derived ChildType
 Child.
 
typedef NextT NextType
 Type of the next static variable.
 
typedef IVariable< Derived, NextT, VCardTypeVariableType
 Variable.
 
typedef VCardType VCardType
 VCard.
 
typedef VCardType::ResultsType ResultsType
 List of expected results.
 
typedef VariableAccessor< ResultsType, VCardType::columnCount > VariableAccessorType
 Proxy for accessing to the intermediate results.
 
typedef Storage< VCardType >::ResultsType StoredResultType
 Results.
 

Public Member Functions

void initializeFromStudy (Data::Study &study)
 Initialize the variable from study configuration. More...
 
void initializeFromArea (Data::Study *study, Data::Area *area) noexcept
 Associate this variable with a specific area. More...
 
void initializeFromLink (Data::Study *study, Data::AreaLink *link)
 Initialize from link (for link-based variables) More...
 
void simulationBegin ()
 Reset state at the beginning of simulation. More...
 
void simulationEnd ()
 Cleanup at the end of simulation.
 
void yearBegin (unsigned int year, unsigned int space)
 Setup at the beginning of each year. More...
 
void yearEndBuild (State &state, unsigned int year, unsigned int space)
 Post-processing after year end build. More...
 
void yearEnd (unsigned int year, unsigned int space)
 Finalize year and compute statistics. More...
 
void computeSummary (unsigned int year, unsigned int space)
 Merge year results into global summary. More...
 
void hourBegin (unsigned int hourInTheYear)
 Setup at the beginning of each hour. More...
 
void hourForEachArea (State &state, unsigned int space)
 Process data for each area during an hour. More...
 
void hourEnd (State &state, unsigned int hourInTheYear)
 Cleanup at the end of each hour. More...
 
Antares::Memory::Stored< double >::ConstReturnType retrieveRawHourlyValuesForCurrentYear (unsigned int, unsigned int space) const noexcept
 Retrieve raw hourly values for the current year. More...
 
void localBuildAnnualSurveyReport (SurveyResults &results, int fileLevel, int precision, unsigned int space) const
 Build annual survey report for output. More...
 
- Public Member Functions inherited from Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >
void getPrintStatusFromStudy (Data::Study &study)
 
void supplyMaxNumberOfColumns (Data::Study &study)
 
 IVariable ()
 Default constructor.
 
 ~IVariable ()
 
void initializeFromStudy (Data::Study &study)
 Initialize the variable. More...
 
size_t getMaxNumberColumns () const
 
void initializeFromArea (Data::Study *study, Data::Area *area)
 Initialize the variable with a specific area. More...
 
void initializeFromLink (Data::Study *study, Data::AreaLink *link)
 Initialize the variable with a specific link between two areas. More...
 
void initializeFromThermalCluster (Data::Study *study, Data::Area *area, Data::ThermalCluster *cluster)
 Initialize the variable with a specific thermal cluster. More...
 
void broadcastNonApplicability (bool applyNonApplicable)
 
void simulationBegin ()
 Notify to all variables that the simulation is about to begin.
 
void simulationEnd ()
 Notify to all variables that the simulation has finished.
 
void yearBegin (uint year)
 Notify to all variables that a new year is about to start. More...
 
void yearEndBuild (State &state, uint year)
 Notify to all variables that the year is close to end. More...
 
void yearEndBuildPrepareDataForEachThermalCluster (State &state, uint year, uint numSpace)
 Notify to all variables to prepare data for the close to year end calculations for each thermal cluster. More...
 
void yearEndBuildForEachThermalCluster (State &state, uint year, uint numSpace)
 Notify to all variables that the year is close to end. More...
 
void yearEnd (uint year)
 Notify to all variables that the year is now over. More...
 
void yearEndSpatialAggregates (V &allVars, uint year, unsigned int numSpace)
 
void yearEndSpatialAggregates (V &allVars, uint year, const SetT &set)
 
void simulationEndSpatialAggregates (V &allVars)
 
void simulationEndSpatialAggregates (V &allVars, const SetT &set)
 
void hourBegin (uint hourInTheYear)
 Event: A new hour in the year has just began.
 
void hourForEachArea (State &state)
 Event: For a given hour in the year, walking through all areas.
 
void hourForEachArea (State &state, unsigned int numSpace)
 
void hourForEachLink (State &state, uint numSpace)
 Event: For a given hour in the year, walking through all links.
 
void hourEnd (State &state, uint hourInTheYear)
 Event: A new hour in the year has just ended.
 
void weekBegin (State &state)
 
void weekForEachArea (State &state, uint numSpace)
 
void weekEnd (State &state)
 
void buildSurveyReport (SurveyResults &results, int dataLevel, int fileLevel, int precision) const
 
void buildAnnualSurveyReport (SurveyResults &results, int dataLevel, int fileLevel, int precision, uint numSpace) const
 
void buildDigest (SurveyResults &results, int digestLevel, int dataLevel) const
 
void beforeYearByYearExport (uint year, uint numSpace)
 Event triggered before exporting a year-by-year survey report.
 
void computeSpatialAggregateWith (O &out, uint numSpace)
 Compute the spatial cluster with the results of a single variable. More...
 
void computeSpatialAggregateWith (O &out, const Data::Area *area)
 Compute the spatial cluster with the results of a single variable and a given area. More...
 
const double * retrieveHourlyResultsForCurrentYear (uint numSpace) const
 
void retrieveResultsForArea (typename Storage< VCardToFindT >::ResultsType **result, const Data::Area *area)
 
void retrieveResultsForThermalCluster (typename Storage< VCardToFindT >::ResultsType **result, const Data::ThermalCluster *cluster)
 
void retrieveResultsForLink (typename Storage< VCardToFindT >::ResultsType **result, const Data::AreaLink *link)
 
Antares::Memory::Stored< double >::ConstReturnType retrieveRawHourlyValuesForCurrentYear (uint column, uint) const
 
const StoredResultTyperesults () const
 The results.
 

Static Public Member Functions

template<class R >
static void InitializeResultsFromStudy (R &results, Data::Study &study)
 Static helper to initialize results from study. More...
 
- Static Public Member Functions inherited from Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >
static void InitializeResultsFromStudy (R &results, Data::Study &study)
 Initialize the results of the variable. More...
 
static void RetrieveVariableList (PredicateT &predicate)
 Retrieve the list of all individual variables. More...
 
static void provideInformations (I &infos)
 "Print" informations about the variable tree
 

Static Public Attributes

static constexpr int count = 1 + NextT::count
 Total count of variables in the chain.
 
- Static Public Attributes inherited from Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >
static constexpr uint8_t categoryDataLevel
 
static constexpr uint8_t categoryFileLevel
 

Protected Attributes

Protected Members

Non-owning pointer to the associated area

Data::AreaareaPtr {nullptr}
 
VCardType::IntermediateValuesType yearlyValues
 Intermediate values for each parallel space.
 
unsigned int nbYearsParallel {0}
 Number of parallel years (cached for performance)
 
- Protected Attributes inherited from Antares::Solver::Variable::IVariable< Derived, NextT, VCardType >
StoredResultType pResults
 All the results about this variable.
 
bool * isNonApplicable
 
bool * isPrinted
 
uint pColumnCount
 

Detailed Description

template<typename Derived, typename NextT, typename VCardType>
class Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >

Base implementation for time series variables using CRTP pattern.

  • This class provides the common functionality for all time series variables. It uses the Curiously Recurring Template Pattern (CRTP) to achieve static polymorphism without virtual function overhead.
Template Parameters
DerivedThe derived class (CRTP)
NextTThe next variable in the chain (for variable composition)
VCardTypeThe VCard describing this variable

Derived Class Requirements:

Derived classes must implement these methods:

void initializeDerivedFromStudy(Data::Study& study);
void yearBeginImpl(unsigned int year, unsigned int space);
void hourForEachAreaImpl(State& state, unsigned int space);

Lifecycle Methods:

The simulation follows this lifecycle:

  1. initializeFromStudy() - Setup from study configuration
  2. initializeFromArea() - Associate with specific area
  3. simulationBegin() - Reset state for new simulation
  4. For each year:
  5. simulationEnd() - Cleanup

Memory Management:

The class manages memory automatically using RAII principles:

  • yearlyValues: Automatically sized vector of intermediate values
  • areaPtr: Non-owning pointer to area (managed externally)
  • nbYearsParallel: Cached for performance

Member Function Documentation

◆ computeSummary()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::computeSummary ( unsigned int  year,
unsigned int  space 
)
inline

Merge year results into global summary.

  • Parameters
    yearThe year index
    spaceThe parallel space index

◆ hourBegin()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::hourBegin ( unsigned int  hourInTheYear)
inline

Setup at the beginning of each hour.

  • Parameters
    hourInTheYearHour index within the year (0-8759)

◆ hourEnd()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::hourEnd ( State state,
unsigned int  hourInTheYear 
)
inline

Cleanup at the end of each hour.

  • Parameters
    stateCurrent simulation state
    hourInTheYearHour index within the year

◆ hourForEachArea()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::hourForEachArea ( State state,
unsigned int  space 
)
inline

Process data for each area during an hour.

  • This is where the actual time series data processing happens.
  • Parameters
    stateCurrent simulation state
    spaceThe parallel space index

◆ initializeFromArea()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::initializeFromArea ( Data::Study study,
Data::Area area 
)
inlinenoexcept

Associate this variable with a specific area.

  • Parameters
    studyStudy configuration (unused but kept for interface compatibility)
    areaThe area this variable is associated with

◆ initializeFromLink()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::initializeFromLink ( Data::Study study,
Data::AreaLink link 
)
inline

Initialize from link (for link-based variables)

  • Parameters
    studyStudy configuration
    linkThe link this variable is associated with

◆ initializeFromStudy()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::initializeFromStudy ( Data::Study study)
inline

Initialize the variable from study configuration.

  • This method sets up the variable based on the study parameters, allocates necessary memory, and initializes the result structures.
  • Parameters
    studyThe study configuration containing simulation parameters
  • ## Initialization Steps:

Cache the number of parallel years for performance

  1. Initialize result storage structures
  2. Resize and initialize yearly value containers
  3. Call derived class initialization
  4. Initialize the next variable in chain

◆ InitializeResultsFromStudy()

template<typename Derived , typename NextT , typename VCardType >
template<class R >
static void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::InitializeResultsFromStudy ( R &  results,
Data::Study study 
)
inlinestatic

Static helper to initialize results from study.

  • Template Parameters
    RResults type
    Parameters
    resultsResults structure to initialize
    studyStudy configuration

◆ localBuildAnnualSurveyReport()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::localBuildAnnualSurveyReport ( SurveyResults results,
int  fileLevel,
int  precision,
unsigned int  space 
) const
inline

Build annual survey report for output.

  • Parameters
    resultsSurvey results structure to populate
    fileLevelFile output level filter
    precisionPrecision requirements
    spaceThe parallel space index

◆ retrieveRawHourlyValuesForCurrentYear()

template<typename Derived , typename NextT , typename VCardType >
Antares::Memory::Stored<double>::ConstReturnType Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::retrieveRawHourlyValuesForCurrentYear ( unsigned int  ,
unsigned int  space 
) const
inlinenoexcept

Retrieve raw hourly values for the current year.

  • Parameters
    unusedUnused parameter (kept for interface compatibility)
    spaceThe parallel space index
    Returns
    Const reference to hourly values array

◆ simulationBegin()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::simulationBegin ( )
inline

Reset state at the beginning of simulation.

  • Clears all intermediate values to prepare for a new simulation run.

◆ yearBegin()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::yearBegin ( unsigned int  year,
unsigned int  space 
)
inline

Setup at the beginning of each year.

  • Parameters
    yearThe year index (0-based)
    spaceThe parallel space index

◆ yearEnd()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::yearEnd ( unsigned int  year,
unsigned int  space 
)
inline

Finalize year and compute statistics.

  • Parameters
    yearThe year index
    spaceThe parallel space index

◆ yearEndBuild()

template<typename Derived , typename NextT , typename VCardType >
void Antares::Solver::Variable::Economy::TimeSeriesValuesBase< Derived, NextT, VCardType >::yearEndBuild ( State state,
unsigned int  year,
unsigned int  space 
)
inline

Post-processing after year end build.

  • Parameters
    stateCurrent simulation state
    yearThe year index
    spaceThe parallel space index

The documentation for this class was generated from the following file: