diff --git a/src/solver/systemParser/encoders.hxx b/src/solver/systemParser/encoders.hxx index 09287c06b5..00eeb27d44 100644 --- a/src/solver/systemParser/encoders.hxx +++ b/src/solver/systemParser/encoders.hxx @@ -22,7 +22,7 @@ #pragma once -#include "antares/solver/modelParser/Library.h" +#include "antares/solver/systemParser/Library.h" #include "yaml-cpp/yaml.h" @@ -47,7 +47,7 @@ inline T as_fallback_default(const Node& n) } template<> -struct convert +struct convert { static bool decode(const Node& node, Antares::Solver::ModelParser::Parameter& rhs) { diff --git a/src/solver/systemParser/include/antares/solver/systemParser/Library.h b/src/solver/systemParser/include/antares/solver/systemParser/Library.h deleted file mode 100644 index c2a881b561..0000000000 --- a/src/solver/systemParser/include/antares/solver/systemParser/Library.h +++ /dev/null @@ -1,116 +0,0 @@ - -/* - * 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 . - */ - -#pragma once -#include -#include -#include - -namespace Antares::Solver::ModelParser -{ -// Define structures -struct Parameter -{ - std::string id; - bool time_dependent; - bool scenario_dependent; -}; - -enum class ValueType -{ - CONTINUOUS, - INTEGER, - BOOL -}; - -inline std::string toString(const ValueType& value_type) -{ - using namespace std::string_literals; - switch (value_type) - { - case ValueType::CONTINUOUS: - return "CONTINUOUS"s; - case ValueType::INTEGER: - return "INTEGER"s; - case ValueType::BOOL: - return "BOOL"s; - default: - return "UNKNOWN"s; - } -} - -struct Variable -{ - std::string id; - std::string lower_bound; - std::string upper_bound; - ValueType variable_type; -}; - -struct Port -{ - std::string id; - std::string type; -}; - -struct PortFieldDefinition -{ - std::string port; - std::string field; - std::string definition; -}; - -struct Constraint -{ - std::string id; - std::string expression; -}; - -struct Model -{ - std::string id; - std::string description; - std::vector parameters; - std::vector variables; - std::vector ports; - std::vector port_field_definitions; - std::vector constraints; - std::string objective; -}; - -struct PortType -{ - std::string id; - std::string description; - // Small optimization: we only need the name of the fields - // No need for an intermediate struct "field" with just a string "name" member - std::vector fields; -}; - -struct Library -{ - std::string id; - std::string description; - std::vector port_types; - std::vector models; -}; -} // namespace Antares::Solver::ModelParser diff --git a/src/solver/systemParser/include/antares/solver/systemParser/library.h b/src/solver/systemParser/include/antares/solver/systemParser/library.h new file mode 100644 index 0000000000..b3d95830ec --- /dev/null +++ b/src/solver/systemParser/include/antares/solver/systemParser/library.h @@ -0,0 +1,55 @@ +/* + * 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 . + */ + +#pragma once + +#include +#include + +namespace Antares::Solver::SystemParser +{ + +struct Parameter +{ + std::string id; + std::string type; + std::string value; +}; + +struct Components +{ + std::string id; + std::string model; + std::string scenarioGroup; + std::vector parameters; +}; + +struct System +{ + std::string id; + std::vector libraries; + std::vector components; + + // will be implemented later + // std::vector connections; +}; + +} // namespace Antares::Solver::SystemParser diff --git a/src/solver/systemParser/include/antares/solver/systemParser/parser.h b/src/solver/systemParser/include/antares/solver/systemParser/parser.h index 0c042ce027..4dabedd256 100644 --- a/src/solver/systemParser/include/antares/solver/systemParser/parser.h +++ b/src/solver/systemParser/include/antares/solver/systemParser/parser.h @@ -21,9 +21,9 @@ */ #pragma once -#include "antares/solver/modelParser/Library.h" +#include "antares/solver/systemParser/Library.h" -namespace Antares::Solver::ModelParser +namespace Antares::Solver::SystemParser { class Parser { @@ -31,6 +31,6 @@ class Parser Parser() = default; ~Parser() = default; - Library parse(const std::string& content); + System parse(const std::string& content); }; -} // namespace Antares::Solver::ModelParser +} // namespace Antares::Solver::SystemParser diff --git a/src/solver/systemParser/parser.cpp b/src/solver/systemParser/parser.cpp index 13d1b120eb..fc921edd12 100644 --- a/src/solver/systemParser/parser.cpp +++ b/src/solver/systemParser/parser.cpp @@ -19,20 +19,21 @@ * along with Antares_Simulator. If not, see . */ -#include "antares/solver/modelParser/parser.h" - -#include "antares/solver/modelParser/Library.h" +#include "antares/solver/systemParser/parser.h" +#include "antares/solver/systemParser/Library.h" #include "encoders.hxx" -namespace Antares::Solver::ModelParser +namespace Antares::Solver::SystemParser { + Library Parser::parse(const std::string& content) { YAML::Node root = YAML::Load(content); - Library library = root["library"].as(); + System system = root["system"].as(); - return library; + return system; } -} // namespace Antares::Solver::ModelParser + +} // namespace Antares::Solver::SystemParser