X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/70d2e24643727ab1ea48e1793d609d27b7d21fed..cafdb587ee6e195e5a917cea7570c2ea7e22a003:/Model/src/pump.cpp diff --git a/Model/src/pump.cpp b/Model/src/pump.cpp index 086138f..9c2a9b4 100644 --- a/Model/src/pump.cpp +++ b/Model/src/pump.cpp @@ -4,13 +4,16 @@ using namespace PlaQui::Model; -Pump::Pump(const std::string &_name):Source(_name) +Pump::Pump(const std::string &_name):Source(_name),Control(_name) { in_slots = 0; out_slots = 1; active = true; open = true; max_flow = actual_flow = 0.0f; + input = new ByPass(); + output = new ByPass(); + ((ByPass *)output)->set_control(this); } Pump::~Pump() @@ -20,6 +23,8 @@ Pump::~Pump() void Pump::update(int dir) { if (updated) return; + // Me fijo si me tengo que apagar automaticamente + open = input->get_output(); if (active && open) actual_flow = max_flow; else @@ -69,3 +74,14 @@ void Pump::recieve_msg(int msg, IConector *who, void *data) } +void Pump::get_state_as_xml(std::stringstream &out) +{ + // Saco el item basico por XML + PlantItem::get_state_as_xml(out); + + // Saco lo importante de este item + out << "\t" << std::endl; + out << "\t\t" << ((open&&active)?"true":"false") << "" << std::endl; + out << "\t" << std::endl; +} +