Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
ActiveLinks.h
1
2#ifndef ANTARESXPANSION_ACTIVELINKS_H
3#define ANTARESXPANSION_ACTIVELINKS_H
4
5#include "antares-xpansion/lpnamer/model/Candidate.h"
6
7#include <unordered_map>
8
9#include "antares-xpansion/lpnamer/model/ChronicleMapProvider.h"
10#include "antares-xpansion/xpansion_interfaces/LogUtils.h"
11#include "antares-xpansion/lpnamer/helper/ProblemGenerationLogger.h"
12
13using LinkName = std::string;
14
16 public:
17 ActiveLink(int idLink, const std::string& linkName, const std::string& linkor,
18 const std::string& linkex,
19 const double& already_installed_capacity,
20 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
21 ActiveLink(int idLink, std::string linkName, std::string linkor,
22 std::string linkex, const double& already_installed_capacity,
23 std::map<unsigned, unsigned> mc_year_to_chronicle,
24 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
25
26 void setAlreadyInstalledLinkProfiles(
27 const std::vector<LinkProfile>& linkProfile);
28
29 void addCandidate(const CandidateData& candidate_data,
30 const std::vector<LinkProfile>& candidate_profile);
31 [[nodiscard]] const std::vector<Candidate>& getCandidates() const;
32
33 [[nodiscard]] double already_installed_direct_profile(size_t timeStep) const;
34 [[nodiscard]] double already_installed_indirect_profile(
35 size_t timeStep) const;
36 [[nodiscard]] double already_installed_direct_profile(size_t chronicle_number,
37 size_t timeStep) const;
38 [[nodiscard]] double already_installed_indirect_profile(
39 size_t chronicle_number, size_t timeStep) const;
40
41 [[nodiscard]] unsigned get_idLink() const;
42 [[nodiscard]] LinkName get_LinkName() const;
43 [[nodiscard]] std::string get_linkor() const;
44 [[nodiscard]] const std::string& linkor() const;
45 [[nodiscard]] std::string get_linkex() const;
46 [[nodiscard]] const std::string& linkex() const;
47 [[nodiscard]] double get_already_installed_capacity() const;
48
49 [[nodiscard]] std::map<unsigned int, unsigned int> McYearToChronicle() const {
50 return mc_year_to_chronicle_;
51 }
52
53 [[nodiscard]] unsigned long number_of_chronicles() const;
54
55 private:
56 std::map<unsigned, unsigned> mc_year_to_chronicle_;
57 unsigned int _idLink;
58 LinkName _name;
59 std::string _linkor;
60 std::string _linkex;
61 // Sur le lien capacité à ne pas toucher
62 double _already_installed_capacity = 1;
63 // Profile de la capa
64 std::vector<LinkProfile> _already_installed_profile = {};
65 std::vector<Candidate> _candidates = {};
66 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
67};
68
70 public:
72 std::vector<CandidateData> candidateList,
73 std::map<std::string, std::vector<LinkProfile>> profile_map,
74 DirectAccessScenarioToChronicleProvider scenario_to_chronicle_provider,
75 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
76
78 const std::vector<CandidateData>& candidateList,
79 const std::map<std::string, std::vector<LinkProfile>>& profile_map,
80 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
81
83 : public LogUtils::XpansionError<std::runtime_error> {
84 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
85 };
87 : public LogUtils::XpansionError<std::runtime_error> {
88 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
89 };
91 : public LogUtils::XpansionError<std::runtime_error> {
92 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
93 };
95 : public LogUtils::XpansionError<std::runtime_error> {
96 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
97 };
99 : public LogUtils::XpansionError<std::runtime_error> {
100 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
101 };
102
103 const std::vector<ActiveLink>& getLinks();
104
105 private:
106 struct LinkData {
107 int id;
108 double installed_capacity;
109 std::string profile_name;
110 std::string _linkor;
111 std::string _linkex;
112 };
113
114 void checkCandidateNameDuplication() const;
115 void checkLinksValidity();
116
117 int getLinkIndexOf(int link_id) const;
118 void addCandidate(const CandidateData& candidate_data);
119 void launchExceptionIfNoLinkProfileAssociated(
120 const std::string& profileName) const;
121
122 void record_link_data(const CandidateData& candidateData);
123 void raise_errors_if_link_data_differs_from_existing_link(
124 const LinkData& link_data, const LinkName& link_name) const;
125 void create_links();
126
127 LinkProfile getProfileFromProfileMap(const std::string& profile_name) const;
128 std::vector<LinkProfile> getProfilesFromProfileMap(
129 const std::string& profile_name) const;
130
131 std::map<LinkName, LinkData> _links_data;
132 std::unordered_map<LinkName, std::string> linkToAlreadyInstalledProfileName;
133 std::unordered_map<LinkName, double> linkToAlreadyInstalledCapacity;
134 const std::vector<CandidateData> _candidateDatas;
135 const std::map<std::string, std::vector<LinkProfile>> _profile_map;
136 std::vector<ActiveLink> _links;
137 DirectAccessScenarioToChronicleProvider scenario_to_chronicle_provider_;
138 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
139};
140
141#endif // ANTARESXPANSION_ACTIVELINKS_H
Definition ActiveLinks.h:69
Definition ChronicleMapProvider.h:16
LinkProfile structure.
Definition LinkProfile.h:18
Definition Candidate.h:8