X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/4c30f5939017e47c70f79df3a9f737d9ea743db5..9322e49b932d824e5664aa8c0e0f9a41464537b1:/Model/src/exclusa.cpp?ds=inline diff --git a/Model/src/exclusa.cpp b/Model/src/exclusa.cpp index f293208..96c8f99 100644 --- a/Model/src/exclusa.cpp +++ b/Model/src/exclusa.cpp @@ -30,6 +30,8 @@ void Exclusa::update(int dir) // mi estado is_open = input->get_output(); } + if (updated) return; + actual_flow = temp = INFINITO; } void Exclusa::simulate() @@ -49,14 +51,15 @@ void Exclusa::recieve_msg(int msg, IConector *who, void *data) if (updated) { who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &temp); } - temp = *((float *)data); - if (!is_open) temp = 0; + actual_flow = temp = *((float *)data); + if (!is_open) actual_flow = temp = 0; + updated = true; send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &temp); who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &temp); break; case MSG_RESPONSE_MAX_FLOW: if (is_open) - temp = *((float *)data); + actual_flow = temp = *((float *)data); break; default: Control::recieve_msg(msg, who, data); @@ -65,12 +68,10 @@ void Exclusa::recieve_msg(int msg, IConector *who, void *data) void Exclusa::get_state_as_xml(std::stringstream &out) { - // Datos comunes - // hack to avoid output problems :-) - actual_flow = temp; PlantItem::get_state_as_xml(out); out << "\t" << std::endl; out << "\t\t" << ((is_open)?"true":"false") << "" << std::endl; out << "\t" << std::endl; + temp = actual_flow = INFINITO; }