/* Test pedorro a ver que pasa con lo que esta programado!! */
/* Compilar : g++ -Wall -o test -I../include *.cpp */
-#include "bomb.h"
+#include "pump.h"
#include "conduct.h"
#include "union.h"
+#include "splitter.h"
+#include "drainage.h"
+#include "exclusa.h"
#include <unistd.h>
using namespace std;
int main(int argc, char *argv[])
{
- Bomb *bomba1, *bomba2;
- Conduct *canio1;
- Conduct *canio2;
- Conduct *salida;
- Union *union1;
+ Pump *bomba1;
+ Exclusa *exclusa1;
+ Conduct *salida1;
+ Conduct *salida2;
+ Conduct *entrada;
+ Splitter *split;
+ Drainage *dren1, *dren2;
- bomba1 = new Bomb("bomba1");
- bomba1->set_max_flow(3);
- bomba2 = new Bomb("bomba2");
- bomba2->set_max_flow(5);
- canio1 = new Conduct("cond_1");
- canio1->set_max_flow(5);
- canio2 = new Conduct("cond_2");
- canio2->set_max_flow(5);
+ bomba1 = new Pump("bomba");
+ bomba1->set_max_flow(30);
+ salida1 = new Conduct("salida_1");
+ salida1->set_max_flow(2);
+ salida2 = new Conduct("salida_2");
+ salida2->set_max_flow(5);
+ exclusa1 = new Exclusa("exclusa1");
- union1 = new Union("union");
- union1->set_max_flow(5);
- salida = new Conduct("salida");
- salida->set_max_flow(10);
+ split = new Splitter("splitter");
+ split->set_max_flow(8);
+ entrada = new Conduct("entrada");
+ entrada->set_max_flow(10);
- bomba1->connect(canio1, IConector::OUT);
- canio1->connect(bomba1, IConector::IN);
- canio1->connect(union1, IConector::OUT);
+ dren1 = new Drainage("drenaje1");
+ dren2 = new Drainage("drenaje2");
- bomba2->connect(canio2, IConector::OUT);
- canio2->connect(bomba2, IConector::IN);
- canio2->connect(union1, IConector::OUT);
+ bomba1->connect(exclusa1, IConector::OUT);
+ exclusa1->connect(bomba1, IConector::IN);
+ exclusa1->connect(entrada, IConector::OUT);
+ entrada->connect(exclusa1, IConector::IN);
+ entrada->connect(split, IConector::OUT);
+ split->connect(entrada, IConector::IN);
+ split->connect(salida1, IConector::OUT);
+ split->connect(salida2, IConector::OUT);
+ salida1->connect(split, IConector::IN);
+ salida2->connect(split, IConector::IN);
+ salida1->connect(dren1, IConector::OUT);
+ salida2->connect(dren2, IConector::OUT);
- union1->connect(canio1, IConector::IN);
- union1->connect(canio2, IConector::IN);
- union1->connect(salida, IConector::OUT);
-
- salida->connect(union1, IConector::IN);
+ //// LOGICA DE CONTROL!!
+ // CONECTO LA SALIDA DE LA EXCLUSA A LA ENTRADA DE LA BOMBA
+ bomba1->connect_input_logic( exclusa1->get_logic_output() );
int i = 0;
while (i<10) {
bomba1->update();
- bomba2->update();
- canio1->update();
- canio2->update();
- salida->update();
- union1->update();
+ exclusa1->update();
+ salida1->update();
+ salida2->update();
+ entrada->update();
+ split->update();
+ dren1->update();
+ dren2->update();
bomba1->simulate();
- bomba2->simulate();
- canio1->simulate();
- canio2->simulate();
- salida->simulate();
- union1->simulate();
+ exclusa1->simulate();
+ salida1->simulate();
+ salida2->simulate();
+ entrada->simulate();
+ split->simulate();
+ dren1->simulate();
+ dren2->simulate();
sleep(1);
if (i == 5) {
- bomba1->deactivate();
+ //bomba1->deactivate();
+ // Ahora cierro la exclusa!, la bomba deberia apagarse!!!
+ exclusa1->close();
}
i++;
}
delete bomba1;
- delete bomba2;
- delete canio1;
- delete canio2;
- delete salida;
- delete union1;
+ delete salida1;
+ delete salida2;
+ delete entrada;
+ delete split;
return 1;
}