Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/feat waterfall fixed step #108

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cmake-build-*/

# Visual Studio Code
.vscode/
/.vs
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.9)
project("cosim" VERSION "0.8.0")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist")
#set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/dist")

# To enable verbose when needed
set(CMAKE_VERBOSE_MAKEFILE OFF)
Expand All @@ -26,7 +26,7 @@ endif()
if(APPLE)
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
# set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()

# ==============================================================================
Expand All @@ -37,7 +37,7 @@ if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
conan_basic_setup(NO_OUTPUT_DIRS)
else()
message(FATAL_ERROR "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first!")
#message(FATAL_ERROR "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first!")
endif()

find_package(libcosim REQUIRED)
Expand Down
111 changes: 111 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"version": 3,
"configurePresets": [
{
"name": "linux-debug",
"displayName": "Linux Debug",
"description": "Ciblez WSL (Sous-système Windows pour Linux) ou un système Linux distant.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/../osp/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "$env{HOME}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"libcosim_DIR": "$env{HOME}/.vs/osp/install/linux-debug/share/libcosim/cmake"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" } }
},
{
"name": "linux-release",
"displayName": "Linux Release",
"description": "Ciblez WSL (Sous-système Windows pour Linux) ou un système Linux distant.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/../osp/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "$env{HOME}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"libcosim_DIR": "$env{HOME}/.vs/osp/install/linux-release/share/libcosim/cmake"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" } }
},
{
"name": "macos-debug",
"displayName": "macOS Debug",
"description": "Ciblez un système macOS distant.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" },
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" } }
},
{
"name": "windows-base",
"description": "Ciblez Windows avec l'environnement de développement Visual Studio.",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "cl.exe",
"CMAKE_CXX_COMPILER": "cl.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "x64-debug",
"displayName": "x64 Debug",
"description": "Ciblez Windows (64 bits) avec l'environnement de développement Visual Studio. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "x64-release",
"displayName": "x64 Release",
"description": "Ciblez Windows (64 bits) avec l'environnement de développement Visual Studio. (RelWithDebInfo)",
"inherits": "x64-debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"description": "Ciblez Windows (32 bits) avec l'environnement de développement Visual Studio. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "x86-release",
"displayName": "x86 Release",
"description": "Ciblez Windows (32 bits) avec l'environnement de développement Visual Studio. (RelWithDebInfo)",
"inherits": "x86-debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
}
]
}
15 changes: 8 additions & 7 deletions src/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ 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);
bool waterfall_effect = config.algorithm == "waterfallFixedStep";
auto execution = cosim::execution(
startTime,
std::make_shared<cosim::fixed_step_algorithm>(config.step_size, workerThreadCount));
std::make_shared<cosim::fixed_step_algorithm>(config.step_size, workerThreadCount, waterfall_effect));
cosim::inject_system_structure(
execution,
config.system_structure,
Expand Down Expand Up @@ -152,13 +153,13 @@ class progress_monitor : public cosim::observer
int percentIncrement,
std::optional<int> mrProgressResolution)
: 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 {}
void variables_connected(cosim::variable_id, cosim::variable_id, cosim::time_point) override {}
void variable_disconnected(cosim::variable_id, cosim::time_point) override {}
void simulator_added(cosim::simulator_index, cosim::observable*, cosim::time_point) override { }
void simulator_removed(cosim::simulator_index, cosim::time_point) override { }
void variables_connected(cosim::variable_id, cosim::variable_id, cosim::time_point) override { }
void variable_disconnected(cosim::variable_id, cosim::time_point) override { }

void simulation_initialized(
cosim::step_number /*firstStep*/,
Expand All @@ -182,7 +183,7 @@ class progress_monitor : public cosim::observer
cosim::duration,
cosim::time_point)
override
{}
{ }

progress_logger logger_;
};
Expand Down