Antares Simulator
Power System Simulator
timeSeriesSet.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #pragma once
22 
23 #include <stdexcept>
24 #include <string>
25 #include <vector>
26 
27 #include "dataSeries.h"
28 
29 namespace Antares::Optimisation::LinearProblemDataImpl
30 {
32 {
33 public:
34  explicit TimeSeriesSet(std::string name, unsigned height);
35  explicit TimeSeriesSet(std::string name, std::vector<std::vector<double>>&& tsSet);
36  void add(const std::vector<double>& ts);
37  void add(std::vector<double>&& ts);
38  double getData(unsigned tsNumber, unsigned hour) const override;
39  [[nodiscard]] std::span<const double> getData(
40  LinearProblemApi::IScenario::TimeSeriesNumber tsNumber,
41  unsigned firstHour,
42  unsigned lastHour) const override;
43 
44 private:
45  unsigned height_ = 0;
46  std::vector<std::vector<double>> tsSet_;
47 
48 public:
49  class AddTSofWrongSize final: public std::invalid_argument
50  {
51  public:
52  explicit AddTSofWrongSize(const std::string& name,
53  const size_t& tsSize,
54  const unsigned& height);
55  };
56 
57  class Empty final: public std::invalid_argument
58  {
59  public:
60  explicit Empty(const std::string& name);
61  };
62 
63  class RankTooBig final: public std::invalid_argument
64  {
65  public:
66  explicit RankTooBig(const std::string& name, unsigned rank, unsigned tsSetSize);
67  };
68 
69  class HourTooBig final: public std::invalid_argument
70  {
71  public:
72  explicit HourTooBig(const std::string& name, unsigned hour);
73  };
74 };
75 
76 } // namespace Antares::Optimisation::LinearProblemDataImpl