Antares Simulator
Power System Simulator
run.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_APPLICATION_WINDOWS_SIMULATION_RUN_H__
22 #define __ANTARES_APPLICATION_WINDOWS_SIMULATION_RUN_H__
23 
24 #include <yuni/thread/thread.h>
25 #include <antares/study/study.h>
26 
27 #include <wx/dialog.h>
28 #include <wx/sizer.h>
29 #include <wx/checkbox.h>
30 #include <wx/combobox.h>
31 #include <wx/choice.h>
32 #include <wx/stattext.h>
33 #include <wx/timer.h>
34 #include "../../toolbox/components/button.h"
35 
36 namespace Antares::Window::Simulation
37 {
38 class Run final: public wxDialog
39 {
40 public:
42 
43 
49  explicit Run(wxWindow* parent, bool preproOnly = false);
51  virtual ~Run();
53 
54 private:
55  void gridAppend(wxFlexGridSizer& sizer,
56  const wxString& title,
57  const wxString& key,
58  wxWindow* value,
59  bool bold = false);
60  void gridAppend(wxFlexGridSizer& sizer,
61  const wxString& title,
62  const wxString& key,
63  const wxString& value);
64  void gridAppend(wxFlexGridSizer& sizer, wxWindow* key, wxWindow* value);
65  void gridAppend(wxFlexGridSizer& sizer, wxWindow* key, wxSizer* value);
66  void gridAppend(wxFlexGridSizer& sizer, const wxString& key, wxWindow* value);
67  void gridAppend(wxFlexGridSizer& sizer, const wxString& key, const wxString& value);
68 
70  void onCancel(void*);
72  void onRun(void*);
73 
74  void evtOnPreprocessorsOnlyClick(wxCommandEvent& evt);
75 
79  void prepareMenuSolverMode(Antares::Component::Button&, wxMenu& menu, void*);
80 
84  void onSelectMode(wxCommandEvent& evt);
85 
90  bool createCommentsFile(YString& filename) const;
91 
92  void updateMonteCarloYears();
93 
94  void updateNbCores();
95 
101  int checkForLowResources();
102 
104  void onInternalMotion(wxMouseEvent&);
105 
106 private:
108  wxWindow* pBigDaddy;
110  Antares::Component::Button* pBtnMode;
111  wxStaticText* pTitleOrtoolsSolverCombox;
112  wxComboBox* pOrtoolsSolverCombox;
113 
114  wxTextCtrl* pSimulationName;
115  wxTextCtrl* pSimulationComments;
116  wxCheckBox* pIgnoreWarnings;
117  wxStaticText* pNbCores;
118  wxStaticText* pTitleSimCores;
119  wxStaticText* pLblEstimation;
120  wxStaticText* pLblEstimationAvailable;
121  wxStaticText* pLblDiskEstimation;
122  wxStaticText* pLblDiskEstimationAvailable;
123  wxCheckBox* pPreproOnly;
124  wxStaticText* pMonteCarloYears;
125  wxButton* pBtnRun;
126  wxSizerItem* pOptionSpacer;
127  wxSizerItem* pOrtoolsSolverOptionSpacer;
128 
129  wxTimer* pTimer;
130  bool pWarnAboutMemoryLimit;
131  bool pWarnAboutDiskLimit;
132 
133  bool pAlreadyWarnedNoMCYear;
134  uint pFeatureIndex;
135  std::map<long, uint> pMappingSolverMode;
136 
137  Yuni::Thread::IThread::Ptr pThread;
138 
139 }; // class Run
140 
141 } // namespace Antares::Window::Simulation
142 
143 #endif // __ANTARES_APPLICATION_WINDOWS_SIMULATION_RUN_H__
Definition: button.h:32
Run(wxWindow *parent, bool preproOnly=false)
Constructor.
Definition: run.cpp:201
virtual ~Run()
Destructor.
Definition: run.cpp:436