From 5f6f0e033ee4a5c7e1b06f6c13107ac80e26063c Mon Sep 17 00:00:00 2001 From: payetvin <113102157+payetvin@users.noreply.github.com> Date: Mon, 6 Mar 2023 14:17:49 +0100 Subject: [PATCH] [DEV] Remove link type option from parameters (#1199) --- docs/reference-guide/13-file-format.md | 4 + src/libs/antares/study/fwd.h | 12 --- src/libs/antares/study/parameters.cpp | 27 +----- src/libs/antares/study/parameters.h | 2 - .../options/optimization/optimization.cpp | 85 +------------------ 5 files changed, 9 insertions(+), 121 deletions(-) diff --git a/docs/reference-guide/13-file-format.md b/docs/reference-guide/13-file-format.md index c60592fe27..d1f3efeec4 100644 --- a/docs/reference-guide/13-file-format.md +++ b/docs/reference-guide/13-file-format.md @@ -1,6 +1,10 @@ # Study format changes This is a list of all recent changes that came with new Antares Simulator features. The main goal of this document is to lower the costs of changing existing interfaces, both GUI and scripts. +## v8.5.2 +### Input +In file **settings/generaldata.ini**, in section `optimization`, link-type is now deprecated + ## v8.5.0 ### Input In file **settings/generaldata.ini**, in section `adequacy patch`, add properties diff --git a/src/libs/antares/study/fwd.h b/src/libs/antares/study/fwd.h index b6e095b6a0..57b4c5f5d0 100644 --- a/src/libs/antares/study/fwd.h +++ b/src/libs/antares/study/fwd.h @@ -201,18 +201,6 @@ enum StyleType std::string styleToString(const StyleType& style); -/*! -** \brief Link Type mode -*/ -enum LinkType -{ - //! Link Type defined locally - ltLocal = 0, - //! Link Type AC - ltAC, - -}; // enum LinkType - /*! ** \brief Types of timeSeries ** diff --git a/src/libs/antares/study/parameters.cpp b/src/libs/antares/study/parameters.cpp index b877168430..c56f2afad7 100644 --- a/src/libs/antares/study/parameters.cpp +++ b/src/libs/antares/study/parameters.cpp @@ -620,20 +620,6 @@ static bool SGDIntLoadFamily_Optimization(Parameters& d, return result; } - if (key == "link-type") - { - CString<64, false> v = value; - v.trim(); - v.toLower(); - if (value == "local") - d.linkType = ltLocal; - else if (value == "ac") - d.linkType = ltAC; - else - d.linkType = ltLocal; - return true; - } - if (key == "simplex-range") { d.simplexOptimizationRange = (!value.ifind("day")) ? sorDay : sorWeek; @@ -985,6 +971,9 @@ static bool SGDIntLoadFamily_Legacy(Parameters& d, if (key == "day-ahead-reserve-management") // ignored since 8.4 return true; + if (key == "link-type") // ignored since 8.5.2 + return true; + if (key == "adequacy-block-size") // ignored since 8.5 return true; @@ -1628,15 +1617,7 @@ void Parameters::saveToINI(IniFile& ini) const // Optimization preferences section->add("transmission-capacities", GlobalTransmissionCapacitiesToString(transmissionCapacities)); - switch (linkType) - { - case ltLocal: - section->add("link-type", "local"); - break; - case ltAC: - section->add("link-type", "ac"); - break; - } + section->add("include-constraints", include.constraints); section->add("include-hurdlecosts", include.hurdleCosts); section->add("include-tc-minstablepower", include.thermal.minStablePower); diff --git a/src/libs/antares/study/parameters.h b/src/libs/antares/study/parameters.h index 50ba4150fd..9741d2f952 100644 --- a/src/libs/antares/study/parameters.h +++ b/src/libs/antares/study/parameters.h @@ -483,8 +483,6 @@ class Parameters final //! Transmission capacities GlobalTransmissionCapacities transmissionCapacities; - //! Asset type - LinkType linkType; //! Simplex optimization range (day/week) SimplexOptimization simplexOptimizationRange; //@} diff --git a/src/ui/simulator/windows/options/optimization/optimization.cpp b/src/ui/simulator/windows/options/optimization/optimization.cpp index 10eb1ed3f1..8ff959df39 100644 --- a/src/ui/simulator/windows/options/optimization/optimization.cpp +++ b/src/ui/simulator/windows/options/optimization/optimization.cpp @@ -67,22 +67,6 @@ static void ResetButton(Component::Button* button, Data::GlobalTransmissionCapac button->caption(GlobalTransmissionCapacitiesToString_Display(value)); } -static void ResetButton(Component::Button* button, Data::LinkType value) -{ - assert(button != NULL); - switch (value) - { - case Data::ltLocal: - button->image("images/16x16/light_green.png"); - button->caption(wxT("local values")); - break; - case Data::ltAC: - button->image("images/16x16/light_orange.png"); - button->caption(wxT("set to AC")); - break; - } -} - const char* mpsExportIcon(const Data::mpsExportStatus& mps_export_status) { switch (mps_export_status) @@ -194,18 +178,6 @@ Optimization::Optimization(wxWindow* parent) : s->Add(button, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); pBtnTransmissionCapacities = button; } - // Asset type - { - label = Component::CreateLabel(this, wxT("Link type")); - button = new Component::Button(this, wxT("local values"), "images/16x16/light_green.png"); - button->SetBackgroundColour(bgColor); - button->menu(true); - onPopup.bind(this, &Optimization::onPopupMenuLinkType); - button->onPopupMenu(onPopup); - s->Add(label, 0, wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); - s->Add(button, 0, wxLEFT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); - pBtnLinkType = button; - } // Thermal clusters Min Stable Power { label = Component::CreateLabel(this, wxT("Thermal clusters Min Stable power")); @@ -422,7 +394,6 @@ void Optimization::onResetToDefault(void*) study.parameters.include.hurdleCosts = true; study.parameters.transmissionCapacities = Data::GlobalTransmissionCapacities::localValuesForAllLinks; - study.parameters.linkType = Data::ltLocal; study.parameters.include.thermal.minStablePower = true; study.parameters.include.thermal.minUPTime = true; study.parameters.include.reserve.dayAhead = true; @@ -460,8 +431,6 @@ void Optimization::refresh() ResetButton(pBtnHurdleCosts, study.parameters.include.hurdleCosts); // Transmission capacities ResetButton(pBtnTransmissionCapacities, study.parameters.transmissionCapacities); - // Link type - ResetButton(pBtnLinkType, study.parameters.linkType); // Min Stable power ResetButton(pBtnThermalClusterMinStablePower, study.parameters.include.thermal.minStablePower); // Min U/D time @@ -477,7 +446,7 @@ void Optimization::refresh() // Export mps pBtnExportMPS->image(mpsExportIcon(study.parameters.include.exportMPS)); pBtnExportMPS->caption(Data::mpsExportStatusToString(study.parameters.include.exportMPS)); - + // Unfeasible problem behavior pBtnUnfeasibleProblemBehavior->image( Data::getIcon(study.parameters.include.unfeasibleProblemBehavior)); @@ -700,58 +669,6 @@ void Optimization::onSelectTransmissionCapacity(wxCommandEvent&) setTransmissionCapacity(capacity); } -void Optimization::onPopupMenuLinkType(Component::Button&, wxMenu& menu, void*) -{ - wxMenuItem* it; - - it = Menu::CreateItem(&menu, - wxID_ANY, - wxString() << wxT("local values"), - "images/16x16/light_green.png", - wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(Optimization::onSelectLinkTypeLocal), - nullptr, - this); - - it = Menu::CreateItem( - &menu, wxID_ANY, wxT("set to AC"), "images/16x16/light_orange.png", wxEmptyString); - menu.Connect(it->GetId(), - wxEVT_COMMAND_MENU_SELECTED, - wxCommandEventHandler(Optimization::onSelectLinkTypeAC), - nullptr, - this); -} - -void Optimization::onSelectLinkTypeLocal(wxCommandEvent&) -{ - auto study = Data::Study::Current::Get(); - if (!(!study)) - { - if (study->parameters.linkType != Data::ltLocal) - { - study->parameters.linkType = Data::ltLocal; - refresh(); - MarkTheStudyAsModified(); - } - } -} - -void Optimization::onSelectLinkTypeAC(wxCommandEvent&) -{ - auto study = Data::Study::Current::Get(); - if (!(!study)) - { - if (study->parameters.linkType != Data::ltAC) - { - study->parameters.linkType = Data::ltAC; - refresh(); - MarkTheStudyAsModified(); - } - } -} - // ----------------------------------- // On select methods for MPS export // -----------------------------------