diff --git a/src/examples/research/realtime/realtime.cpp b/src/examples/research/realtime/realtime.cpp index 25cc2b62..fb727ab0 100644 --- a/src/examples/research/realtime/realtime.cpp +++ b/src/examples/research/realtime/realtime.cpp @@ -90,7 +90,7 @@ void realtime::interaction_phase() } } else if (isdigit(input_ch)) { - int64 input_int = input_ch - '0'; + int64 input_int = int64(input_ch) - '0'; if (input_int == 0) { t_syn_rate_ = 0; } @@ -125,8 +125,8 @@ void realtime::print_frame(distance x) int64 ball_chars = (flight_chars < 48 ? 1 : 0); int64 animation_padding = 48 - flight_chars - ball_chars; auto animation_str = std::string(flight_chars, '-') + - std::string(ball_chars, '0') + - std::string(animation_padding, ' ') + "|"; + std::string(ball_chars, '0') + + std::string(animation_padding, ' ') + "|"; auto t_str = (string_builder() << t_).str(); int64 t_padding = std::max(int64(0), int64(12 - t_str.length())); t_str = std::string(t_padding, ' ') + t_str; diff --git a/src/examples/test_systems/data/data_structures_node.h b/src/examples/test_systems/data/data_structures_node.h index 667a04b4..86631e7e 100644 --- a/src/examples/test_systems/data/data_structures_node.h +++ b/src/examples/test_systems/data/data_structures_node.h @@ -169,7 +169,7 @@ inline duration data_structures_node::unplanned_event(duration elapsed_dt) sv_vector_vector_duration[0][0] *= 1.1; sv_map_duration_float64[987654321_s] = -10; sv_set_pair_float64_string.emplace(9.7, "nine point seven"); - *sv_rate_ptr = 1/0_s; + *sv_rate_ptr = (1/1_ys).fixed_at(yocto); ostringstream_var << "received;"; print("ostringstream_var.str() = " + ostringstream_var.str()); diff --git a/src/sydevs/systems/port.h b/src/sydevs/systems/port.h index cdb461ec..ac34bc81 100644 --- a/src/sydevs/systems/port.h +++ b/src/sydevs/systems/port.h @@ -321,6 +321,11 @@ const T& port::value() const throw std::logic_error("Attempt to get value on message input port (" + this->port_name() + ") " + "of node (" + full_node_name + ") outside of unplanned event"); } + if (const_cast(this->external_interface()).message_input_port_index() != this->port_index()) { + const auto& full_node_name = const_cast(this->external_interface()).full_name(); + throw std::logic_error("Attempt to get value on message input port (" + this->port_name() + ") " + + "of node (" + full_node_name + "), which was not the port that received the message."); + } const auto& val = const_cast(this->external_interface()).message_input_port_value(this->port_index()); return const_cast(val.template dereference()); }