/* 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>
+#include <iostream>
+#include "simulator.h"
using namespace std;
using namespace PlaQui::Model;
int main(int argc, char *argv[])
{
- Bomb *bomba;
- Conduct *canio1;
- Conduct *canio2;
+ Simulator *sim = new Simulator(argv[1]);
- 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;
- while (i<10) {
- bomba->update();
- canio1->update();
- canio2->update();
-
- bomba->simulate();
- canio1->simulate();
- canio2->simulate();
-
- sleep(1);
- if (i == 5) {
- bomba->deactivate();
+ int i=0;
+ while (i<5) {
+ if (i==1) {
+ sim->set_open("exclusa6", false);
+ std::cout << "apagando" << std::endl;
}
i++;
+ sim->simulate();
+ std::cout << sim->get_state_as_xml() << std::endl << std::endl;
}
- delete bomba;
- delete canio1;
- delete canio2;
+ delete sim;
return 1;
}