-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modeleur 2.1: Lib for modeling objects [ANT-1877] (#2383)
Add basic classes and structures to represent a model library
- Loading branch information
Showing
14 changed files
with
536 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
project(LibObjectModel) | ||
|
||
set(SRC_model | ||
model.cpp | ||
|
||
include/antares/solver/libObjectModel/library.h | ||
include/antares/solver/libObjectModel/model.h | ||
include/antares/solver/libObjectModel/parameter.h | ||
include/antares/solver/libObjectModel/valueType.h | ||
include/antares/solver/libObjectModel/variable.h | ||
include/antares/solver/libObjectModel/constraint.h | ||
include/antares/solver/libObjectModel/expression.h | ||
include/antares/solver/libObjectModel/port.h | ||
include/antares/solver/libObjectModel/portField.h | ||
include/antares/solver/libObjectModel/portFieldDefinition.h | ||
include/antares/solver/libObjectModel/portType.h | ||
) | ||
|
||
source_group("libObjectModel" FILES ${SRC_model}) | ||
add_library(antares-solver-libObjectModel | ||
${SRC_model}) | ||
|
||
target_include_directories(antares-solver-libObjectModel | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
) | ||
target_link_libraries(antares-solver-libObjectModel | ||
PUBLIC | ||
) | ||
install(DIRECTORY include/antares | ||
DESTINATION "include" | ||
) |
43 changes: 43 additions & 0 deletions
43
src/solver/libModelObject/include/antares/solver/libObjectModel/constraint.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "expression.h" | ||
#include "parameter.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
/// A constraint linking variables and parameters of a model together | ||
class Constraint | ||
{ | ||
public: | ||
Constraint(); | ||
~Constraint() = default; | ||
|
||
private: | ||
std::string name_; | ||
Expression expression_; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
35 changes: 35 additions & 0 deletions
35
src/solver/libModelObject/include/antares/solver/libObjectModel/expression.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
class Expression | ||
{ | ||
public: | ||
Expression(); | ||
~Expression() = default; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
46 changes: 46 additions & 0 deletions
46
src/solver/libModelObject/include/antares/solver/libObjectModel/library.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <map> | ||
|
||
#include "model.h" | ||
#include "portType.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
/// A library is a collection of models | ||
class Library | ||
{ | ||
public: | ||
Library(); | ||
~Library() = default; | ||
|
||
private: | ||
std::string id_; | ||
std::string description_; | ||
|
||
std::map<std::string, PortType> portTypes_; | ||
std::map<std::string, Model> models_; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
60 changes: 60 additions & 0 deletions
60
src/solver/libModelObject/include/antares/solver/libObjectModel/model.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <vector> | ||
|
||
#include "constraint.h" | ||
#include "expression.h" | ||
#include "parameter.h" | ||
#include "port.h" | ||
#include "variable.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
/** | ||
* Defines a model that can be referenced by actual components. | ||
* A model defines the behaviour of those components. | ||
*/ | ||
class Model | ||
{ | ||
public: | ||
Model(); | ||
~Model() = default; | ||
|
||
std::vector<Constraint*> getConstraints(); | ||
|
||
private: | ||
std::string id_; | ||
Expression objective_; | ||
|
||
std::map<std::string, Parameter> parameters_; | ||
std::map<std::string, Variable> variables_; | ||
|
||
std::map<std::string, Constraint> constraints_; | ||
std::map<std::string, Constraint> bindingConstraints_; | ||
|
||
std::map<std::string, Port> ports_; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
48 changes: 48 additions & 0 deletions
48
src/solver/libModelObject/include/antares/solver/libObjectModel/parameter.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "valueType.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
/** | ||
* A parameter of the model: a parameter is mainly defined by a name and expected type. | ||
* When the model is instantiated as a component, a value must be provided for | ||
* parameters, either as constant values or timeseries-based values. | ||
*/ | ||
class Parameter | ||
{ | ||
public: | ||
Parameter(); | ||
~Parameter() = default; | ||
|
||
private: | ||
std::string name_; | ||
ValueType type_; | ||
bool timeDependent_ = true; // optional at construction | ||
bool scenarioDependent_ = true; // optional at construction | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
41 changes: 41 additions & 0 deletions
41
src/solver/libModelObject/include/antares/solver/libObjectModel/port.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "portType.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
class Port | ||
{ | ||
public: | ||
Port(); | ||
~Port() = default; | ||
|
||
private: | ||
std::string name_; | ||
PortType type_; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
34 changes: 34 additions & 0 deletions
34
src/solver/libModelObject/include/antares/solver/libObjectModel/portField.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
class PortField | ||
{ | ||
private: | ||
std::string name; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
40 changes: 40 additions & 0 deletions
40
src/solver/libModelObject/include/antares/solver/libObjectModel/portFieldDefinition.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
** 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 <https://opensource.org/license/mpl-2-0/>. | ||
*/ | ||
#pragma once | ||
|
||
#include "port.h" | ||
#include "portType.h" | ||
|
||
namespace Antares::Solver::ObjectModel | ||
{ | ||
|
||
class PortFieldDefinition | ||
{ | ||
PortFieldDefinition(); | ||
~PortFieldDefinition() = default; | ||
|
||
private: | ||
Port port_; | ||
PortField field_; | ||
Expression definition_; | ||
}; | ||
|
||
} // namespace Antares::Solver::ObjectModel |
Oops, something went wrong.