31 #include "TMariposa.h"
35 TMariposa::TMariposa() :
37 FLevControlled =
false;
42 TMariposa::~TMariposa() {
45 TMariposa::TMariposa(
TMariposa *Origen,
int valv) :
47 FNumLev = Origen->FNumLev;
49 FDiametroRef = Origen->FDiametroRef;
51 FDiamRef = FDiametroRef;
55 FLevantamiento.resize(Origen->FLevantamiento.size());
56 FDatosCDEntrada.resize(Origen->FDatosCDEntrada.size());
57 FDatosCDSalida.resize(Origen->FDatosCDSalida.size());
59 for(
int i = 0; i < FNumLev; i++) {
60 FLevantamiento[i] = Origen->FLevantamiento[i];
61 FDatosCDEntrada[i] = Origen->FDatosCDEntrada[i];
62 FDatosCDSalida[i] = Origen->FDatosCDSalida[i];
67 FLevActual = Origen->FLevActual;
68 FLevControlled = Origen->FLevControlled;
69 FControllerID = Origen->FControllerID;
70 FLevControlled = Origen->FLevControlled;
73 void TMariposa::LeeDatosIniciales(
const char *FileWAM, fpos_t &filepos,
int norden,
bool HayMotor,
75 int ctrl = 0, prm = 0;
77 FILE *fich = fopen(FileWAM,
"r");
78 fsetpos(fich, &filepos);
80 FNumeroOrden = norden;
82 fscanf(fich,
"%d %lf ", &FNumLev, &FDiametroRef);
84 FLevantamiento.resize(FNumLev);
85 FDatosCDEntrada.resize(FNumLev);
86 FDatosCDSalida.resize(FNumLev);
88 for(
int i = 0; i < FNumLev; i++) {
89 fscanf(fich,
" %lf %lf %lf", &FLevantamiento[i], &FDatosCDEntrada[i], &FDatosCDSalida[i]);
92 fscanf(fich,
" %lf", &FLevActual);
94 fscanf(fich,
" %d", &ctrl);
96 FLevControlled =
true;
97 fscanf(fich,
" %d %d", &prm, &FControllerID);
100 fgetpos(fich, &filepos);
104 void TMariposa::AsignaLevController(
TController **Controller) {
106 FController = Controller[FControllerID - 1];
109 void TMariposa::CalculaCD(
double Time) {
111 FLevActual = FController->
Output(Time);
113 FCDTubVol = fun_CDin->interp(FLevActual) * FSectionRatio;
114 FCDVolTub = fun_CDout->interp(FLevActual) * FSectionRatio;
117 void TMariposa::GetCDin(
double Time) {
120 FLevActual = FController->
Output(Time);
122 FCDTubVol = fun_CDin->interp(FLevActual) * FSectionRatio;
125 void TMariposa::GetCDout(
double Time) {
128 FLevActual = FController->
Output(Time);
130 FCDVolTub = fun_CDout->interp(FLevActual) * FSectionRatio;
133 #pragma package(smart_init)