Commit eb505273 authored by K-H-Ismail's avatar K-H-Ismail Committed by Gauthier Quesnel
Browse files

core: add adptive threshold to cross model ports

parent d2b4c328
......@@ -4611,7 +4611,7 @@ struct accumulator
struct cross
{
model_id id;
input_port_id x[3];
input_port_id x[4];
output_port_id y[2];
time sigma;
......@@ -4628,7 +4628,8 @@ struct cross
{
port_value,
port_if_value,
port_else_value
port_else_value,
port_threshold
};
status initialize(data_array<message, message_id>& /*init*/) noexcept
......@@ -4653,6 +4654,17 @@ struct cross
bool have_message = false;
bool have_message_value = false;
for (const auto& msg : input_ports.get(x[port_threshold]).messages) {
irt_return_if_fail(msg.type == value_type::real_64,
status::model_cross_bad_external_message);
irt_return_if_fail(msg.size() == 1,
status::model_cross_bad_external_message);
threshold = msg.to_real_64(0);
have_message = true;
}
for (const auto& msg : input_ports.get(x[port_value]).messages) {
irt_return_if_fail(msg.type == value_type::real_64,
status::model_cross_bad_external_message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment