Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
restenb committed Feb 7, 2025
1 parent cd04bd5 commit bf557a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
12 changes: 0 additions & 12 deletions include/cosim/system_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,6 @@ inline std::ostream& operator<<(std::ostream& s, const full_variable_name& v)
return s;
}

/// Writes a `power_bond` to an output stream.
/*
inline std::ostream& operator<<(std::ostream& s, const power_bond& pb)
{
s << "u_a: " << pb.u_a << std::endl
<< "u_b: " << pb.u_b << std::endl
<< "y_a: " << pb.y_a << std::endl
<< "y_b: " << pb.y_b << std::endl;
return s;
}
*/

/// Returns a string representation of a `full_variable_name`.
std::string to_text(const full_variable_name& v);

Expand Down
10 changes: 5 additions & 5 deletions src/cosim/osp_config_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ void add_power_bonds(const std::vector<osp_config_parser::PowerBondConnection>&
if (aPowerBond.size() != 2) {
std::ostringstream oss;
oss << "The powerbond " << pbName << " does not have 2 connections! Number of connections found was " << aPowerBond.size();
throw std::invalid_argument(oss.str());
throw std::runtime_error(oss.str());
}

const auto& connectionA = aPowerBond[0];
Expand All @@ -839,14 +839,14 @@ void add_power_bonds(const std::vector<osp_config_parser::PowerBondConnection>&

if ((portA.has_value() && !portB.has_value()) || (!portA.has_value() && portB.has_value())) {
std::ostringstream oss;
oss << "Missing ecco port for powerbond connection " << connectionA.connection.variableA.name << " <-> " << connectionA.connection.variableB.name << ". Both variables in a powerbond must have one of the u_a, u_b, y_a, y_b ports.";
throw std::invalid_argument(oss.str());
oss << "Missing port for powerbond connection " << connectionA.connection.variableA.name << " <-> " << connectionA.connection.variableB.name << ". Both variables in a powerbond must have an input and output port specified as attribute.";
throw std::runtime_error(oss.str());
}

if ((portC.has_value() && !portD.has_value()) || (!portC.has_value() && portD.has_value())) {
std::ostringstream oss;
oss << "Missing ecco port for powerbond connection " << connectionB.connection.variableA.name << " <-> " << connectionB.connection.variableB.name << ". Both variables in a powerbond must have one of the u_a, u_b, y_a, y_b ports.";
throw std::invalid_argument(oss.str());
oss << "Missing port for powerbond connection " << connectionB.connection.variableA.name << " <-> " << connectionB.connection.variableB.name << ". Both variables in a powerbond must have an input and output port specified as attribute.";
throw std::runtime_error(oss.str());
}

auto powerbond = cosim::system_structure::power_bond{};
Expand Down

0 comments on commit bf557a6

Please sign in to comment.