Skip to content

Commit

Permalink
Fix uninitialized CSR variables [ANT-2496] (#2518)
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes authored Dec 3, 2024
1 parent da687d6 commit 453af56
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ on:
env:
GITHUB_TOKEN: ${{ github.token }}
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }}
RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }}
RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }}
RUN_SIMPLE_TESTS: false
RUN_EXTENDED_TESTS: false
REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}}
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
vcpkgPackages: yaml-cpp antlr4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ on:
env:
GITHUB_TOKEN: ${{ github.token }}
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }}
RUN_SIMPLE_TESTS: ${{ github.event_name == 'push' || inputs.run-tests == 'true' }}
RUN_EXTENDED_TESTS: ${{ github.event_name == 'schedule' || inputs.run-tests == 'true' }}
RUN_SIMPLE_TESTS: false
RUN_EXTENDED_TESTS: false
REF: ${{ inputs.target_branch =='' && github.ref || inputs.target_branch}}


Expand Down
33 changes: 16 additions & 17 deletions src/solver/optimisation/post_process_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,16 @@ void UpdateMrgPriceAfterCSRcmd::execute(const optRuntimeData&)
{
for (uint32_t Area = 0; Area < problemeHebdo_->NombreDePays; Area++)
{
if (problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] != physicalAreaInsideAdqPatch)
continue;

auto& hourlyResults = problemeHebdo_->ResultatsHoraires[Area];
const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_];
const double unsuppliedEnergyCost = area_list_[Area]->thermal.unsuppliedEnergyCost;

const bool areaInside = problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] == physicalAreaInsideAdqPatch;
for (uint hour = 0; hour < nbHoursInWeek; hour++)
{
const bool isHourTriggeredByCsr = problemeHebdo_->adequacyPatchRuntimeData
->wasCSRTriggeredAtAreaHour(Area, hour);

if (isHourTriggeredByCsr && hourlyResults.ValeursHorairesDeDefaillancePositive[hour] > 0.5)
if (isHourTriggeredByCsr && hourlyResults.ValeursHorairesDeDefaillancePositive[hour] > 0.5 && areaInside)
{
hourlyResults.CoutsMarginauxHoraires[hour] = -unsuppliedEnergyCost;
}
Expand All @@ -168,29 +165,31 @@ void DTGnettingAfterCSRcmd::execute(const optRuntimeData&)
{
for (uint32_t Area = 0; Area < problemeHebdo_->NombreDePays; Area++)
{
if (problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area] != physicalAreaInsideAdqPatch)
continue;

auto& hourlyResults = problemeHebdo_->ResultatsHoraires[Area];
const auto& scratchpad = area_list_[Area]->scratchpad[thread_number_];
const double unsuppliedEnergyCost = area_list_[Area]->thermal.unsuppliedEnergyCost;

for (uint hour = 0; hour < nbHoursInWeek; hour++)
{
const bool isHourTriggeredByCsr = problemeHebdo_->adequacyPatchRuntimeData
->wasCSRTriggeredAtAreaHour(Area, hour);
const bool isHourTriggeredByCsr
= problemeHebdo_->adequacyPatchRuntimeData->wasCSRTriggeredAtAreaHour(Area, hour);

const double dtgMrg = scratchpad.dispatchableGenerationMargin[hour];
const double ens = hourlyResults.ValeursHorairesDeDefaillancePositive[hour];

// Default value (when the hour is not triggered by CSR)
hourlyResults.ValeursHorairesDtgMrgCsr[hour] = dtgMrg;
hourlyResults.ValeursHorairesDeDefaillancePositiveCSR[hour] = ens;

if (isHourTriggeredByCsr)
const bool areaInside = problemeHebdo_->adequacyPatchRuntimeData->areaMode[Area]
== physicalAreaInsideAdqPatch;
if (isHourTriggeredByCsr
&& areaInside)
{
hourlyResults.ValeursHorairesDtgMrgCsr[hour] = std::max(0.0, dtgMrg - ens);
hourlyResults.ValeursHorairesDeDefaillancePositiveCSR[hour] = std::max(0.0, ens - dtgMrg);
hourlyResults.ValeursHorairesDeDefaillancePositiveCSR[hour]
= std::max(0.0, ens - dtgMrg);
}
else
{
// Default value (when the hour is not triggered by CSR)
hourlyResults.ValeursHorairesDtgMrgCsr[hour] = dtgMrg;
hourlyResults.ValeursHorairesDeDefaillancePositiveCSR[hour] = ens;
}
}
}
Expand Down

0 comments on commit 453af56

Please sign in to comment.