Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ endif()
# Dependencies
# ==============================================================================

find_package(libcbor REQUIRED)
find_package(libcosim REQUIRED)
find_package(Boost REQUIRED COMPONENTS log program_options)

Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def requirements(self):
self.tool_requires("cmake/[>=3.19]")
if self.settings.os == "Linux":
self.tool_requires("patchelf/[<0.18]")
self.requires("libcosim/0.10.4@osp/stable")
self.requires("libcosim/0.11.1@osp/stable")
self.requires("boost/[>=1.71]")

def layout(self):
Expand Down
27 changes: 24 additions & 3 deletions src/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include <chrono>
#include <memory>
#include <variant>
#include <type_traits>


void run_subcommand::setup_options(
Expand Down Expand Up @@ -72,6 +74,12 @@ void run_subcommand::setup_options(
namespace
{

template<class... Ts>
struct overloaded : Ts... { using Ts::operator()...; };

template<class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

cosim::execution load_system_structure(
const cosim::filesystem::path& path,
cosim::model_uri_resolver& uriResolver,
Expand All @@ -82,9 +90,19 @@ cosim::execution load_system_structure(
(cosim::filesystem::is_directory(path) &&
cosim::filesystem::exists(path / "OspSystemStructure.xml"))) {
const auto config = cosim::load_osp_config(path, uriResolver);
auto execution = cosim::execution(
startTime,
std::make_shared<cosim::fixed_step_algorithm>(config.step_size, workerThreadCount));
std::shared_ptr<cosim::algorithm> algorithm;

std::visit(
overloaded{
[&algorithm, &workerThreadCount](const cosim::fixed_step_algorithm_params& params) {
algorithm = std::make_shared<cosim::fixed_step_algorithm>(params, workerThreadCount);
},
[&algorithm, &workerThreadCount](const cosim::ecco_algorithm_params& params) {
algorithm = std::make_shared<cosim::ecco_algorithm>(params, workerThreadCount);
}},
config.algorithm_configuration);

auto execution = cosim::execution(startTime, algorithm);
cosim::inject_system_structure(
execution,
config.system_structure,
Expand Down Expand Up @@ -154,6 +172,7 @@ class progress_monitor : public cosim::observer
: logger_(startTime, duration, percentIncrement, mrProgressResolution)
{}


private:
void simulator_added(cosim::simulator_index, cosim::observable*, cosim::time_point) override {}
void simulator_removed(cosim::simulator_index, cosim::time_point) override {}
Expand Down Expand Up @@ -184,6 +203,8 @@ class progress_monitor : public cosim::observer
override
{}

void state_restored(cosim::step_number, cosim::time_point) override {}

progress_logger logger_;
};
} // namespace
Expand Down