Skip to content

Commit

Permalink
[DEV] Remove link type option from parameters (#1199)
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin authored Mar 6, 2023
1 parent e60b326 commit 5f6f0e0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 121 deletions.
4 changes: 4 additions & 0 deletions docs/reference-guide/13-file-format.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 0 additions & 12 deletions src/libs/antares/study/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
**
Expand Down
27 changes: 4 additions & 23 deletions src/libs/antares/study/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions src/libs/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ class Parameters final

//! Transmission capacities
GlobalTransmissionCapacities transmissionCapacities;
//! Asset type
LinkType linkType;
//! Simplex optimization range (day/week)
SimplexOptimization simplexOptimizationRange;
//@}
Expand Down
85 changes: 1 addition & 84 deletions src/ui/simulator/windows/options/optimization/optimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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));
Expand Down Expand Up @@ -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
// -----------------------------------
Expand Down

0 comments on commit 5f6f0e0

Please sign in to comment.