Skip to content

Commit

Permalink
Merge pull request #107 from chapman178/master
Browse files Browse the repository at this point in the history
A few fixes
  • Loading branch information
chapman178 authored Apr 2, 2024
2 parents 3227b05 + a7c9a38 commit 74e45e5
Show file tree
Hide file tree
Showing 15 changed files with 5,629 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.mexw64
*.mex
*.bak
*.slxc
slprj/
10 changes: 5 additions & 5 deletions Trunk/Install_TMATS.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ function Install_TMATS()

% TMATSver and date must remain in the listed form for the ver command to work
% properly.
TMATSver = '1.3.1';
TMATSdate = 'Jun-24-2020';
TMATSver = '1.3.2';
TMATSdate = 'Apr-02-2024';

error = 0;
InpMsg{1} = 'Install T-MATS matlab toolbox? Note: Installation will add MATLAB paths and generate MEX files.';
Expand Down Expand Up @@ -88,11 +88,11 @@ function Install_TMATS()
make_file_TMATS;

% return to the root directory
eval(['cd ' CurrDir]);
cd(CurrDir);
disp('All mex files generated');
catch ME
% return to the root directory
eval(['cd ' CurrDir]);
cd(CurrDir);
error = 1;
% rethrow exception to generate error on screen
throw(ME);
Expand All @@ -106,7 +106,7 @@ function Install_TMATS()
fprintf(fid,'%% Install_TMATS - This subroutine installs T-MATS\n');
fprintf(fid,'%% Uninstall_TMATS - This subroutine uninstalls T-MATS\n');
fclose(fid);
eval(['cd ' CurrDir]);
cd(CurrDir);
end


Expand Down
2,804 changes: 2,804 additions & 0 deletions Trunk/TMATS_Library/Lib_Turbo_CompressorVG_TMATS.mdl

Large diffs are not rendered by default.

Binary file removed Trunk/TMATS_Library/Lib_Turbo_CompressorVG_TMATS.slx
Binary file not shown.
2,801 changes: 2,801 additions & 0 deletions Trunk/TMATS_Library/Lib_Turbo_Compressor_TMATS.mdl

Large diffs are not rendered by default.

Binary file removed Trunk/TMATS_Library/Lib_Turbo_Compressor_TMATS.slx
Binary file not shown.
2 changes: 1 addition & 1 deletion Trunk/TMATS_Library/MEX/Nozzle_TMATS.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static void mdlOutputs(SimStruct *S, int_T tid)
/* Dimensions of parameter arrays */
nozzleStruct.A = mxGetNumberOfElements(Y_N_FARVec_p(S));
nozzleStruct.B = mxGetNumberOfElements(X_N_TtVec_p(S));
nozzleStruct.B1 = mxGetNumberOfElements(X_N_PEQPaVec_p(S));
nozzleStruct.BB = mxGetNumberOfElements(X_N_PEQPaVec_p(S));
nozzleStruct.C = mxGetNumberOfElements(X_N_TtVecTG_p(S));

nozzleStruct.IWork = ssGetIWork(S);
Expand Down
2 changes: 1 addition & 1 deletion Trunk/TMATS_Library/MEX/Nozzle_TMATS.tlc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
nozzleStruct.X_N_TtVecTG = (double*)(%<LibBlockParameterBaseAddr(X_N_TtVecTG)>);
nozzleStruct.A = %<LibBlockParameterSize(Y_N_FARVec)[1]>;
nozzleStruct.B = %<LibBlockParameterSize(X_N_TtVec)[1]>;
nozzleStruct.B1 = %<LibBlockParameterSize(X_N_PEQPaVec)[1]>;
nozzleStruct.BB = %<LibBlockParameterSize(X_N_PEQPaVec)[1]>;
nozzleStruct.C = %<LibBlockParameterSize(X_N_TtVecTG)[1]>;

nozzleStruct.IWork = &%<LibBlockIWork(Errors,"","",0)>;
Expand Down
6 changes: 3 additions & 3 deletions Trunk/TMATS_Library/MEX/Nozzle_TMATS_body.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void Nozzle_TMATS_body(double* y, const double* u, const NozzleStruct* prm)
PQPaMap = PQPa;

/* look up Flow Coefficient */
CdTh = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CdThArray,PQPaMap,prm->B1,&interpErr);
CdTh = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CdThArray,PQPaMap,prm->BB,&interpErr);
if (interpErr == 1 && *(prm->IWork+Er9)==0){
#ifdef MATLAB_MEX_FILE
printf("Warning in %s, Error calculating CdTh. Vector definitions may need to be expanded.\n", prm->BlkNm);
Expand Down Expand Up @@ -348,7 +348,7 @@ void Nozzle_TMATS_body(double* y, const double* u, const NozzleStruct* prm)

/* look up Thrust and velocity coefficients */
if (prm->CfgEn < 0.5){
Cv = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CvArray,PQPaMap,prm->B1,&interpErr);
Cv = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CvArray,PQPaMap,prm->BB,&interpErr);
if (interpErr == 1 && *(prm->IWork+Er15)==0){
#ifdef MATLAB_MEX_FILE
printf("Warning in %s, Error calculating Cv. Vector definitions may need to be expanded.\n", prm->BlkNm);
Expand All @@ -358,7 +358,7 @@ void Nozzle_TMATS_body(double* y, const double* u, const NozzleStruct* prm)
Cfg = 1;
}
else {
Cfg = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CfgArray,PQPaMap,prm->B1,&interpErr);
Cfg = interp1Ac(prm->X_N_PEQPaVec,prm->T_N_CfgArray,PQPaMap,prm->BB,&interpErr);
if (interpErr == 1 && *(prm->IWork+Er16)==0){
#ifdef MATLAB_MEX_FILE
printf("Warning in %s, Error calculating Cfg. Vector definitions may need to be expanded.\n", prm->BlkNm);
Expand Down
2 changes: 1 addition & 1 deletion Trunk/TMATS_Library/MEX/ValvePHY_TMATS.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static void mdlOutputs(SimStruct *S, int_T tid)
valvePHYStruct.T_V_gamma_array = mxGetPr(T_V_gamma_array_p(S));
/* Dimensions of parameter arrays */
valvePHYStruct.A1 = mxGetNumberOfElements(X_V_FAR_vec_p(S));
valvePHYStruct.B1 = mxGetNumberOfElements(Y_V_Tt_vec_p(S));
valvePHYStruct.BB = mxGetNumberOfElements(Y_V_Tt_vec_p(S));

valvePHYStruct.IWork = ssGetIWork(S);

Expand Down
2 changes: 1 addition & 1 deletion Trunk/TMATS_Library/MEX/ValvePHY_TMATS.tlc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
valvePHYStruct.Y_V_Tt_vec = (double*)(%<LibBlockParameterBaseAddr(Y_V_Tt_vec)>);
valvePHYStruct.T_V_gamma_array = (double*)(%<LibBlockParameterBaseAddr(T_V_gamma_array)>);
valvePHYStruct.A1 = %<LibBlockParameterSize(X_V_FAR_vec)[1]>;
valvePHYStruct.B1 = %<LibBlockParameterSize(Y_V_Tt_vec)[1]>;
valvePHYStruct.BB = %<LibBlockParameterSize(Y_V_Tt_vec)[1]>;

valvePHYStruct.IWork = &%<LibBlockIWork(Errors,"","",0)>;
valvePHYStruct.BlkNm = "%<LibGetFormattedBlockPath(block)>";
Expand Down
4 changes: 2 additions & 2 deletions Trunk/TMATS_Library/MEX/ValvePHY_TMATS_body.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void ValvePHY_TMATS_body(double *y, const double *u, const ValvePHYStruct* prm)
#endif
*(prm->IWork+Er2) = 1;
}
gamb = interp2Ac(prm->X_V_FAR_vec,prm->Y_V_Tt_vec,prm->T_V_gamma_array,FARcmfpIn,TtmfpIn,prm->A1,prm->B1,&interpErr);
gamb = interp2Ac(prm->X_V_FAR_vec,prm->Y_V_Tt_vec,prm->T_V_gamma_array,FARcmfpIn,TtmfpIn,prm->A1,prm->BB,&interpErr);
if (interpErr == 1 && *(prm->IWork+Er3)==0){
#ifdef MATLAB_MEX_FILE
printf("Warning in %s, Error calculating gamb. Vector definitions may need to be expanded.\n", prm->BlkNm);
Expand All @@ -62,7 +62,7 @@ void ValvePHY_TMATS_body(double *y, const double *u, const ValvePHYStruct* prm)

/* determine static pressure at the exit plane (entering fan); */
/* assume bypass flow >> bleed flow */
Pe = calc_Pstatic(PtbyIn,TtbyIn,WbyIn,prm->s_V_Ae_byp,prm->X_V_FAR_vec,prm->T_V_Rt_vec,prm->Y_V_Tt_vec,prm->T_V_gamma_array,FARcbyIn,prm->A1,prm->B1);
Pe = calc_Pstatic(PtbyIn,TtbyIn,WbyIn,prm->s_V_Ae_byp,prm->X_V_FAR_vec,prm->T_V_Rt_vec,prm->Y_V_Tt_vec,prm->T_V_gamma_array,FARcbyIn,prm->A1,prm->BB);

/* compute exit to critical area ratio */
Me = sqrtT(2*divby(gamb-1)*(powT(Pe*divby(PtmfpIn), (1-gamb)*divby(gamb))-1));
Expand Down
4 changes: 2 additions & 2 deletions Trunk/TMATS_Library/MEX/types_TMATS.H
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct NozzleStruct {
/* Dimensions of parameter arrays */
int A;
int B;
int B1;
int BB;
int C;
};
typedef struct NozzleStruct NozzleStruct;
Expand Down Expand Up @@ -265,7 +265,7 @@ struct ValvePHYStruct{

/* Dimensions of parameter arrays */
int A1;
int B1;
int BB;

};
typedef struct ValvePHYStruct ValvePHYStruct;
Expand Down
4 changes: 2 additions & 2 deletions Trunk/TMATS_Library/MEX/types_TMATS.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct NozzleStruct {
/* Dimensions of parameter arrays */
int A;
int B;
int B1;
int BB;
int C;
};
typedef struct NozzleStruct NozzleStruct;
Expand Down Expand Up @@ -265,7 +265,7 @@ struct ValvePHYStruct{

/* Dimensions of parameter arrays */
int A1;
int B1;
int BB;

};
typedef struct ValvePHYStruct ValvePHYStruct;
Expand Down
2 changes: 1 addition & 1 deletion Trunk/Uninstall_TMATS.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Uninstall_TMATS()
fid = fopen('Contents.m');
fclose(fid);
delete('Contents.m');
eval(['cd ' CurrDir]);
cd(CurrDir);
end

disp('T-MATS path removal complete.');
Expand Down

0 comments on commit 74e45e5

Please sign in to comment.