21#ifndef __ANTARES_LIBS_STUDY_STUDY_H__
22#define __ANTARES_LIBS_STUDY_STUDY_H__
27#include <yuni/core/noncopyable.h>
28#include <yuni/core/string.h>
29#include <yuni/job/queue/service.h>
30#include <yuni/thread/thread.h>
32#include <antares/correlation/correlation.h>
33#include <antares/date/date.h>
34#include <antares/study/runtime/runtime.h>
35#include <antares/writer/i_writer.h>
36#include "antares/antares/antares.h"
37#include "antares/study/binding_constraint/BindingConstraintGroupRepository.h"
38#include "antares/study/binding_constraint/BindingConstraintsRepository.h"
40#include "area/store-timeseries-numbers.h"
41#include "binding_constraint/BindingConstraint.h"
45#include "load-options.h"
46#include "parameters.h"
47#include "progression/progression.h"
49#include "simulation.h"
52namespace Antares::Data
63 using Ptr = std::shared_ptr<Study>;
65 using Set = std::set<Ptr>;
67 using List = std::list<Ptr>;
101 static bool IsRootStudy(
const AnyString& folder, YString& buffer);
126 Study(
bool forTheSolver =
false);
144 void relocate(
const std::filesystem::path& newFolder);
222 Area*
areaAdd(
const AreaName& name,
bool update =
false);
301 template<
unsigned int TimeSeriesT>
338 template<enum TimeSeriesType TS>
400 void getNumberOfCores(
const bool forceParallel,
const uint nbYearsParallelForced);
476 uint maxNbYearsInParallel = 1;
482 uint maxNbYearsInParallel_save = 0;
488 uint nbYearsParallelRaw = 1;
500 uint minNbYearsInParallel = 0;
506 uint minNbYearsInParallel_save = 0;
641 bool internalLoadIni(
const std::filesystem::path& path,
const StudyLoadOptions& options);
656extern YString StudyIconFile;
658std::filesystem::path StudyCreateOutputPath(SimulationMode mode,
660 const std::filesystem::path& folder,
661 const std::string& label,
662 const std::tm& startTime);
Definition of a link between two areas (Interconnection)
Definition links.h:50
A list of areas.
Definition area.h:366
Definition for a single area.
Definition area.h:52
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:36
Runtime informations.
Definition runtime.h:69
bool saveToFolder(const AnyString &newfolder)
Save the study into a folder.
Definition save.cpp:68
bool resetFolderIcon() const
Reset the folder icon (Windows only)
Definition save.cpp:36
std::filesystem::path folder
The source folder of the study.
Definition study.h:453
bool reloadXCastData()
Reload all XCast Data.
Definition load.cpp:309
Parameters parameters
Parameters.
Definition study.h:509
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:228
Date::Calendar calendar
Calendar.
Definition study.h:517
static bool IsRootStudy(const AnyString &folder, YString &buffer)
Get if a folder if a study.
void destroyAllSolarTSGeneratorData()
Destroy all data of the solar TS generator.
Definition study.cpp:966
BindingConstraintsRepository bindingConstraints
Binding constraints.
Definition study.h:535
void scenarioRulesCreate()
Re-Initialize/Re-Load the scenario builder data.
Definition study.extra.cpp:35
void destroyAllLoadTSGeneratorData()
Destroy all data of the load TS generator.
Definition study.cpp:961
void prepareOutput()
Prepare the output where the results of the simulation will be written.
Definition study.cpp:491
bool internalLoadFromFolder(const std::filesystem::path &path, const StudyLoadOptions &options)
Load a study from a folder.
Definition load.cpp:172
bool internalLoadSets()
Load all set of areas and links.
Definition load.cpp:277
void destroyAllWindTSGeneratorData()
Destroy all data of the wind TS generator.
Definition study.cpp:976
bool initializeRuntimeInfos()
Initialize runtime informations required by the solver.
Definition study.cpp:376
virtual bool internalLoadBindingConstraints(const StudyLoadOptions &options)
Load all binding constraints.
Definition load.cpp:264
unsigned getNumberOfCoresPerMode(unsigned nbLogicalCores, int ncMode)
Computes a raw number of cores table.
Definition study.cpp:190
void removeTimeseriesIfTSGeneratorEnabled()
Remove timeseries if ts-generator is enabled.
Definition study.cpp:1391
bool clusterRename(Cluster *cluster, ClusterName newName)
Rename a renewable/thermal cluster.
Definition study.cpp:861
std::string FileExtension
Extension filename.
Definition study.h:73
void importLogsToOutputFolder(Solver::IResultWriter &resultWriter) const
Copy the log file from the 'logs' folder to the current output folder.
Definition importlogs.cpp:36
bool linkDelete(AreaLink *lnk)
Delete a connection and all its dependencies.
Definition study.cpp:752
void relocate(const std::filesystem::path &newFolder)
Relocate the study into a new folder.
Definition study.cpp:1169
void destroyAllHydroTSGeneratorData()
Destroy all data of the hydro TS generator.
Definition study.cpp:971
std::filesystem::path folderOutput
The output folder.
Definition study.h:457
void createAsNew()
Create a clean study.
Definition study.cpp:134
YString buffer
A buffer for temporary operations on filename.
Definition study.h:598
Solver::Progression progression
Progression about the current action performed on the study.
Definition study.h:589
UIRuntimeInfo * uiinfo
Specific data related to the User Interface.
Definition study.h:578
void ensureDataAreLoadedForAllBindingConstraints()
Load all matrices within the binding constraints if not already done.
Definition study.cpp:981
bool areaRename(Area *area, AreaName newName)
Rename an area.
Definition study.cpp:778
FileExtension inputExtension
The file extension for file within the input ('txt' or 'csv')
Definition study.h:586
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
bool readonly() const
Get if the study is in readonly mode.
Definition study.hxx:28
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:466
void storeTimeSeriesNumbers(Solver::IResultWriter &resultWriter) const
Store the timeseries numbers.
Definition study.hxx:34
bool checkForFilenameLimits(bool output, const YString &chfolder=nullptr) const
Check for filename limits restriction on some platforms.
Definition study.cpp:1185
void markAsModified() const
Mark the whole study as modified.
Definition study.cpp:1155
bool areaDelete(Area *area)
Delete an area and all its dependancies.
Definition study.cpp:641
StudyHeader header
Header (general information about the study)
Definition study.h:448
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.hxx:40
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:523
void getNumberOfCores(const bool forceParallel, const uint nbYearsParallelForced)
Computes number of cores.
Definition study.cpp:218
bool forceReload(bool reload=false) const
Invalidate the whole study.
Definition study.cpp:1137
Correlation preproSolarCorrelation
Correlation matrix for the solar time series generated by the prepro.
Definition study.h:544
std::unique_ptr< ScenarioBuilder::Sets > scenarioRules
Rules for building scenarios (can be null)
Definition study.h:560
SetsOfAreas setsOfAreas
Sets of areas.
Definition study.h:554
std::filesystem::path folderSettings
The settings folder.
Definition study.h:459
void * cacheTSGenerator[timeSeriesCount]
Time-series generators used by the solver.
Definition study.h:615
Correlation preproLoadCorrelation
Correlation matrix for the load time series generated by the prepro.
Definition study.h:542
std::shared_ptr< Yuni::Job::QueueService > pQueueService
The queue service that runs every set of parallel years.
Definition study.h:606
std::set< Ptr > Set
Set of studies.
Definition study.h:65
StudyRuntimeInfos runtime
Runtime informations.
Definition study.h:571
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:580
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:600
Correlation preproHydroCorrelation
Correlation matrix for the hydro time series generated by the prepro.
Definition study.h:548
AreaList areas
All available areas.
Definition study.h:529
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:602
void performTransformationsBeforeLaunchingSimulation()
Perform several modifications required when launching a simulation (like computing the DSM values)
Definition study.cpp:381
void reduceMemoryUsage()
Release all unnecessary buffers.
Definition study.cpp:183
std::filesystem::path folderInput
The input folder.
Definition study.h:455
void reloadCorrelation()
Reload all correlation.
Definition load.cpp:301
const bool usedByTheSolver
A non-zero value when the study will be used by the solver.
Definition study.h:624
void initializeProgressMeter(bool tsGeneratorOnly)
Initialize the progress meter.
Definition study.cpp:1023
void computePThetaInfForThermalClusters() const
Check validity between Min Stable Power and capacity modulation for each thermal cluster in the all a...
Definition study.cpp:1418
void resizeAllTimeseriesNumbers(uint n)
Resize all matrices dedicated to the sampled timeseries numbers.
Definition study.cpp:1177
Correlation preproWindCorrelation
Correlation matrix for the wind time series generated by the prepro.
Definition study.h:546
std::list< Ptr > List
List of studies.
Definition study.h:67
bool internalLoadHeader(const std::filesystem::path &folder)
Load the study header.
Definition load.cpp:33
Definition ui-runtimeinfos.h:38
Yuni::Clob BufferType
A buffer, for large amount of data.
Definition matrix.h:65
Progress meter about any operation performed on the attached study.
Definition progression.h:46