X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/db48e71a89861a755974c45ea7e7fd5d52de8afa..7353f36b6d2eca998f2cb2ca561219b3979ff167:/Model/src/main.cpp?ds=inline diff --git a/Model/src/main.cpp b/Model/src/main.cpp index 237e158..ab4f7f6 100644 --- a/Model/src/main.cpp +++ b/Model/src/main.cpp @@ -1,51 +1,46 @@ /* 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 +#include +#include "simulador.h" using namespace std; using namespace PlaQui::Model; int main(int argc, char *argv[]) { - Bomb *bomba; - Conduct *canio1; - Conduct *canio2; - - bomba = new Bomb("bomba"); - bomba->set_max_flow(3); - canio1 = new Conduct("cond_1"); - canio1->set_max_flow(10); - 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); - - int i = 0; + Simulador *sim = new Simulador(); + + sim->add_pump("bomba1"); + sim->add_conduct("c"); + sim->add_conduct("c1"); + sim->add_drainage("d"); + sim->add_tank("tanque"); + + sim->connect("bomba1", "c", IConector::OUT); + sim->connect("c", "tanque", IConector::OUT); + sim->connect("tanque", "c1", IConector::OUT); + sim->connect("c1", "d", IConector::OUT); + + int i=0; while (i<10) { - bomba->update(); - canio1->update(); - canio2->update(); - - bomba->simulate(); - canio1->simulate(); - canio2->simulate(); - - sleep(1); - if (i == 5) { - bomba->deactivate(); + sim->simulate(); + if (i == 4) { + if (!sim->pump_deactivate("bomba1")) { + std::cout << "c no es pump :-)" << std::endl; + } } i++; } - delete bomba; - delete canio1; - delete canio2; + delete sim; return 1; }