Antares Simulator
Power System Simulator
cluster_list.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 #pragma once
22 
23 #include <filesystem>
24 #include <functional>
25 
26 #include "../common/cluster_list.h"
27 #include "cluster.h"
28 
29 namespace Antares::Data
30 {
35 class ThermalClusterList final: public ClusterList<ThermalCluster>
36 {
37 public:
38  std::string typeID() const override;
39 
44  bool loadFromFolder(Study& s, const std::filesystem::path& folder, Area* area);
45 
47 
48 
55  virtual ~ThermalClusterList();
57 
59 
60 
63  void calculationOfSpinning();
64 
70 
72 
73 
80 
82 
83  auto each_mustrun_and_enabled() const
84  {
85  return allClusters_ | std::views::filter(&ThermalCluster::isMustRun)
86  | std::views::filter(&ThermalCluster::isEnabled);
87  }
88 
89  auto each_enabled_and_not_mustrun() const
90  {
91  return allClusters_ | std::views::filter(&ThermalCluster::isEnabled)
92  | std::views::filter(std::not_fn(&ThermalCluster::isMustRun));
93  }
94 
102  void ensureDataPrepro();
103 
113  bool loadPreproFromFolder(Study& s, const std::filesystem::path& folder);
114  bool validatePrepro(const Study& study);
115 
116  bool validateClusters(const Parameters& param) const;
117 
118  bool loadEconomicCosts(Study& s, const std::filesystem::path& folder);
119 
120  bool savePreproToFolder(const AnyString& folder) const;
121  bool saveEconomicCosts(const AnyString& folder) const;
122 
123 #ifdef BUILD_UI
124  bool saveToFolder(const AnyString& folder) const override;
125 #endif
126 
127  unsigned int enabledAndMustRunCount() const;
128  unsigned int enabledAndNotMustRunCount() const;
129 
130 private:
131  // Give a special index to enbled and not must-run THERMAL clusters
132  void rebuildIndex() const;
133 
134 }; // class ThermalClusterList
135 } // namespace Antares::Data
Definition for a single area.
Definition: area.h:51
Generic list of clustersThis class implements the base functions for a list of cluster It's used for ...
Definition: cluster_list.h:46
General data for a study.
Definition: parameters.h:51
Definition: study.h:57
List of clusters.
Definition: cluster_list.h:36
virtual ~ThermalClusterList()
Destructor.
Definition: cluster_list.cpp:52
bool loadPreproFromFolder(Study &s, const std::filesystem::path &folder)
Load data related to the preprocessor from a list of thermal clusters from a folder.
Definition: cluster_list.cpp:573
bool loadFromFolder(Study &s, const std::filesystem::path &folder, Area *area)
Get the size (bytes) occupied in memory by a ThermalClusterList structure.
Definition: cluster_list.cpp:89
void enableMustrunForEveryone()
Enable the 'mustrun' mode for every cluster.
Definition: cluster_list.cpp:365
void reverseCalculationOfSpinning()
Calculation of Spinning for all thermal clusters (reverse)
Definition: cluster_list.cpp:357
ThermalClusterList()
Default constructor.
Definition: cluster_list.cpp:48
void ensureDataPrepro()
Ensure data for the prepro are initialized.
Definition: cluster_list.cpp:373
void calculationOfSpinning()
Calculation of Spinning for all thermal clusters.
Definition: cluster_list.cpp:349