Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
restenb committed Feb 7, 2025
1 parent aa0d689 commit dcb06de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/cosim/osp_config_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ void add_power_bonds(const std::vector<osp_config_parser::PowerBondConnection>&
for (auto& var : connAVariables) {
auto variable = cosim::full_variable_name{var.simulator, var.name};
switch (str_hash(var.port.value())) {
case "input"_hash:
case "input"_hash:
powerbond.set_ua(variable);
break;
case "output"_hash:
Expand Down Expand Up @@ -1166,20 +1166,20 @@ osp_config load_osp_config(

auto algorithm = simInfo.algorithm;
std::transform(algorithm.begin(), algorithm.end(), algorithm.begin(),
[](unsigned char c) { return std::tolower(c); });
[](unsigned char c) { return std::tolower(c); });

if (simInfo.algorithm == "ecco") {
if (algorithm == "ecco") {
if (simInfo.eccoConfiguration.has_value()) {
BOOST_LOG_SEV(log::logger(), log::info) << "Configuring algorithm: ecco";
config.algorithm_configuration = simInfo.eccoConfiguration.value();
} else {
throw std::invalid_argument("No configuration parameters found for ecco algorithm.");
throw std::runtime_error("No configuration parameters found for ecco algorithm.");
}
} else if (simInfo.algorithm == "fixedstep") {
} else if (algorithm == "fixedstep") {
BOOST_LOG_SEV(log::logger(), log::info) << "Configuring algorithm: fixedStep";
config.algorithm_configuration = cosim::fixed_step_configuration{simInfo.stepSize};
} else {
throw std::invalid_argument("Invalid algorithm choice. Allowed values are fixedStep, ecco.");
throw std::runtime_error("Invalid algorithm choice. Allowed values are fixedStep, ecco.");
}

config.system_structure.algorithm = algorithm;
Expand Down
4 changes: 0 additions & 4 deletions tests/data/ecco/quarter_truck/OspSystemStructure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@
</Simulators>
<Connections>
<VariableConnection powerbond="wheelchassis">
<!-- u_a -->
<Variable simulator="chassis" name="velocity" port="input"/>
<!-- y_b -->
<Variable simulator="wheel" name="in_vel" port="output"/>
</VariableConnection>
<VariableConnection powerbond="wheelchassis">
<!-- u_b -->
<Variable simulator="wheel" name="out_spring_damper_f" port="input"/>
<!-- y_a -->
<Variable simulator="chassis" name="force" port="output"/>
</VariableConnection>
</Connections>
Expand Down

0 comments on commit dcb06de

Please sign in to comment.