Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
optimization.h
1/*
2** Copyright 2007-2024, 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_APPLICATION_WINDOWS_OPTIONS_OPTIMIZATION_PREFS_H__
22#define __ANTARES_APPLICATION_WINDOWS_OPTIONS_OPTIMIZATION_PREFS_H__
23
24#include "toolbox/components/button.h"
25#include <wx/dialog.h>
26
27#include <antares/study/UnfeasibleProblemBehavior.hpp>
28#include "application/menus.h"
29
30namespace Antares
31{
32namespace Window
33{
34namespace Options
35{
39class Optimization final : public wxDialog
40{
41public:
43
44
49 Optimization(wxWindow* parent);
51 virtual ~Optimization();
53
54private:
55 class PopupInfo final
56 {
57 public:
58 PopupInfo(bool& r, const wxChar* const t) : rval(r), text(t)
59 {
60 }
61 bool& rval;
62 const wxChar* const text;
63 };
64
65private:
66 void refresh();
67 void onClose(void*);
68 void onResetToDefault(void*);
69
70 void onSelectModeInclude(wxCommandEvent& evt);
71 void onSelectModeIgnore(wxCommandEvent& evt);
72 void onSelectSimplexDay(wxCommandEvent& evt);
73 void onSelectSimplexWeek(wxCommandEvent& evt);
74
75 void setTransmissionCapacity(Data::GlobalTransmissionCapacities newCapacity);
76 template<Data::GlobalTransmissionCapacities>
77 void onSelectTransmissionCapacity(wxCommandEvent&);
78
79 template<Data::GlobalTransmissionCapacities>
80 void createGlobalTransmissionCapacitiesItemIntoMenu(wxMenu& menu);
81
82 void onSelectLinkTypeLocal(wxCommandEvent& evt);
83 void onSelectLinkTypeAC(wxCommandEvent& evt);
84
85 // Export MPS functions
86 void onSelectExportMPS(const Data::mpsExportStatus& mps_export_status);
87
88 template<Data::mpsExportStatus>
89 void onSelectExportMPS(wxCommandEvent&);
90
91 template<Data::mpsExportStatus>
92 void createMPSexportItemIntoMenu(wxMenu& menu);
93
94 // Unfeasible behavior problem functions
95 void onSelectUnfeasibleBehaviorWarningDry(wxCommandEvent& evt);
96 void onSelectUnfeasibleBehaviorWarningMps(wxCommandEvent& evt);
97 void onSelectUnfeasibleBehaviorErrorDry(wxCommandEvent& evt);
98 void onSelectUnfeasibleBehaviorErrorMps(wxCommandEvent& evt);
99 void onSelectUnfeasibleBehavior(
100 const Data::UnfeasibleProblemBehavior& unfeasibleProblemBehavior);
101
102 void onPopupMenu(Component::Button&, wxMenu& menu, void*, const PopupInfo& info);
103 void onPopupMenuSimplex(Component::Button&, wxMenu& menu, void*);
104 void onPopupMenuSpecify(Component::Button&, wxMenu& menu, void*, const PopupInfo& info);
105 void onPopupMenuTransmissionCapacities(Component::Button&, wxMenu& menu, void*);
106 void onPopupMenuLinkType(Component::Button&, wxMenu& menu, void*);
107 void onPopupMenuExportMPSstatus(Component::Button&, wxMenu& menu, void*);
108 void onPopupMenuUnfeasibleBehavior(Component::Button&, wxMenu& menu, void*);
109
110 void onInternalMotion(wxMouseEvent&);
111
112private:
113 Component::Button* pBtnConstraints;
114 Component::Button* pBtnHurdleCosts;
115 Component::Button* pBtnTransmissionCapacities;
116 Component::Button* pBtnLinkType;
117 Component::Button* pBtnThermalClusterMinStablePower;
118 Component::Button* pBtnThermalClusterMinUPTime;
119 Component::Button* pBtnDayAheadReserve;
120 Component::Button* pBtnStrategicReserve;
121 Component::Button* pBtnPrimaryReserve;
122 Component::Button* pBtnSpinningReserve;
123 Component::Button* pBtnSimplexOptimizationRange;
124
125 Component::Button* pBtnExportMPS;
126 Component::Button* pBtnUnfeasibleProblemBehavior;
127 bool* pTargetRef;
128
129}; // class Optimization
130
131const char* mpsExportIcon(const Data::mpsExportStatus& mps_export_status);
132
133template<Data::mpsExportStatus MPS_EXPORT_STATUS>
134void Optimization::onSelectExportMPS(wxCommandEvent&)
135{
136 Optimization::onSelectExportMPS(MPS_EXPORT_STATUS);
137}
138
139template<Data::mpsExportStatus MPS_EXPORT_STATUS>
140void Optimization::createMPSexportItemIntoMenu(wxMenu& menu)
141{
142 const wxMenuItem* it = Menu::CreateItem(&menu,
143 wxID_ANY,
144 mpsExportStatusToString(MPS_EXPORT_STATUS),
145 mpsExportIcon(MPS_EXPORT_STATUS),
146 wxEmptyString);
147
148 menu.Connect(it->GetId(),
149 wxEVT_COMMAND_MENU_SELECTED,
150 wxCommandEventHandler(Optimization::onSelectExportMPS<MPS_EXPORT_STATUS>),
151 nullptr,
152 this);
153}
154
155const char* transmissionCapacityIcon(Data::GlobalTransmissionCapacities capacity);
156
157template<Data::GlobalTransmissionCapacities CAPACITY>
158void Optimization::createGlobalTransmissionCapacitiesItemIntoMenu(wxMenu& menu)
159{
160 const wxMenuItem* it = Menu::CreateItem(&menu,
161 wxID_ANY,
162 GlobalTransmissionCapacitiesToString_Display(CAPACITY),
163 transmissionCapacityIcon(CAPACITY),
164 wxEmptyString);
165
166 menu.Connect(it->GetId(),
167 wxEVT_COMMAND_MENU_SELECTED,
168 wxCommandEventHandler(Optimization::onSelectTransmissionCapacity<CAPACITY>),
169 nullptr,
170 this);
171}
172
173} // namespace Options
174} // namespace Window
175} // namespace Antares
176
177#endif // __ANTARES_APPLICATION_WINDOWS_OPTIONS_OPTIMIZATION_PREFS_H__
Definition button.h:34
Startup Wizard User Interface.
Definition optimization.h:40
virtual ~Optimization()
Destructor.
Definition optimization.cpp:363