out_slots = 2;
max_flow = actual_flow = 0.0f;
updated = true;
+ out_on_zero = out_ready = 0;
}
Splitter::~Splitter()
if (max_flow < actual_flow) actual_flow = max_flow;
- actual_flow /= 2.0f;
+ if (out_on_zero == 0)
+ actual_flow /= 2.0f;
send_msg(OUT, MSG_QUERY_MAX_FLOW_OUT, &actual_flow);
std::cout << name << ":Split " << max << std::endl;
#endif
if (pos == OUT) {
- if (max < actual_flow) actual_flow = max;
- if (max_flow < actual_flow) actual_flow = max_flow;
+ if (max == 0) {
+ out_on_zero++;
+ switch (out_on_zero) {
+ case 1:
+ if (out_ready == 0) {
+ actual_flow = max_flow;
+ }
+ break;
+ case 2:
+ actual_flow = 0.0;
+ }
+ } else {
+ if (max < actual_flow) actual_flow = max;
+ if (max_flow < actual_flow) actual_flow = max_flow;
+ }
+ out_ready++;
} else {
if (((2*max) < actual_flow) && (max != 0))
actual_flow = 2*max;
// Si ya me actualice, no lo tengo que hacer de nuevo
if (updated) return;
// Seteo mi actualizar en true para evitar entrar de nuevo
- actual_flow = 99999;
+ actual_flow = INFINITO;
updated = true;
switch (dir) {
case IN:
return;
}
- 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 << "::Flujo actual = " << actual_flow << std::endl;
#endif
updated = false;
+ color_updated = false;
+ out_on_zero = out_ready = 0;
}