From 3440a96c592f6554e62546007a63e0c0a4bd3e49 Mon Sep 17 00:00:00 2001 From: Vincent Payet Date: Mon, 10 Feb 2025 16:03:50 +0100 Subject: [PATCH] Try so specialize vcard in spatial aggregate --- .../variable/commons/spatial-aggregate.h | 72 +++++++++++++++++++ .../antares/solver/variable/economy/all.h | 4 +- .../variable/economy/dispatchableGeneration.h | 8 +++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/solver/variable/include/antares/solver/variable/commons/spatial-aggregate.h b/src/solver/variable/include/antares/solver/variable/commons/spatial-aggregate.h index e065f1ba96..98cd68719d 100644 --- a/src/solver/variable/include/antares/solver/variable/commons/spatial-aggregate.h +++ b/src/solver/variable/include/antares/solver/variable/commons/spatial-aggregate.h @@ -89,6 +89,78 @@ struct MultipleCaptionProxy } }; +template class V> +struct VCardProxyDynamic +{ + //! The real VCard for the variable + typedef typename V::VCardType VCardOrigin; + + //! Caption + static std::string Caption() + { + return VCardOrigin::Caption(); + } + + //! Unit + static std::string Unit() + { + return VCardOrigin::Unit(); + } + + //! The short description of the variable + static std::string Description() + { + return VCardOrigin::Description(); + } + + //! The expecte results + typedef typename VCardOrigin::ResultsType ResultsType; + //! The VCard to look for for calculating spatial aggregates + typedef typename VCardOrigin::VCardForSpatialAggregate VCardForSpatialAggregate; + + typedef typename VCardOrigin::IntermediateValuesType IntermediateValuesType; + typedef typename VCardOrigin::IntermediateValuesBaseType IntermediateValuesBaseType; + typedef + typename VCardOrigin::IntermediateValuesTypeForSpatialAg IntermediateValuesTypeForSpatialAg; + + //! Data Level + static constexpr uint8_t categoryDataLevel = Category::DataLevel::setOfAreas; + //! File level (provided by the type of the results) + static constexpr uint8_t categoryFileLevel = VCardOrigin::categoryFileLevel; + //! Precision (views) + static constexpr uint8_t precision = VCardOrigin::precision; + //! Indentation (GUI) + static constexpr uint8_t nodeDepthForGUI = +0; + //! Decimal precision + static constexpr uint8_t decimal = VCardOrigin::decimal; + //! Number of columns used by the variable (One ResultsType per column) + static constexpr int columnCount = VCardOrigin::dynamicColumns; + //! The Spatial aggregation + static constexpr uint8_t spatialAggregate = Category::noSpatialAggregate; + static constexpr uint8_t spatialAggregateMode = Category::spatialAggregateEachYear; + static constexpr uint8_t spatialAggregatePostProcessing = 0; + + //! Intermediate values + static constexpr uint8_t hasIntermediateValues = 1; + //! Can this variable be non applicable (0 : no, 1 : yes) + static constexpr uint8_t isPossiblyNonApplicable = VCardOrigin::isPossiblyNonApplicable; + + struct Multiple + { + static std::string Caption(const uint indx) + { + return MultipleCaptionProxy::Caption(indx); + } + + static std::string Unit(const unsigned int indx) + { + return MultipleCaptionProxy::Unit(indx); + } + }; + +}; // class VCard + + template class V> struct VCardProxy { diff --git a/src/solver/variable/include/antares/solver/variable/economy/all.h b/src/solver/variable/include/antares/solver/variable/economy/all.h index 651ee080aa..b15cebc766 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/all.h +++ b/src/solver/variable/include/antares/solver/variable/economy/all.h @@ -189,6 +189,8 @@ typedef // Prices Common::SpatialAggregate< TimeSeriesValuesSolar, // Other + Common::SpatialAggregate< + DispatchableGeneration, Common::SpatialAggregate< HydroStorage, Common::SpatialAggregate< @@ -240,7 +242,7 @@ typedef // Prices // - // refs: // #55 - >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VariablesPerSetOfAreas; typedef BindingConstMarginCost< // Marginal cost for a binding constraint diff --git a/src/solver/variable/include/antares/solver/variable/economy/dispatchableGeneration.h b/src/solver/variable/include/antares/solver/variable/economy/dispatchableGeneration.h index bca741b140..bad7ff1c68 100644 --- a/src/solver/variable/include/antares/solver/variable/economy/dispatchableGeneration.h +++ b/src/solver/variable/include/antares/solver/variable/economy/dispatchableGeneration.h @@ -82,6 +82,7 @@ struct VCardDispatchableGeneration typedef IntermediateValues IntermediateValuesDeepType; typedef std::vector IntermediateValuesBaseType; typedef std::vector IntermediateValuesType; + typedef IntermediateValuesBaseType* IntermediateValuesTypeForSpatialAg; }; // class VCard @@ -124,6 +125,13 @@ class DispatchableGeneration }; }; + template + static void InitializeAndReset(U& out, Data::Study& study) + { + out.initializeFromStudy(study); + out.reset(); + } + void initializeFromArea(Data::Study* study, Data::Area* area) { pNbYearsParallel = study->maxNbYearsInParallel;