Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
study.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_STUDY_H__
22#define __ANTARES_APPLICATION_STUDY_H__
23
24#include <yuni/yuni.h>
25#include "../toolbox/wx-wrapper.h"
26#include <antares/study/study.h>
27#include <antares/study/output.h>
28#include <yuni/core/event.h>
29#include <list>
30#include <antares/locator/locator.h>
31
32#include "ui/simulator/toolbox/components/map/settings.h"
33
34namespace Antares
35{
36enum SaveResult
37{
38 svsError = 0,
39 svsSaved,
40 svsDiscard,
41 svsCancel
42};
43
47extern wxString gLastOpenedStudyFolder;
48
52void NewStudy();
53
59void OpenStudyFromFolder(wxString folder);
60
64SaveResult SaveStudy();
65
69SaveResult SaveStudyAs(const Yuni::String& path, bool copyoutput, bool copyuserdata, bool copylogs);
70
74void SetCurrentStudy(std::shared_ptr<Data::Study> study);
75
79std::shared_ptr<Data::Study> GetCurrentStudy();
80
84bool CurrentStudyIsValid();
85
86
90SaveResult ExportMap(const Yuni::String& path,
91 bool transparentBackground,
92 const wxColour& backgroundColor,
93 const std::list<uint16_t>& layers,
94 int nbSplitParts,
95 Antares::Map::mapImageFormat format);
96
102bool CloseTheStudy(bool updateGUI = true);
103
107bool CheckIfInsideAStudyFolder(const AnyString& path, bool quiet = false);
108
118void RunSimulationOnTheStudy(Data::Study::Ptr study,
119 const YString& simuName,
120 const YString& simuComments,
121 bool ignoreWarnings,
122 Solver::Feature features = Solver::standard,
123 bool preproOnly = false,
124 const std::string& solverName = "sirius");
125
129void UpdateGUIFromStudyState();
130
134bool StudyRenameArea(Data::Area* area, const AnyString& newname, Data::Study* study = nullptr);
135
139void MarkTheStudyAsModified();
140
144void MarkTheStudyAsModified(const Data::Study::Ptr& study);
145
146void ResetTheModifierState(bool v);
147
154bool StudyHasBeenModified();
155
163uint64_t StudyInMemoryRevisionID();
164
168void RefreshListOfOutputsForTheCurrentStudy();
169
170void StudyRefreshCalendar();
171
173
174
179extern Yuni::Event<void()> OnStudyLoaded;
180
186extern Yuni::Event<void()> OnStudyClosed;
187
191extern Yuni::Event<void()> OnStudySaved;
192
196extern Yuni::Event<void()> OnStudySavedAs;
197
202extern Yuni::Event<void(Data::Study&)> OnStudyChanged;
203
207extern Yuni::Event<void()> OnStudyAreasChanged;
208
209extern Yuni::Event<void()> OnStudySettingsChanged;
210
214extern Yuni::Event<void(const Data::Output::List&, const Data::Output::Ptr)>
215 OnStudyUpdateOutputInfo;
216
220extern Yuni::Event<void(Data::Area*)> OnStudyAreaRename;
221
225extern Yuni::Event<void(Data::Area*)> OnStudyAreaAdded;
226
230extern Yuni::Event<void(Data::Area*)> OnStudyAreaDelete;
231
238extern Yuni::Event<void(Data::Area*)> OnStudyAreaColorChanged;
239
243extern Yuni::Event<void(Data::AreaLink*)> OnStudyLinkAdded;
244
248extern Yuni::Event<void(Data::AreaLink*)> OnStudyLinkDelete;
249
253extern Yuni::Event<void(Data::AreaLink*)> OnStudyLinkChanged;
254
258extern Yuni::Event<void(Data::BindingConstraint*)> OnStudyConstraintAdded;
259
263extern Yuni::Event<void(Data::BindingConstraint*)> OnStudyConstraintDelete;
264
268extern Yuni::Event<void(Data::BindingConstraint*)> OnStudyConstraintModified;
269
275extern Yuni::Event<void()> OnStudyNodalOptimizationChanged;
276
280extern Yuni::Event<void()> OnStudySimulationSettingsChanged;
281
285extern Yuni::Event<void()> OnStudyUpdatePlaylist;
286
290extern Yuni::Event<void()> OnStudyReloadAllComponentsWithJITData;
291
297extern Yuni::Event<void()> OnStudyThermalClusterCommonSettingsChanged;
298
299extern Yuni::Event<void(Data::ThermalCluster*)> OnStudyThermalClusterRenamed;
300extern Yuni::Event<void(Data::Area*)> OnStudyThermalClusterGroupChanged;
301
307extern Yuni::Event<void()> OnStudyRenewableClusterCommonSettingsChanged;
308
309extern Yuni::Event<void(Data::RenewableCluster*)> OnStudyRenewableClusterRenamed;
310extern Yuni::Event<void(Data::Area*)> OnStudyRenewableClusterGroupChanged;
311
317extern Yuni::Event<void()> OnStudyScenarioBuilderDataAreLoaded;
318
326extern Yuni::Event<void()> OnStudyBeginUpdate;
332extern Yuni::Event<void()> OnStudyEndUpdate;
333
335extern Yuni::Event<void(const void*)> OnInspectorRefresh;
336
338extern Yuni::Event<void()> OnMainNotebookChanged;
340
342extern Yuni::Event<void()> OnLayerNodeUIChanged;
344
346extern Yuni::Event<void(const wxString*)> OnMapLayerChanged;
348
349extern Yuni::Event<void(const wxString*)> OnMapLayerAdded;
350extern Yuni::Event<void(const wxString*)> OnMapLayerRemoved;
351extern Yuni::Event<void(const wxString*)> OnMapLayerRenamed;
352
354//
355// You should not have to call these routines yourselves
357
358void MemoryFlushBeginUpdate();
360void MemoryFlushEndUpdate();
362bool CanPerformMemoryFlush();
364
365extern bool SystemParameterHaveChanged;
366
370extern bool GUIFlagInvalidateAreas;
371
373extern Antares::Data::Output::List ListOfOutputsForTheCurrentStudy;
374
378extern Yuni::String LastPathForOpeningAFile;
379
385{
386public:
388 {
389 OnStudyBeginUpdate();
390 }
392 {
393 OnStudyEndUpdate();
394 }
395};
396
401{
402public:
404 {
405 MemoryFlushBeginUpdate();
406 }
408 {
409 MemoryFlushEndUpdate();
410 }
411};
412
413} // namespace Antares
414
415#endif // __ANTARES_APPLICATION_STUDY_H__
Definition for a single area.
Definition area.h:52
Definition BindingConstraint.h:49
std::list< Ptr > List
List.
Definition output.h:45
std::shared_ptr< Output > Ptr
Smartptr.
Definition output.h:43
Definition cluster.h:42
Definition study.h:61
A single thermal cluster.
Definition cluster.h:78
Avoid the execution of a memory flush.
Definition study.h:401
Avoid the use of the data related to a study for the lifetime of the object (RAII)
Definition study.h:385