X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/db48e71a89861a755974c45ea7e7fd5d52de8afa..791761837820d89454dc5ee4a019860dcd6b6477:/Model/src/main.cpp?ds=inline diff --git a/Model/src/main.cpp b/Model/src/main.cpp index 237e158..01f9ecb 100644 --- a/Model/src/main.cpp +++ b/Model/src/main.cpp @@ -3,6 +3,7 @@ /* Compilar : g++ -Wall -o test -I../include *.cpp */ #include "bomb.h" #include "conduct.h" +#include "union.h" #include using namespace std; @@ -10,42 +11,70 @@ using namespace PlaQui::Model; int main(int argc, char *argv[]) { - Bomb *bomba; + Bomb *bomba1, *bomba2; Conduct *canio1; Conduct *canio2; + Conduct *salida; + Union *union1; + - bomba = new Bomb("bomba"); - bomba->set_max_flow(3); + 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(10); + canio1->set_max_flow(5); canio2 = new Conduct("cond_2"); canio2->set_max_flow(5); - bomba->connect(canio1, IConector::OUT); - canio1->connect(bomba, IConector::IN); - canio1->connect(canio2, IConector::OUT); - canio2->connect(canio1, IConector::IN); + union1 = new Union("union"); + union1->set_max_flow(5); + salida = new Conduct("salida"); + salida->set_max_flow(10); + + bomba1->connect(canio1, IConector::OUT); + canio1->connect(bomba1, IConector::IN); + canio1->connect(union1, IConector::OUT); + + bomba2->connect(canio2, IConector::OUT); + canio2->connect(bomba2, IConector::IN); + canio2->connect(union1, IConector::OUT); + + union1->connect(canio1, IConector::IN); + union1->connect(canio2, IConector::IN); + union1->connect(salida, IConector::OUT); + + salida->connect(union1, IConector::IN); int i = 0; while (i<10) { - bomba->update(); + bomba1->update(); + bomba2->update(); canio1->update(); canio2->update(); + salida->update(); + union1->update(); - bomba->simulate(); + bomba1->simulate(); + bomba2->simulate(); canio1->simulate(); canio2->simulate(); + salida->simulate(); + union1->simulate(); sleep(1); if (i == 5) { - bomba->deactivate(); + bomba1->deactivate(); } i++; } - delete bomba; + delete bomba1; + delete bomba2; delete canio1; delete canio2; + delete salida; + delete union1; return 1; }