Antares Simulator
Power System Simulator
links.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 #ifndef __ANTARES_LIBS_STUDY_LINKS_H__
22 #define __ANTARES_LIBS_STUDY_LINKS_H__
23 
24 #include <set>
25 
26 #include <yuni/yuni.h>
27 #include <yuni/core/noncopyable.h>
28 #include <yuni/core/string.h>
29 
30 #include <antares/array/matrix.h>
31 #include <antares/exception/LoadingError.hpp>
32 #include <antares/series/series.h>
33 #include <antares/solver/ts-generator/prepro.h>
34 #include <antares/study/version.h>
35 #include <antares/writer/i_writer.h>
36 
37 #include "../fwd.h"
38 
39 namespace Antares::Error
40 {
41 class ReadingStudy final: public LoadingError
42 {
43 public:
44  ReadingStudy();
45 };
46 } // namespace Antares::Error
47 
48 namespace Antares::Data
49 {
50 struct CompareLinkName;
51 
57 class AreaLink final: public Yuni::NonCopyable<AreaLink>
58 {
59 public:
61  using Vector = std::vector<AreaLink*>;
63  using Set = std::set<AreaLink*, CompareLinkName>;
65  using Map = std::map<AreaName, AreaLink*>;
66 
67  using NamePair = std::pair<Yuni::String, Yuni::String>;
68 
69 public:
71 
72 
75  AreaLink();
77  ~AreaLink();
79 
80  bool loadTimeSeries(const StudyVersion& version, const std::filesystem::path& folder);
81 
82  void storeTimeseriesNumbers(Solver::IResultWriter& writer) const;
83 
85 
86 
89  void detach();
91 
93 
94 
100  void reverse();
101 
102  void resetToDefaultValues();
103 
109  bool forceReload(bool reload = false) const;
110 
114  void markAsModified() const;
116 
117  bool isVisibleOnLayer(const size_t& layerID) const;
118 
119  Yuni::String getName() const;
120 
121  bool isLinkPhysical() const;
122  void overrideTransmissionCapacityAccordingToGlobalParameter(GlobalTransmissionCapacities tc);
123 
124 private:
125  bool linkLoadTimeSeries_for_version_below_810(const std::filesystem::path& folder);
126  bool linkLoadTimeSeries_for_version_820_and_later(const std::filesystem::path& folder);
127  NamePair getNamePair() const;
128 
129 public:
131 
132  Area* from;
137 
140 
142 
143 
148  TimeSeries directCapacities;
149  TimeSeries indirectCapacities;
150 
153 
155  bool usePST;
156 
159 
161  // previously called copper plate
162  LocalTransmissionCapacities transmissionCapacities;
164 
166  AssetType assetType;
167 
169 
170 
176  uint index;
185 
187 
188  Yuni::String comments;
193 
195 
196  uint filterSynthesis;
201 
203  int color[3];
205  StyleType style;
208 
209  friend struct CompareLinkName;
210 }; // class AreaLink
211 
212 struct CompareLinkName final
213 {
214  inline bool operator()(const AreaLink* s1, const AreaLink* s2) const
215  {
216  return s1->getNamePair() < s2->getNamePair();
217  }
218 };
219 
220 } // namespace Antares::Data
221 
222 #endif // __ANTARES_LIBS_STUDY_LINKS_H__
Definition for a single area.
Definition: area.h:51
Version of a study.
Definition: version.h:36
Definition: series.h:42
This class is used to represent the generic time series.
Definition: series.h:65
Definition: LoadingError.hpp:30
Definition: links.h:42
A n-by-n matrix.
Definition: matrix.h:44
Definition: i_writer.h:32
Definition: links.h:213