31 #include "TControlInyeccion.h"
36 TControlInyeccion::TControlInyeccion() {
38 FVector_Mf_mapa = NULL;
39 FVector_Mf_mapaPrail = NULL;
40 FVector_Prail_Regimen_mapa = NULL;
41 FVector_Regimen_mapa = NULL;
43 FMapa_SOI_Principal = NULL;
44 FMapa_SOI_Piloto = NULL;
45 FMapa_Combustible_Piloto = NULL;
55 TControlInyeccion::~TControlInyeccion() {
57 if(FVector_Mf_mapa != NULL)
58 delete FVector_Mf_mapa;
59 if(FVector_Mf_mapaPrail != NULL)
60 delete FVector_Mf_mapaPrail;
61 if(FVector_Prail_Regimen_mapa != NULL)
62 delete FVector_Prail_Regimen_mapa;
63 if(FVector_Regimen_mapa != NULL)
64 delete FVector_Regimen_mapa;
66 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
67 delete FMapa_Combustible_Piloto[i];
68 delete FMapa_SOI_Principal[i];
69 delete FMapa_SOI_Piloto[i];
70 delete FMapa_Prail[i];
72 delete[] FMapa_Combustible_Piloto;
73 delete[] FMapa_SOI_Principal;
74 delete[] FMapa_SOI_Piloto;
84 void TControlInyeccion::LeeDatosEntrada(
char *Ruta, FILE *fich) {
89 for(
int i = 0; i <= (int) strlen(Ruta); i++) {
90 DatosInyeccion[i] = Ruta[i];
93 fscanf(fich,
"%s ", &FileInyeccion);
94 strcat(DatosInyeccion, FileInyeccion);
96 FichInyeccion = fopen(DatosInyeccion,
"r");
97 if((FichInyeccion = fopen(DatosInyeccion,
"r")) == NULL) {
98 std::cout <<
"ERROR: Fichero de con datos del inyeccion no cargado";
100 fscanf(FichInyeccion,
"%d %d %d %d ", &FNumeroDatos_Prail_Regimen, &FNumeroDatos_Mf_Prail, &FNumeroDatos_Mf,
101 &FNumeroDatos_Regimen);
102 FVector_Mf_mapa =
new double[FNumeroDatos_Mf];
103 FVector_Mf_mapaPrail =
new double[FNumeroDatos_Mf_Prail];
104 FVector_Prail_Regimen_mapa =
new double[FNumeroDatos_Prail_Regimen];
105 FVector_Regimen_mapa =
new double[FNumeroDatos_Regimen];
107 FMapa_Combustible_Piloto =
new double*[FNumeroDatos_Mf];
108 FMapa_SOI_Principal =
new double*[FNumeroDatos_Mf];
109 FMapa_SOI_Piloto =
new double*[FNumeroDatos_Mf];
110 FMapa_Prail =
new double*[FNumeroDatos_Mf_Prail];
111 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
112 FMapa_Combustible_Piloto[i] =
new double[FNumeroDatos_Regimen];
113 FMapa_SOI_Principal[i] =
new double[FNumeroDatos_Regimen];
114 FMapa_SOI_Piloto[i] =
new double[FNumeroDatos_Regimen];
115 FMapa_Prail[i] =
new double[FNumeroDatos_Prail_Regimen];
118 for(
int i = 0; i < FNumeroDatos_Prail_Regimen; i++) {
119 fscanf(FichInyeccion,
"%lf ", &FVector_Prail_Regimen_mapa[i]);
121 for(
int i = 0; i < FNumeroDatos_Regimen; i++) {
122 fscanf(FichInyeccion,
"%lf ", &FVector_Regimen_mapa[i]);
124 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
125 fscanf(FichInyeccion,
"%lf ", &FVector_Mf_mapa[i]);
127 for(
int i = 0; i < FNumeroDatos_Mf_Prail; i++) {
128 fscanf(FichInyeccion,
"%lf ", &FVector_Mf_mapaPrail[i]);
130 for(
int i = 0; i < FNumeroDatos_Mf_Prail; i++) {
131 for(
int j = 0; j < FNumeroDatos_Prail_Regimen; j++) {
132 fscanf(FichInyeccion,
"%lf ", &FMapa_Prail[i][j]);
135 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
136 for(
int j = 0; j < FNumeroDatos_Regimen; j++) {
137 fscanf(FichInyeccion,
"%lf ", &FMapa_SOI_Principal[i][j]);
140 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
141 for(
int j = 0; j < FNumeroDatos_Regimen; j++) {
142 fscanf(FichInyeccion,
"%lf ", &FMapa_SOI_Piloto[i][j]);
145 for(
int i = 0; i < FNumeroDatos_Mf; i++) {
146 for(
int j = 0; j < FNumeroDatos_Regimen; j++) {
147 fscanf(FichInyeccion,
"%lf ", &FMapa_Combustible_Piloto[i][j]);
150 fclose(FichInyeccion);
152 FSOI =
new double[2];
153 FMasaFuel =
new double[2];
155 }
catch(exception &N) {
156 std::cout <<
"ERROR: TControlInyeccion::LeeDatosEntrada (DLL)" << std::endl;
157 std::cout <<
"Tipo de error: " << N.what() << std::endl;
165 void TControlInyeccion::CalculaSistemaInyeccion(
double MasaFuel,
double Regimen) {
179 FNumeroInyecciones = 2;
180 MasaFuel = MasaFuel * 1e6;
183 Prail = Interpolacion_bidimensional(Regimen, MasaFuel, FVector_Mf_mapaPrail, FVector_Prail_Regimen_mapa, FMapa_Prail,
184 FNumeroDatos_Prail_Regimen, FNumeroDatos_Mf_Prail);
189 FSOI[1] = Interpolacion_bidimensional(Regimen, MasaFuel, FVector_Mf_mapa, FVector_Regimen_mapa, FMapa_SOI_Principal,
190 FNumeroDatos_Regimen, FNumeroDatos_Mf);
193 FMasaFuel[0] = Interpolacion_bidimensional(Regimen, MasaFuel, FVector_Mf_mapa, FVector_Regimen_mapa,
194 FMapa_Combustible_Piloto, FNumeroDatos_Regimen, FNumeroDatos_Mf);
197 FMasaFuel[1] = MasaFuel - FMasaFuel[0];
199 FDiferencia_SOI = Interpolacion_bidimensional(Regimen, MasaFuel, FVector_Mf_mapa, FVector_Regimen_mapa,
200 FMapa_SOI_Piloto, FNumeroDatos_Regimen, FNumeroDatos_Mf);
203 FSOI[0] = FSOI[1] - FDiferencia_SOI;
205 for(
int i = 2; i < 8; i++) {
210 }
catch(exception &N) {
211 std::cout <<
"ERROR: TControlInyeccion::CalculaSistemaInyeccion " << std::endl;
212 std::cout <<
"Tipo de error: " << N.what() << std::endl;
220 double TControlInyeccion::GetSOI(
int i) {
225 }
catch(exception &N) {
226 std::cout <<
"ERROR: TControlInyeccion::GetSOI (DLL) " << std::endl;
227 std::cout <<
"Tipo de error: " << N.what() << std::endl;
235 double TControlInyeccion::GetMasaFuel(
int i) {
240 }
catch(exception &N) {
241 std::cout <<
"ERROR: TControlInyeccion::GetMasaFuel (DLL)" << std::endl;
242 std::cout <<
"Tipo de error: " << N.what() << std::endl;
250 #pragma package(smart_init)