Skip to content

Commit

Permalink
8.6.6 (#1999)
Browse files Browse the repository at this point in the history
Backport some bugfixes
#1969
#1960
#1982

---------

Co-authored-by: Florian OMNES <florian.omnes@rte-france.com>
  • Loading branch information
payetvin and flomnes committed Mar 26, 2024
1 parent fb24345 commit 69bea81
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 95 deletions.
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Antares Changelog
=================

# v8.6.6 (03/2024)
## Bugfixes
Adequacy patch CSR - fix DTG MRG (#1982)
Fix ts numbers for no gen clusters (#1969)
Remove unitcount limit for time series generation (#1960)

# v8.6.4 (11/2023)
## Bugfixes
* Fix Oracle Linux minizip build + actually run zip unit tests (#1744)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) # FetchContent_MakeAvailable
# Version
set(ANTARES_VERSION_HI 8)
set(ANTARES_VERSION_LO 6)
set(ANTARES_VERSION_REVISION 5)
set(ANTARES_VERSION_REVISION 6)
set(ANTARES_VERSION_YEAR 2024)

project(antares
Expand Down
10 changes: 1 addition & 9 deletions src/libs/antares/study/parameters/adq-patch-params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ bool AdqPatchParams::checkAdqPatchParams(const StudyMode studyMode,
checkAdqPatchStudyModeEconomyOnly(studyMode);
checkAdqPatchContainsAdqPatchArea(areas);
checkAdqPatchIncludeHurdleCost(includeHurdleCostParameters);
checkAdqPatchDisabledLocalMatching();

return true;
}
Expand Down Expand Up @@ -205,11 +204,4 @@ void AdqPatchParams::checkAdqPatchIncludeHurdleCost(const bool includeHurdleCost
if (curtailmentSharing.includeHurdleCost && !includeHurdleCostParameters)
throw Error::IncompatibleHurdleCostCSR();
}

void AdqPatchParams::checkAdqPatchDisabledLocalMatching() const
{
if (!localMatching.enabled && curtailmentSharing.priceTakingOrder == AdqPatchPTO::isDens)
throw Error::AdqPatchDisabledLMR();
}

} // Antares::Data::AdequacyPatch
} // namespace Antares::Data::AdequacyPatch
15 changes: 5 additions & 10 deletions src/libs/antares/study/parameters/adq-patch-params.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ using namespace Yuni;

namespace Antares::Data::AdequacyPatch
{

//! A default threshold value for initiate curtailment sharing rule
const double defaultThresholdToRunCurtailmentSharing = 0.0;
//! A default threshold value for display local matching rule violations
Expand Down Expand Up @@ -60,7 +59,6 @@ enum class AdqPatchPTO

}; // enum AdqPatchPTO


struct LocalMatching
{
bool enabled = true;
Expand All @@ -73,12 +71,11 @@ struct LocalMatching
//! rule.
bool setToZeroOutsideOutsideLinks = true;
/*!
** \brief Reset to default values related to local matching
*/
** \brief Reset to default values related to local matching
*/
void reset();
bool updateFromKeyValue(const String& key, const String& value);
void addProperties(IniFile::Section* section) const;

};

class CurtailmentSharing
Expand All @@ -97,7 +94,9 @@ class CurtailmentSharing
//! Check CSR cost function prior & after CSR optimization
bool checkCsrCostFunction;

bool updateFromKeyValue(const String& key, const String& value);
bool recomputeDTGMRG = false;

bool updateFromKeyValue(const Yuni::String& key, const Yuni::String& value);
void addProperties(IniFile::Section* section) const;

void reset();
Expand All @@ -106,10 +105,8 @@ class CurtailmentSharing
void resetThresholds();
};


struct AdqPatchParams
{

bool enabled;
LocalMatching localMatching;
CurtailmentSharing curtailmentSharing;
Expand All @@ -122,11 +119,9 @@ struct AdqPatchParams
const AreaList& areas,
const bool includeHurdleCostParameters) const;


void checkAdqPatchStudyModeEconomyOnly(const StudyMode studyMode) const;
void checkAdqPatchContainsAdqPatchArea(const Antares::Data::AreaList& areas) const;
void checkAdqPatchIncludeHurdleCost(const bool includeHurdleCost) const;
void checkAdqPatchDisabledLocalMatching() const;
};

} // namespace Antares::Data::AdequacyPatch
10 changes: 6 additions & 4 deletions src/libs/antares/study/scenario-builder/TSnumberData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,20 @@ bool thermalTSNumberData::apply(Study& study)
// WARNING: We may have some thermal clusters with the `mustrun` option
auto clusterCount = (uint)area.thermal.clusterCount();

const uint tsGenCountThermal = get_tsGenCount(study);

for (uint clusterIndex = 0; clusterIndex != clusterCount; ++clusterIndex)
{
auto& cluster = *(area.thermal.clusters[clusterIndex]);
// alias to the current column
assert(clusterIndex < pTSNumberRules.width);
const auto& col = pTSNumberRules[clusterIndex];

logprefix.clear() << "Thermal: Area '" << area.name << "', cluster: '" << cluster.name()
uint tsGenCount = cluster.tsGenBehavior == LocalTSGenerationBehavior::forceNoGen ?
cluster.series->timeSeries.width : get_tsGenCount(study);

logprefix.clear() << "Thermal: area '" << area.name << "', cluster: '" << cluster.name()
<< "': ";
ret = ApplyToMatrix(errors, logprefix, *cluster.series, col, tsGenCountThermal) && ret;
ret = ApplyToMatrix(errors, logprefix, *cluster.series, col, tsGenCount) && ret;

}
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,57 +1,35 @@
#include "adq_patch_post_process_list.h"
#include "../post_process_commands.h"


namespace Antares::Solver::Simulation
{

AdqPatchPostProcessList::AdqPatchPostProcessList(const AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
uint thread_number,
AreaList& areas,
SheddingPolicy sheddingPolicy,
SimplexOptimization splxOptimization,
Calendar& calendar)
: interfacePostProcessList(problemeHebdo, thread_number)
Calendar& calendar) :
interfacePostProcessList(problemeHebdo, thread_number)
{
post_process_list.push_back(std::make_unique<DispatchableMarginPostProcessCmd>(
problemeHebdo_,
thread_number_,
areas));
post_process_list.push_back(
std::make_unique<DispatchableMarginPostProcessCmd>(problemeHebdo_, thread_number_, areas));
// Here a post process particular to adq patch
post_process_list.push_back(std::make_unique<CurtailmentSharingPostProcessCmd>(
adqPatchParams,
problemeHebdo_,
areas,
thread_number_));
post_process_list.push_back(std::make_unique<HydroLevelsUpdatePostProcessCmd>(
problemeHebdo_,
areas,
false,
false));
adqPatchParams, problemeHebdo_, areas, thread_number_));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, false, false));
post_process_list.push_back(std::make_unique<RemixHydroPostProcessCmd>(
problemeHebdo_,
areas,
sheddingPolicy,
splxOptimization,
thread_number));
problemeHebdo_, areas, sheddingPolicy, splxOptimization, thread_number));
// Here a post process particular to adq patch
post_process_list.push_back(std::make_unique<DTGmarginForAdqPatchPostProcessCmd>(
problemeHebdo_,
areas,
thread_number));
post_process_list.push_back(std::make_unique<HydroLevelsUpdatePostProcessCmd>(
problemeHebdo_,
areas,
true,
false));
post_process_list.push_back(std::make_unique<InterpolateWaterValuePostProcessCmd>(
problemeHebdo_,
areas,
calendar));
post_process_list.push_back(std::make_unique<HydroLevelsFinalUpdatePostProcessCmd>(
problemeHebdo_,
areas));
adqPatchParams, problemeHebdo_, areas, thread_number));
post_process_list.push_back(
std::make_unique<HydroLevelsUpdatePostProcessCmd>(problemeHebdo_, areas, true, false));
post_process_list.push_back(
std::make_unique<InterpolateWaterValuePostProcessCmd>(problemeHebdo_, areas, calendar));
post_process_list.push_back(
std::make_unique<HydroLevelsFinalUpdatePostProcessCmd>(problemeHebdo_, areas));
}

} // namespace Antares::Solver::Simulation
} // namespace Antares::Solver::Simulation
54 changes: 41 additions & 13 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
** 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 <https://opensource.org/license/mpl-2-0/>.
*/

#include "post_process_commands.h"
#include "../simulation/common-eco-adq.h"
Expand Down Expand Up @@ -105,10 +125,14 @@ void RemixHydroPostProcessCmd::execute(const optRuntimeData& opt_runtime_data)
using namespace Antares::Data::AdequacyPatch;

DTGmarginForAdqPatchPostProcessCmd::DTGmarginForAdqPatchPostProcessCmd(
const AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
AreaList& areas,
unsigned int thread_number) :
basePostProcessCommand(problemeHebdo), area_list_(areas), thread_number_(thread_number)
basePostProcessCommand(problemeHebdo),
adqPatchParams_(adqPatchParams),
area_list_(areas),
thread_number_(thread_number)
{
}

Expand Down Expand Up @@ -136,8 +160,11 @@ void DTGmarginForAdqPatchPostProcessCmd::execute(const optRuntimeData&)
// calculate DTG MRG CSR and adjust ENS if neccessary
if (problemeHebdo_->adequacyPatchRuntimeData->wasCSRTriggeredAtAreaHour(Area, hour))
{
dtgMrgCsr = std::max(0.0, dtgMrg - ens);
ens = std::max(0.0, ens - dtgMrg);
if (adqPatchParams_.curtailmentSharing.recomputeDTGMRG)
{
dtgMrgCsr = std::max(0.0, dtgMrg - ens);
ens = std::max(0.0, ens - dtgMrg);
}
// set MRG PRICE to value of unsupplied energy cost, if LOLD=1.0 (ENS>0.5)
if (ens > 0.5)
mrgCost = -area_list_[Area]->thermal.unsuppliedEnergyCost;
Expand Down Expand Up @@ -190,8 +217,8 @@ CurtailmentSharingPostProcessCmd::CurtailmentSharingPostProcessCmd(const AdqPatc
AreaList& areas,
unsigned int thread_number) :
basePostProcessCommand(problemeHebdo),
area_list_(areas),
adqPatchParams_(adqPatchParams),
area_list_(areas),
thread_number_(thread_number)
{
}
Expand Down Expand Up @@ -225,11 +252,11 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation()
{
for (uint hour = 0; hour < nbHoursInWeek; hour++)
{
const auto [netPositionInit, densNew, totalNodeBalance]
= calculateAreaFlowBalance(problemeHebdo_,
adqPatchParams_.localMatching.setToZeroOutsideInsideLinks,
Area,
hour);
const auto [netPositionInit, densNew, totalNodeBalance] = calculateAreaFlowBalance(
problemeHebdo_,
adqPatchParams_.localMatching.setToZeroOutsideInsideLinks,
Area,
hour);
// adjust densNew according to the new specification/request by ELIA
/* DENS_new (node A) = max [ 0; ENS_init (node A) + net_position_init (node A)
+ ? flows (node 1 -> node A) - DTG.MRG(node A)] */
Expand All @@ -245,10 +272,11 @@ double CurtailmentSharingPostProcessCmd::calculateDensNewAndTotalLmrViolation()
.ValeursHorairesDeDefaillanceNegative[hour];
// check LMR violations
totalLmrViolation += LmrViolationAreaHour(
problemeHebdo_,
totalNodeBalance,
adqPatchParams_.curtailmentSharing.thresholdDisplayViolations,
Area, hour);
problemeHebdo_,
totalNodeBalance,
adqPatchParams_.curtailmentSharing.thresholdDisplayViolations,
Area,
hour);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/solver/optimisation/post_process_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ class RemixHydroPostProcessCmd : public basePostProcessCommand

class DTGmarginForAdqPatchPostProcessCmd : public basePostProcessCommand
{
using AdqPatchParams = Antares::Data::AdequacyPatch::AdqPatchParams;

public:
DTGmarginForAdqPatchPostProcessCmd(PROBLEME_HEBDO* problemeHebdo,
DTGmarginForAdqPatchPostProcessCmd(const AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
AreaList& areas,
unsigned int thread_number);

void execute(const optRuntimeData& opt_runtime_data) override;

private:
const AdqPatchParams& adqPatchParams_;
const AreaList& area_list_;
unsigned int thread_number_ = 0;
};
Expand Down Expand Up @@ -91,6 +95,7 @@ class HydroLevelsFinalUpdatePostProcessCmd : public basePostProcessCommand
class CurtailmentSharingPostProcessCmd : public basePostProcessCommand
{
using AdqPatchParams = Antares::Data::AdequacyPatch::AdqPatchParams;

public:
CurtailmentSharingPostProcessCmd(const AdqPatchParams& adqPatchParams,
PROBLEME_HEBDO* problemeHebdo,
Expand Down

0 comments on commit 69bea81

Please sign in to comment.