Skip to content

Commit 299fc3d

Browse files
committed
Update libcosim to 0.11.1
1 parent 61b180b commit 299fc3d

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ endif()
3636
# Dependencies
3737
# ==============================================================================
3838

39+
find_package(libcbor REQUIRED)
3940
find_package(libcosim REQUIRED)
4041
find_package(Boost REQUIRED COMPONENTS log program_options)
4142

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def requirements(self):
1313
self.tool_requires("cmake/[>=3.19]")
1414
if self.settings.os == "Linux":
1515
self.tool_requires("patchelf/[<0.18]")
16-
self.requires("libcosim/0.10.4@osp/stable")
16+
self.requires("libcosim/0.11.1@osp/stable")
1717
self.requires("boost/[>=1.71]")
1818

1919
def layout(self):

src/run.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,18 @@ cosim::execution load_system_structure(
8282
(cosim::filesystem::is_directory(path) &&
8383
cosim::filesystem::exists(path / "OspSystemStructure.xml"))) {
8484
const auto config = cosim::load_osp_config(path, uriResolver);
85-
auto execution = cosim::execution(
86-
startTime,
87-
std::make_shared<cosim::fixed_step_algorithm>(config.step_size, workerThreadCount));
85+
std::shared_ptr<cosim::algorithm> algorithm;
86+
87+
std::visit([&algorithm, &config, &workerThreadCount](auto&& value) {
88+
using T = std::decay_t<decltype(value)>;
89+
if constexpr (std::is_same_v<T, cosim::fixed_step_algorithm_params>) {
90+
algorithm = std::make_shared<cosim::fixed_step_algorithm>(std::get<cosim::fixed_step_algorithm_params>(config.algorithm_configuration), workerThreadCount);
91+
} else if constexpr (std::is_same_v<T, cosim::ecco_algorithm_params>) {
92+
algorithm = std::make_shared<cosim::ecco_algorithm>(std::get<cosim::ecco_algorithm_params>(config.algorithm_configuration), workerThreadCount);
93+
}
94+
}, config.algorithm_configuration);
95+
96+
auto execution = cosim::execution(startTime, algorithm);
8897
cosim::inject_system_structure(
8998
execution,
9099
config.system_structure,
@@ -154,6 +163,7 @@ class progress_monitor : public cosim::observer
154163
: logger_(startTime, duration, percentIncrement, mrProgressResolution)
155164
{}
156165

166+
157167
private:
158168
void simulator_added(cosim::simulator_index, cosim::observable*, cosim::time_point) override {}
159169
void simulator_removed(cosim::simulator_index, cosim::time_point) override {}
@@ -184,6 +194,8 @@ class progress_monitor : public cosim::observer
184194
override
185195
{}
186196

197+
void state_restored(cosim::step_number, cosim::time_point) override {}
198+
187199
progress_logger logger_;
188200
};
189201
} // namespace

0 commit comments

Comments
 (0)