Skip to content

Commit

Permalink
Add interface for Thermal costs, fix wrong values in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes committed Dec 6, 2024
1 parent a276477 commit 1de8150
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 203 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,63 @@ enum class LocalTSGenerationBehavior
forceNoGen
};

class CostProvider
{
public:
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:
ConstantCostProvider(ThermalCluster* cluster);
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:
ThermalCluster* cluster;
};

class ScenarizedCostProvider: public CostProvider
{
public:
ScenarizedCostProvider(ThermalCluster* cluster);
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<double, HOURS_PER_YEAR> productionCostTs;
std::array<double, HOURS_PER_YEAR> marketBidCostTS;
std::array<double, HOURS_PER_YEAR> marginalCostTS;
};

void resizeCostTS();
void ComputeMarketBidTS();
void MarginalCostEqualsMarketBid();
void ComputeProductionCostTS();

std::vector<CostsTimeSeries> costsTimeSeries;
ThermalCluster* cluster;
};

double computeMarketBidCost(double fuelCost,
double fuelEfficiency,
double co2EmissionFactor,
double co2cost,
double variableomcost);

/*!
** \brief A single thermal cluster
*/
Expand Down Expand Up @@ -147,13 +204,6 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<
*/
void calculationOfSpinning();

//! \name MarketBid and Marginal Costs
//@{
/*!
** \brief Calculation of market bid and marginals costs per hour
*/
void ComputeCostTimeSeries();

/*!
** \brief Calculation of spinning (reverse)
**
Expand Down Expand Up @@ -207,10 +257,6 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<

bool doWeGenerateTS(bool globalTSgeneration) const;

double getOperatingCost(uint tsIndex, uint hourInTheYear) const;
double getMarginalCost(uint tsIndex, uint hourInTheYear) const;
double getMarketBidCost(uint hourInTheYear, uint year) const;

// Check & correct availability timeseries for thermal availability
// Only applies if time-series are ready-made
void checkAndCorrectAvailability();
Expand Down Expand Up @@ -349,29 +395,16 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<
//! Data for the preprocessor
std::unique_ptr<PreproAvailability> prepro;

/*!
** \brief Production Cost, Market Bid Cost and Marginal Cost Matrixes - Per Hour and per Time
*Series
*/
struct CostsTimeSeries
{
std::array<double, HOURS_PER_YEAR> productionCostTs;
std::array<double, HOURS_PER_YEAR> marketBidCostTS;
std::array<double, HOURS_PER_YEAR> marginalCostTS;
};

std::vector<CostsTimeSeries> costsTimeSeries;

EconomicInputData ecoInput;

LocalTSGenerationBehavior tsGenBehavior = LocalTSGenerationBehavior::useGlobalParameter;

friend class ThermalClusterList;

double computeMarketBidCost(double fuelCost, double co2EmissionFactor, double co2cost);

unsigned int precision() const override;

CostProvider& getCostProvider();

private:
// Calculation of marketBid and marginal costs hourly time series
//
Expand All @@ -383,12 +416,9 @@ class ThermalCluster final: public Cluster, public std::enable_shared_from_this<
// Marginal_Cost[€/MWh] = Market_Bid_Cost[€/MWh] = (Fuel_Cost[€/GJ] * 3.6 * 100 / Efficiency[%])
// CO2_emission_factor[tons/MWh] * C02_cost[€/tons] + Variable_O&M_cost[€/MWh]

void fillMarketBidCostTS();
void fillMarginalCostTS();
void resizeCostTS();
void ComputeMarketBidTS();
void MarginalCostEqualsMarketBid();
void ComputeProductionCostTS();
void initializeCostProvider();

std::unique_ptr<CostProvider> costProvider;

}; // class ThermalCluster
} // namespace Data
Expand Down
Loading

0 comments on commit 1de8150

Please sign in to comment.