Conduct::Conduct(const std::string &_name):Transport(_name)
{
- max_flow = actual_flow = 0.0f;
+ max_flow = 0.0f;
// Inicio los parametros de conectores
in_slots = 1;
out_slots = 1;
- actual_flow = 9999;
+ actual_flow = 99999;
}
Conduct::~Conduct()
// Me preguntan por el flujo máximo.
// Primero me actualizo, y luego respondo
float tmp = *((float *)data);
- // update();
actual_flow = (actual_flow>max_flow)?max_flow:actual_flow;
actual_flow = (actual_flow<tmp)?actual_flow:tmp;
send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
- // FIXME : no tiene que ir
- if (out_list.size() == 0) tmp = max_flow;
who->recieve_msg(MSG_RESPONSE_MAX_FLOW, this, &actual_flow);
updated = true;
}
// Seteo mi actualizar en true para evitar entrar de nuevo
actual_flow = 99999;
updated = true;
- switch (dir) {
- case IN:
- send_msg(IN, MSG_QUERY_MAX_FLOW_IN, (void *)&max_flow);
- break;
- case OUT:
- send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, (void *)&max_flow);
- }
+ actual_flow = max_flow;
+ send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, (void *)&actual_flow);
}
void Conduct::simulate()
return;
}
- std::cout << name << "::Flujo actual = " << actual_flow << std::endl;
+ std::list<IConector *>::iterator i = in_list.begin();
+ if (i != in_list.end()) {
+ PlantItem *o = (PlantItem *)(*i);
+ set_color( o->get_color() );
+ }
+ std::cout << name << "::Flujo actual = " << actual_flow << " de " << max_flow << std::endl;
updated = false;
}
-void Conduct::get_state_as_xml(std::stringstream &out)
-{
- out << "\t<conduct name=\"" << name << "\">" << std::endl;
- out << "\t\t<actual_flow>" << actual_flow << "</actual_flow>" << std::endl;
- out << "\t</conduct>" << std::endl;
-}