// mi estado
is_open = input->get_output();
}
+ if (updated) return;
+ actual_flow = temp = INFINITO;
}
void Exclusa::simulate()
{
- std::list<IConector *>::iterator i = in_list.begin();
- if (i != in_list.end()) {
- PlantItem *o = (PlantItem *)(*i);
- set_color( o->get_color() );
- }
#ifdef DEBUG
std::cout << name << ": " << ((is_open)?"Abierta":"Cerrada") << std::endl;
#endif
+
+ updated = false;
+ color_updated = false;
}
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);
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<exclusa name=\"" << name << "\">" << std::endl;
out << "\t\t<active>" << ((is_open)?"true":"false") << "</active>" << std::endl;
out << "\t</exclusa>" << std::endl;
+ temp = actual_flow = INFINITO;
}