Antares Simulator
Power System Simulator
ILinearProblemData.h
1 
2 /*
3  * Copyright 2007-2025, RTE (https://www.rte-france.com)
4  * See AUTHORS.txt
5  * SPDX-License-Identifier: MPL-2.0
6  * This file is part of Antares-Simulator,
7  * Adequacy and Performance assessment for interconnected energy networks.
8  *
9  * Antares_Simulator is free software: you can redistribute it and/or modify
10  * it under the terms of the Mozilla Public Licence 2.0 as published by
11  * the Mozilla Foundation, either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Antares_Simulator is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * Mozilla Public Licence 2.0 for more details.
18  *
19  * You should have received a copy of the Mozilla Public Licence 2.0
20  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
21  */
22 
23 #pragma once
24 
25 #include <span>
26 #include <string>
27 #include <vector>
28 
30 {
34 class FillContext final
35 {
36 public:
37  FillContext(unsigned localFirstTimeStep,
38  unsigned localLastTimeStep,
39  unsigned globalFirstTimeStep,
40  unsigned globalLastTimeStep,
41  unsigned year):
42  local{localFirstTimeStep, localLastTimeStep},
43  global{globalFirstTimeStep, globalLastTimeStep},
44  year_(year)
45  {
46  }
47 
48  [[nodiscard]] unsigned getLocalFirstTimeStep() const
49  {
50  return local.first;
51  }
52 
53  [[nodiscard]] unsigned getLocalLastTimeStep() const
54  {
55  return local.last;
56  }
57 
58  [[nodiscard]] unsigned getGlobalFirstTimeStep() const
59  {
60  return global.first;
61  }
62 
63  [[nodiscard]] unsigned getGlobalLastTimeStep() const
64  {
65  return global.last;
66  }
67 
68  [[nodiscard]] unsigned int getLocalNumberOfTimeSteps() const
69  {
70  return local.last - local.first + 1;
71  }
72 
73  [[nodiscard]] std::vector<unsigned> getSelectedScenarios() const
74  {
75  return selectedScenario;
76  }
77 
78  void addSelectedScenarios(unsigned scenario)
79  {
80  selectedScenario.push_back(scenario);
81  }
82 
83  [[nodiscard]] unsigned getYear() const
84  {
85  return year_;
86  }
87 
88 private:
89  std::vector<unsigned> selectedScenario;
90 
91  struct LocalTimeInterval
92  {
93  unsigned first = 0; // included
94  unsigned last = 0; // included
95  };
96 
97  struct GlobalTimeInterval
98  {
99  unsigned first = 0; // included
100  unsigned last = 0; // included
101  };
102 
103  LocalTimeInterval local;
104  GlobalTimeInterval global;
105 
106  unsigned year_ = 0;
107 };
108 
114 {
115 public:
116  virtual ~ILinearProblemData() = default;
117 
118  [[nodiscard]] virtual double getData(const std::string& dataSetId,
119  unsigned timeSeriesNumber,
120  unsigned hour) const
121  = 0;
122  [[nodiscard]] virtual std::span<const double> getData(const std::string& dataSetId,
123  unsigned timeSeriesNumber,
124  unsigned firstHour,
125  unsigned lastHour) const
126  = 0;
127 };
128 
129 } // namespace Antares::Optimisation::LinearProblemApi
Context for filling linear problem data. Contains temporal information.
Definition: ILinearProblemData.h:35
Interface for linear problem data. Provides a method to retrieve data for a specific dataset,...
Definition: ILinearProblemData.h:114
Namespace for the classes related to the linear problem API.
Definition: SimulationTableGenerator.h:41