31 #include "TTipoValvula.h"
33 #include "TCilindro.h"
34 #include "TDeposito.h"
39 TTipoValvula::TTipoValvula(nmTipoValvula TipVal) {
41 FTipoValvula = TipVal;
45 FGraficaCDEINS =
false;
46 FGraficaCDSINS =
false;
47 FGraficaCDEMED =
false;
48 FGraficaCDSMED =
false;
61 TTipoValvula::~TTipoValvula() {
68 void TTipoValvula::AsignaParametros(
int Pipe,
int Nodo,
int Tipo,
int Valvula,
double dTubo,
int sentido) {
76 }
catch(exception &N) {
77 std::cout <<
"ERROR: AsignaParametros TypeOfValve" << std::endl;
87 double TTipoValvula::LeeDiametro() {
94 }
catch(exception &N) {
95 std::cout <<
"ERROR: LeeDiametro TypeOfValve" << std::endl;
113 void TTipoValvula::AsignaCRecuperacion(
double Valor) {
114 FCRecuperacion = Valor;
120 void TTipoValvula::AsignaCDVolTub(
double Valor) {
127 void TTipoValvula::LeeDatosGraficasINS(
const char *FileWAM, fpos_t &filepos) {
129 int ndv = 0, var = 0;
130 FILE *fich = fopen(FileWAM,
"r");
131 fsetpos(fich, &filepos);
134 fscanf(fich,
" %d", &ndv);
135 for(
int i = 0; i < ndv; i++) {
136 fscanf(fich,
" %d", &var);
139 FGraficaCDEINS =
true;
142 FGraficaCDSINS =
true;
146 fgetpos(fich, &filepos);
148 }
catch(exception &N) {
149 std::cout <<
"ERROR: LeeDatosGraficas TypeOfValve" << std::endl;
159 void TTipoValvula::CabeceraGraficaINS(stringstream& insoutput,
int nodo) {
167 insoutput << Label.c_str();
171 insoutput << Label.c_str();
175 }
catch(exception &N) {
176 std::cout <<
"ERROR: CabeceraGrafica TypeOfValve" << std::endl;
186 void TTipoValvula::ImprimeGraficaINS(stringstream& insoutput) {
191 insoutput <<
"\t" << FCDTubVol;
193 insoutput <<
"\t" << FCDVolTub;
196 }
catch(exception &N) {
197 std::cout <<
"ERROR: ImprimeGrafica TypeOfValve" << std::endl;
207 void TTipoValvula::AcumulaCDMedio(
double TiempoActual) {
210 DeltaT = TiempoActual - FTiempoAnt;
211 FTiempoAnt = TiempoActual;
215 FSumCDE += FCDTubVol * DeltaT;
217 FSumCDS += FCDVolTub * DeltaT;
220 }
catch(exception &N) {
221 std::cout <<
"ERROR: AcumulaCDMedio TypeOfValve" << std::endl;
231 void TTipoValvula::LeeDatosGraficasMED(
const char *FileWAM, fpos_t &filepos) {
233 int ndv = 0, var = 0;
234 FILE *fich = fopen(FileWAM,
"r");
235 fsetpos(fich, &filepos);
239 fscanf(fich,
" %d", &ndv);
240 for(
int i = 0; i < ndv; i++) {
241 fscanf(fich,
" %d", &var);
244 FGraficaCDEMED =
true;
247 FGraficaCDSMED =
true;
251 fgetpos(fich, &filepos);
253 }
catch(exception &N) {
254 std::cout <<
"ERROR: LeeDatosGraficas TypeOfValve" << std::endl;
264 void TTipoValvula::CabeceraGraficaMED(stringstream& medoutput,
int nodo) {
272 medoutput << Label.c_str();
276 medoutput << Label.c_str();
280 }
catch(exception &N) {
281 std::cout <<
"ERROR: CabeceraGrafica TypeOfValve" << std::endl;
291 void TTipoValvula::ImprimeGraficaMED(stringstream& medoutput) {
296 FCDEMedio = FSumCDE / FSumTime;
297 medoutput <<
"\t" << FCDEMedio;
301 FCDSMedio = FSumCDS / FSumTime;
302 medoutput <<
"\t" << FCDSMedio;
308 }
catch(exception &N) {
309 std::cout <<
"ERROR: ImprimeGrafica TypeOfValve" << std::endl;
319 void TTipoValvula::PutPipe(
TTubo *Pipe,
int node) {
324 FSectionRatio =
pow2(FDiamRef / FDiamTubo);
328 FCDTubVol *= FSectionRatio;
329 FCDVolTub *= FSectionRatio;
336 void TTipoValvula::PutCylider(
TCilindro *Cylinder) {
337 FCylinder = Cylinder;
343 void TTipoValvula::PutPlenum(
TDeposito *Plenum) {
351 #pragma package(smart_init)