Skip to content

Commit

Permalink
Add dir loadfile/ , add readSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 19, 2024
1 parent ce06183 commit 96c13d7
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/solver/modeler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
add_subdirectory(api)
add_subdirectory(ortoolsImpl)
add_subdirectory(loadFiles)
27 changes: 27 additions & 0 deletions src/solver/modeler/loadFiles/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
set(SOURCES
readSystem.cpp
)

# Create the library
add_library(loadFiles STATIC ${SOURCES})
add_library(Antares::loadFiles ALIAS loadFiles)

# Specify include directories
target_include_directories(loadFiles
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

# Link dependencies (if any)
target_link_libraries(loadFiles
PUBLIC
Antares::antares-study-system-model
PRIVATE
io
Antares::systemParser
Antares::modelConverter
)

install(DIRECTORY include/antares
DESTINATION "include"
)
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 <filesystem>

#include "antares/study/system-model/system.h"

namespace Antares::Solver::LoadFiles
{

Study::SystemModel::System loadSystem(const std::filesystem::path& studyPath,
const std::vector<Study::SystemModel::Library>& libraries);

} // namespace Antares::Solver::LoadFiles
44 changes: 44 additions & 0 deletions src/solver/modeler/loadFiles/readSystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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/>.
*/

#include <antares/io/file.h>

#include <antares/solver/systemParser/converter.h>
#include <antares/solver/systemParser/parser.h>

#include "antares/solver/loadFiles/loadFiles.h"

namespace fs = std::filesystem;

namespace Antares::Solver::LoadFiles
{

Study::SystemModel::System loadSystem(const fs::path& studyPath, const std::vector<Study::SystemModel::Library>& libraries)
{
const std::string systemStr = IO::readFile(studyPath / "input" / "system.yml");

SystemParser::Parser parser;
SystemParser::System systemObj = parser.parse(systemStr);

return SystemConverter::convert(systemObj, libraries);;
}

} // namespace Antares::Solver::LoadFiles

0 comments on commit 96c13d7

Please sign in to comment.