X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/70d2e24643727ab1ea48e1793d609d27b7d21fed..33cdbee1bf8051f1a4c9174aa518107793709fdd:/Model/src/main.cpp?ds=sidebyside diff --git a/Model/src/main.cpp b/Model/src/main.cpp index 3fa359e..5f9187e 100644 --- a/Model/src/main.cpp +++ b/Model/src/main.cpp @@ -6,6 +6,7 @@ #include "union.h" #include "splitter.h" #include "drainage.h" +#include "exclusa.h" #include using namespace std; @@ -14,6 +15,7 @@ using namespace PlaQui::Model; int main(int argc, char *argv[]) { Pump *bomba1; + Exclusa *exclusa1; Conduct *salida1; Conduct *salida2; Conduct *entrada; @@ -27,6 +29,7 @@ int main(int argc, char *argv[]) salida1->set_max_flow(2); salida2 = new Conduct("salida_2"); salida2->set_max_flow(5); + exclusa1 = new Exclusa("exclusa1"); split = new Splitter("splitter"); split->set_max_flow(8); @@ -36,8 +39,10 @@ int main(int argc, char *argv[]) dren1 = new Drainage("drenaje1"); dren2 = new Drainage("drenaje2"); - bomba1->connect(entrada, IConector::OUT); - entrada->connect(bomba1, IConector::IN); + 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); @@ -47,9 +52,14 @@ int main(int argc, char *argv[]) salida1->connect(dren1, IConector::OUT); salida2->connect(dren2, IConector::OUT); + //// 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(); + exclusa1->update(); salida1->update(); salida2->update(); entrada->update(); @@ -58,6 +68,7 @@ int main(int argc, char *argv[]) dren2->update(); bomba1->simulate(); + exclusa1->simulate(); salida1->simulate(); salida2->simulate(); entrada->simulate(); @@ -67,7 +78,9 @@ int main(int argc, char *argv[]) sleep(1); if (i == 5) { - bomba1->deactivate(); + //bomba1->deactivate(); + // Ahora cierro la exclusa!, la bomba deberia apagarse!!! + exclusa1->close(); } i++; }