diff --git a/src/libs/antares/study/CMakeLists.txt b/src/libs/antares/study/CMakeLists.txt index 2173b00d13..29a89fc631 100644 --- a/src/libs/antares/study/CMakeLists.txt +++ b/src/libs/antares/study/CMakeLists.txt @@ -71,6 +71,7 @@ set(SRC_STUDY_PART_THERMAL include/antares/study/parts/thermal/ecoInput.h parts/thermal/ecoInput.cpp include/antares/study/parts/thermal/cluster.h + include/antares/study/parts/thermal/cost_provider.h include/antares/study/parts/thermal/cluster.hxx parts/thermal/cluster.cpp parts/thermal/scenarized_cost_provider.cpp diff --git a/src/libs/antares/study/include/antares/study/parts/thermal/cluster.h b/src/libs/antares/study/include/antares/study/parts/thermal/cluster.h index 2df8896506..6b6523673c 100644 --- a/src/libs/antares/study/include/antares/study/parts/thermal/cluster.h +++ b/src/libs/antares/study/include/antares/study/parts/thermal/cluster.h @@ -34,6 +34,7 @@ #include "../../fwd.h" #include "../common/cluster.h" +#include "cost_provider.h" #include "defines.h" #include "ecoInput.h" #include "pollutant.h" @@ -64,60 +65,6 @@ enum class LocalTSGenerationBehavior forceNoGen }; -class CostProvider -{ -public: - virtual ~CostProvider() = default; - virtual double getOperatingCost(uint serieIndex, uint hourInTheYear) const = 0; - virtual double getMarginalCost(uint serieIndex, uint hourInTheYear) const = 0; - virtual double getMarketBidCost(uint hourInTheYear, uint year) const = 0; -}; - -class ThermalCluster; - -class ConstantCostProvider: public CostProvider -{ -public: - explicit ConstantCostProvider(const ThermalCluster& cluster); - virtual ~ConstantCostProvider() = default; - double getOperatingCost(uint serieIndex, uint hourInTheYear) const override; - double getMarginalCost(uint serieIndex, uint hourInTheYear) const override; - double getMarketBidCost(uint hourInTheYear, uint year) const override; - -private: - const ThermalCluster& cluster; -}; - -class ScenarizedCostProvider: public CostProvider -{ -public: - explicit ScenarizedCostProvider(const ThermalCluster& cluster); - virtual ~ScenarizedCostProvider() = default; - double getOperatingCost(uint serieIndex, uint hourInTheYear) const override; - double getMarginalCost(uint serieIndex, uint hourInTheYear) const override; - double getMarketBidCost(uint hourInTheYear, uint year) const override; - -private: - /*! - ** \brief Production Cost, Market Bid Cost and Marginal Cost Matrixes - Per Hour and per Time - *Series - */ - struct CostsTimeSeries - { - std::array productionCostTs; - std::array marketBidCostTS; - std::array marginalCostTS; - }; - - void resizeCostTS(); - void ComputeMarketBidTS(); - void MarginalCostEqualsMarketBid(); - void ComputeProductionCostTS(); - - std::vector costsTimeSeries; - const ThermalCluster& cluster; -}; - double computeMarketBidCost(double fuelCost, double fuelEfficiency, double co2EmissionFactor, diff --git a/src/libs/antares/study/include/antares/study/parts/thermal/cost_provider.h b/src/libs/antares/study/include/antares/study/parts/thermal/cost_provider.h new file mode 100644 index 0000000000..2a3b1b1d54 --- /dev/null +++ b/src/libs/antares/study/include/antares/study/parts/thermal/cost_provider.h @@ -0,0 +1,82 @@ +/* + * Copyright 2007-2024, RTE (https://www.rte-france.com) + * See AUTHORS.txt + * SPDX-License-Identifier: MPL-2.0 + * This file is part of Antares-Simulator, + * Adequacy and Performance assessment for interconnected energy networks. + * + * Antares_Simulator is free software: you can redistribute it and/or modify + * it under the terms of the Mozilla Public Licence 2.0 as published by + * the Mozilla Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * Antares_Simulator is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Mozilla Public Licence 2.0 for more details. + * + * You should have received a copy of the Mozilla Public Licence 2.0 + * along with Antares_Simulator. If not, see . + */ + +#pragma once + +#include +#include + +namespace Antares::Data +{ +class CostProvider +{ +public: + virtual ~CostProvider() = default; + virtual double getOperatingCost(uint serieIndex, uint hourInTheYear) const = 0; + virtual double getMarginalCost(uint serieIndex, uint hourInTheYear) const = 0; + virtual double getMarketBidCost(uint hourInTheYear, uint year) const = 0; +}; + +class ThermalCluster; + +class ConstantCostProvider: public CostProvider +{ +public: + explicit ConstantCostProvider(const ThermalCluster& cluster); + virtual ~ConstantCostProvider() = default; + double getOperatingCost(uint serieIndex, uint hourInTheYear) const override; + double getMarginalCost(uint serieIndex, uint hourInTheYear) const override; + double getMarketBidCost(uint hourInTheYear, uint year) const override; + +private: + const ThermalCluster& cluster; +}; + +class ScenarizedCostProvider: public CostProvider +{ +public: + explicit ScenarizedCostProvider(const ThermalCluster& cluster); + virtual ~ScenarizedCostProvider() = default; + double getOperatingCost(uint serieIndex, uint hourInTheYear) const override; + double getMarginalCost(uint serieIndex, uint hourInTheYear) const override; + double getMarketBidCost(uint hourInTheYear, uint year) const override; + +private: + /*! + ** \brief Production Cost, Market Bid Cost and Marginal Cost Matrixes - Per Hour and per Time + *Series + */ + struct CostsTimeSeries + { + std::array productionCostTs; + std::array marketBidCostTS; + std::array marginalCostTS; + }; + + void resizeCostTS(); + void ComputeMarketBidTS(); + void MarginalCostEqualsMarketBid(); + void ComputeProductionCostTS(); + + std::vector costsTimeSeries; + const ThermalCluster& cluster; +}; +} // namespace Antares::Data diff --git a/src/libs/antares/study/include/antares/study/parts/thermal/defines.h b/src/libs/antares/study/include/antares/study/parts/thermal/defines.h index 5d74c795ff..52d7cd9798 100644 --- a/src/libs/antares/study/include/antares/study/parts/thermal/defines.h +++ b/src/libs/antares/study/include/antares/study/parts/thermal/defines.h @@ -21,16 +21,13 @@ #ifndef __ANTARES_LIBS_STUDY_PARTS_THERMAL_DEFINES_H__ #define __ANTARES_LIBS_STUDY_PARTS_THERMAL_DEFINES_H__ -namespace Antares -{ -namespace Data +namespace Antares::Data { // Forward declaration class ThermalCluster; class ThermalClusterList; class PreproAvailability; -} // namespace Data -} // namespace Antares +} // namespace Antares::Data #endif // __ANTARES_LIBS_STUDY_PARTS_THERMAL_DEFINES_H__