Skip to content

Commit

Permalink
split library and model
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Dec 13, 2024
1 parent af95bc3 commit f70e7b6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/solver/systemParser/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,25 @@ using namespace Antares::Study;
namespace Antares::Solver::SystemConverter
{

static std::pair<std::string, std::string> splitLibraryModelString(const std::string& s)
{
size_t pos = s.find('.');
if (pos == std::string::npos)
{
throw std::runtime_error("Error while splitting library model: " + s +
"Correct format is lirabry.model");
}

std::string library = s.substr(0, pos);
std::string model = s.substr(pos + 1);
return {library, model};
}

static SystemModel::Component createComponent(const SystemParser::Component& c)
{
const auto [libraryId, modelId] = splitLibraryModelString(c.model);
SystemModel::ModelBuilder model_builder;
auto model = model_builder.withId(c.model).build();
auto model = model_builder.withId(modelId).build();
SystemModel::ComponentBuilder component_builder;

/* std::map<std::string, double> parameters; */
Expand Down

0 comments on commit f70e7b6

Please sign in to comment.