21 #ifndef __ANTARES_LIBS_STUDY_STUDY_H__
22 #define __ANTARES_LIBS_STUDY_STUDY_H__
26 #include <yuni/yuni.h>
27 #include <yuni/core/noncopyable.h>
28 #include <yuni/job/queue/service.h>
30 #include <antares/correlation/correlation.h>
31 #include <antares/date/date.h>
32 #include <antares/solver/modeler/data.h>
33 #include <antares/study/runtime/runtime.h>
34 #include <antares/writer/i_writer.h>
35 #include "antares/study/binding_constraint/BindingConstraintGroupRepository.h"
36 #include "antares/study/binding_constraint/BindingConstraintsRepository.h"
38 #include "area/store-timeseries-numbers.h"
39 #include "binding_constraint/BindingConstraint.h"
42 #include "layerdata.h"
43 #include "parameters.h"
44 #include "progression/progression.h"
46 #include "simulation.h"
48 namespace Antares::Data
59 using Ptr = std::shared_ptr<Study>;
61 using Set = std::set<Ptr>;
63 using List = std::list<Ptr>;
120 Study(
bool forTheSolver =
false);
138 void relocate(
const std::filesystem::path& newFolder);
216 Area*
areaAdd(
const AreaName& name,
bool update =
false);
226 bool areaRename(
Area* area, AreaName newName);
235 bool areaDelete(
Area* area);
246 void areaDelete(Area::Vector& area);
270 bool clusterRename(
Cluster* cluster, std::string newName);
278 bool readonly()
const;
298 template<TimeSeriesType TimeSeriesT>
301 storeTimeseriesNumbers<TimeSeriesT>(resultWriter,
areas);
340 template<TimeSeriesType TS>
395 void getNumberOfCores(
const bool forceParallel,
const uint nbYearsParallelForced);
447 std::filesystem::path
folder;
471 uint maxNbYearsInParallel = 1;
477 uint maxNbYearsInParallel_save = 0;
483 uint nbYearsParallelRaw = 1;
495 uint minNbYearsInParallel = 0;
501 uint minNbYearsInParallel_save = 0;
622 return modelerInput_.get();
640 bool internalLoadIni(
const std::filesystem::path& path,
const StudyLoadOptions& options);
655 std::unique_ptr<Modeler::Data> modelerInput_;
661 extern YString StudyIconFile;
663 std::filesystem::path StudyCreateOutputPath(SimulationMode mode,
665 const std::filesystem::path& folder,
666 const std::string& label,
667 const std::tm& startTime);
Definition of a link between two areas (Interconnection)
Definition: links.h:58
A list of areas.
Definition: area.h:365
Definition for a single area.
Definition: area.h:51
Definition: BindingConstraintGroupRepository.h:41
Definition: BindingConstraintsRepository.h:36
Definition: correlation.h:35
Antares Study.
Definition: layerdata.h:37
General data for a study.
Definition: parameters.h:51
Definition: load-options.h:34
Runtime informations.
Definition: runtime.h:69
bool saveToFolder(const AnyString &newfolder)
Save the study into a folder.
bool resetFolderIcon() const
Reset the folder icon (Windows only)
std::filesystem::path folder
The source folder of the study.
Definition: study.h:448
bool reloadXCastData()
Reload all XCast Data.
Definition: load.cpp:350
Parameters parameters
Parameters.
Definition: study.h:504
void scenarioRulesLoadIfNotAvailable()
Load the data related to the scenario builder if not available.
Definition: study.extra.cpp:50
bool internalLoadCorrelationMatrices(const StudyLoadOptions &options)
Load all correlation matrices.
Definition: load.cpp:273
Date::Calendar calendar
Calendar.
Definition: study.h:512
static bool IsRootStudy(const AnyString &folder, YString &buffer)
Get if a folder if a study.
BindingConstraintsRepository bindingConstraints
Binding constraints.
Definition: study.h:530
void scenarioRulesCreate()
Re-Initialize/Re-Load the scenario builder data.
Definition: study.extra.cpp:35
void prepareOutput()
Prepare the output where the results of the simulation will be written.
Definition: study.cpp:373
bool internalLoadFromFolder(const std::filesystem::path &path, const StudyLoadOptions &options)
Load a study from a folder.
Definition: load.cpp:166
bool internalLoadSets()
Load all set of areas and links.
Definition: load.cpp:318
bool initializeRuntimeInfos()
Initialize runtime informations required by the solver.
Definition: study.cpp:260
virtual bool internalLoadBindingConstraints(const StudyLoadOptions &options)
Load all binding constraints.
Definition: load.cpp:305
unsigned getNumberOfCoresPerMode(unsigned nbLogicalCores, int ncMode)
Computes a raw number of cores table.
Definition: study.cpp:191
void removeTimeseriesIfTSGeneratorEnabled()
Remove timeseries if ts-generator is enabled.
Definition: study.cpp:1208
std::string FileExtension
Extension filename.
Definition: study.h:69
void checkModelerDataCompatibility() const
Definition: load.cpp:254
void importLogsToOutputFolder(Solver::IResultWriter &resultWriter) const
Copy the log file from the 'logs' folder to the current output folder.
Definition: importlogs.cpp:34
void relocate(const std::filesystem::path &newFolder)
Relocate the study into a new folder.
Definition: study.cpp:986
std::filesystem::path folderOutput
The output folder.
Definition: study.h:452
void createAsNew()
Create a clean study.
Definition: study.cpp:135
YString buffer
A buffer for temporary operations on filename.
Definition: study.h:593
Solver::Progression progression
Progression about the current action performed on the study.
Definition: study.h:584
UIRuntimeInfo * uiinfo
Specific data related to the User Interface.
Definition: study.h:573
void ensureDataAreLoadedForAllBindingConstraints()
Load all matrices within the binding constraints if not already done.
Definition: study.cpp:852
FileExtension inputExtension
The file extension for file within the input ('txt' or 'csv')
Definition: study.h:581
bool modifyAreaNameIfAlreadyTaken(AreaName &out, const AreaName &basename)
Try to find a name for a new area.
Definition: study.extra.cpp:60
bool loadFromFolder(const std::string &path, const StudyLoadOptions &options)
Load a study from a folder.
Definition: load.cpp:52
void loadModelerComponents()
Load extra modeler components for hybrid studies and verify compatibility.
Definition: load.cpp:226
static bool TitleFromStudyFolder(const AnyString &folder, YString &out, bool warnings=false)
Extract the title of a study.
Definition: study.extra.cpp:86
SimulationComments simulationComments
The current Simulation.
Definition: study.h:461
void storeTimeSeriesNumbers(Solver::IResultWriter &resultWriter) const
Store the timeseries numbers.
Definition: study.h:299
bool checkForFilenameLimits(bool output, const YString &chfolder=nullptr) const
Check for filename limits restriction on some platforms.
Definition: study.cpp:1002
void markAsModified() const
Mark the whole study as modified.
Definition: study.cpp:972
StudyHeader header
Header (general information about the study)
Definition: study.h:443
bool importTimeseriesIntoInput()
Import all time-series into the input folder.
Definition: study.importprepro.cpp:34
void destroyTSGeneratorData()
Destroy all data of the TS generator '@TS'.
Definition: study.h:341
static bool IsInsideStudyFolder(const AnyString &path, YString &location, YString &title)
Check if a path is within a study folder.
Definition: study.extra.cpp:114
Date::Calendar calendarOutput
Calendar output.
Definition: study.h:518
void getNumberOfCores(const bool forceParallel, const uint nbYearsParallelForced)
Computes number of cores.
Definition: study.cpp:220
bool forceReload(bool reload=false) const
Invalidate the whole study.
Definition: study.cpp:954
Correlation preproSolarCorrelation
Correlation matrix for the solar time series generated by the prepro.
Definition: study.h:539
std::unique_ptr< ScenarioBuilder::Sets > scenarioRules
Rules for building scenarios (can be null)
Definition: study.h:555
SetsOfAreas setsOfAreas
Sets of areas.
Definition: study.h:549
std::filesystem::path folderSettings
The settings folder.
Definition: study.h:454
void * cacheTSGenerator[timeSeriesCount]
Time-series generators used by the solver.
Definition: study.h:609
Correlation preproLoadCorrelation
Correlation matrix for the load time series generated by the prepro.
Definition: study.h:537
std::shared_ptr< Yuni::Job::QueueService > pQueueService
The queue service that runs every set of parallel years.
Definition: study.h:601
Study(bool forTheSolver=false)
Default Constructor.
Definition: study.cpp:70
std::set< Ptr > Set
Set of studies.
Definition: study.h:61
StudyRuntimeInfos runtime
Runtime informations.
Definition: study.h:566
void clear()
Clear all ressources held by the study.
Definition: study.cpp:107
Area * areaAdd(const AreaName &name, bool update=false)
Add an area and make all required initialization.
Definition: study.cpp:464
static bool IsRootStudy(const AnyString &folder)
Get if a folder if a study.
Definition: study.extra.cpp:100
Matrix ::BufferType dataBuffer
A buffer for temporary operations on large amount of data.
Definition: study.h:595
Correlation preproHydroCorrelation
Correlation matrix for the hydro time series generated by the prepro.
Definition: study.h:543
AreaList areas
All available areas.
Definition: study.h:524
void scenarioRulesDestroy()
Release the scenario builder.
Definition: study.extra.cpp:45
YString bufferLoadingTS
A buffer used when loading time-series for dealing with filenames (prepro/series only)
Definition: study.h:597
void performTransformationsBeforeLaunchingSimulation()
Perform several modifications required when launching a simulation (like computing the DSM values)
Definition: study.cpp:265
void reduceMemoryUsage()
Release all unnecessary buffers.
Definition: study.cpp:184
std::filesystem::path folderInput
The input folder.
Definition: study.h:450
virtual ~Study()
Destructor.
Definition: study.cpp:102
void reloadCorrelation()
Reload all correlation.
Definition: load.cpp:342
const bool usedByTheSolver
A non-zero value when the study will be used by the solver.
Definition: study.h:618
void initializeProgressMeter(bool tsGeneratorOnly)
Initialize the progress meter.
Definition: study.cpp:888
void computePThetaInfForThermalClusters() const
Check validity between Min Stable Power and capacity modulation for each thermal cluster in the all a...
Definition: study.cpp:1235
void resizeAllTimeseriesNumbers(uint n)
Resize all matrices dedicated to the sampled timeseries numbers.
Definition: study.cpp:994
Correlation preproWindCorrelation
Correlation matrix for the wind time series generated by the prepro.
Definition: study.h:541
std::list< Ptr > List
List of studies.
Definition: study.h:63
bool internalLoadHeader(const std::filesystem::path &folder)
Load the study header.
Definition: load.cpp:33
Definition: ui-runtimeinfos.h:36
A n-by-n matrix.
Definition: matrix.h:44
Yuni::Clob BufferType
A buffer, for large amount of data.
Definition: matrix.h:65
Definition: i_writer.h:32
Progress meter about any operation performed on the attached study.
Definition: progression.h:44