Skip to content

Commit a9ed964

Browse files
committed
TLC file cleanup v1.1.3.41
fixed bug: updated blocks to clear memory after malloc command fixed bug: updated SP2T TLC file to contain 3 inputs fixed bug: updated ValvePhy to input doubles fixed bug: updated staticcalc to include the sp2t defition within the S-function block in simulink.
1 parent efdd78e commit a9ed964

15 files changed

+30
-17
lines changed

Trunk/Install_TMATS.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ function Install_TMATS()
33

44
% TMATSver and date must remain in the listed form for the ver command to work
55
% properly.
6-
TMATSver = '1.1.3.40';
7-
TMATSdate = 'Sept-19-2017';
6+
TMATSver = '1.1.3.41';
7+
TMATSdate = 'Sept-26-2017';
88

99
error = 0;
1010
TMATSInstallmsg = 'Install T-MATS matlab toolbox? Note: Installation will add MATLAB paths and generate MEX files.';
-1.21 KB
Binary file not shown.

Trunk/TMATS_Library/MEX/Ambient_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
124124

125125
/* Get name of block from dialog parameter (string) */
126126
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
127-
ambientStruct.BlkNm = mxMalloc(buflen);
127+
ambientStruct.BlkNm = malloc(buflen);
128128
status = mxGetString(BN_p(S), ambientStruct.BlkNm, buflen);
129129

130130
/* Perform core block calculations */
131131
Ambient_TMATS_body(y, u, &ambientStruct);
132+
free(ambientStruct.BlkNm);
132133
}
133134

134135
static void mdlTerminate(SimStruct *S)

Trunk/TMATS_Library/MEX/Bleed_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
117117

118118
/* Get name of block from dialog parameter (string) */
119119
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
120-
bleedStruct.BlkNm = mxMalloc(buflen);
120+
bleedStruct.BlkNm = malloc(buflen);
121121
status = mxGetString(BN_p(S), bleedStruct.BlkNm, buflen);
122122

123123
/* Perform core block calculations */
124124
Bleed_TMATS_body(y, y1, u, BldInFlow, &bleedStruct);
125+
free(bleedStruct.BlkNm);
125126
}
126127

127128
static void mdlTerminate(SimStruct *S)

Trunk/TMATS_Library/MEX/Compressor_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
199199

200200
/* Get name of block from dialog parameter (string) */
201201
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
202-
compressorStruct.BlkNm = mxMalloc(buflen);
202+
compressorStruct.BlkNm = malloc(buflen);
203203
status = mxGetString(BN_p(S), compressorStruct.BlkNm, buflen);
204204

205205
/* Perform core block calculations */
206206
Compressor_TMATS_body(y, y1, y2, u, Wcust, FracWbld, &compressorStruct);
207+
free(compressorStruct.BlkNm);
207208
}
208209

209210
static void mdlTerminate(SimStruct *S)

Trunk/TMATS_Library/MEX/DO_TMATS.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static void mdlOutputs(SimStruct *S, int_T tid)
7777

7878
/* Get File Name from dialog parameter (string) */
7979
buflen = mxGetN(FN_p(S))*sizeof(mxChar)+1;
80-
FileNm = mxMalloc(buflen);
80+
FileNm = malloc(buflen);
8181
status = mxGetString(FN_p(S), FileNm, buflen);
8282

8383

@@ -95,6 +95,7 @@ static void mdlOutputs(SimStruct *S, int_T tid)
9595
}
9696

9797
fclose(fp);
98+
free(FileNm);
9899
}
99100

100101
static void mdlTerminate(SimStruct *S)
@@ -118,14 +119,15 @@ static void mdlRTW(SimStruct *S)
118119

119120
/* Get File Name from dialog parameter (string) */
120121
buflen = mxGetN(ssGetSFcnParam(S,0))*sizeof(mxChar)+1;
121-
FileNm = mxMalloc(buflen);
122+
FileNm = malloc(buflen);
122123
if (!FileNm) {
123124
ssSetErrorStatus(S,"Memory allocation error in mdlRTW");
124125
return;
125126
}
126127

127128
status = mxGetString(FN_p(S), FileNm, buflen);
128129
ssWriteRTWParamSettings(S, 1, SSWRITE_VALUE_STR, "FileNm", FileNm, buflen);
130+
free(FileNm);
129131
}
130132
#endif /* MDL_RTW */
131133

Trunk/TMATS_Library/MEX/Mixer_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
205205

206206
/* Get name of block from dialog parameter (string) */
207207
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
208-
mixerStruct.BlkNm = mxMalloc(buflen);
208+
mixerStruct.BlkNm = malloc(buflen);
209209
status = mxGetString(BN_p(S), mixerStruct.BlkNm, buflen);
210210

211211
/* Perform core block calculations */
212212
Mixer_TMATS_body(y, u, &mixerStruct);
213+
free(mixerStruct.BlkNm);
213214
}
214215

215216
static void mdlTerminate(SimStruct *S)

Trunk/TMATS_Library/MEX/Nozzle_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
157157

158158
/* Get name of block from dialog parameter (string) */
159159
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
160-
nozzleStruct.BlkNm = mxMalloc(buflen);
160+
nozzleStruct.BlkNm = malloc(buflen);
161161
status = mxGetString(BN_p(S), nozzleStruct.BlkNm, buflen);
162162

163163
/* Perform core block calculations */
164164
Nozzle_TMATS_body(y, u, &nozzleStruct);
165+
free(nozzleStruct.BlkNm);
165166
}
166167

167168
static void mdlTerminate(SimStruct *S)

Trunk/TMATS_Library/MEX/SP2T_TMATS.tlc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
%<SLibAddToStaticSources("sp2tc_TMATS.c")>
1818

1919
%openfile forwardDecls
20-
extern double sp2tc(double, double);
20+
extern double sp2tc(double, double, double);
2121
%closefile forwardDecls
2222

2323
%assign srcFile = LibGetModelDotCFile()
@@ -40,8 +40,9 @@
4040

4141
%assign in1 = LibBlockInputSignal(0, "", "", 0)
4242
%assign in2 = LibBlockInputSignal(0, "", "", 1)
43+
%assign in3 = LibBlockInputSignal(0, "", "", 2)
4344

44-
%<out> = sp2tc(%<in1>, %<in2>);
45+
%<out> = sp2tc(%<in1>, %<in2>, %<in3>);
4546
%%
4647
%endfunction
4748

Trunk/TMATS_Library/MEX/StaticCalc_TMATS.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,12 @@ static void mdlOutputs(SimStruct *S, int_T tid)
122122

123123
/* Get name of block from dialog parameter (string) */
124124
buflen = mxGetN(BN_p(S))*sizeof(mxChar)+1;
125-
staticCalcStruct.BlkNm = mxMalloc(buflen);
125+
staticCalcStruct.BlkNm = malloc(buflen);
126126
status = mxGetString(BN_p(S), staticCalcStruct.BlkNm, buflen);
127127

128128
/* Perform core block calculations */
129129
StaticCalc_TMATS_body(y, u, &staticCalcStruct);
130+
free(staticCalcStruct.BlkNm);
130131
}
131132

132133
static void mdlTerminate(SimStruct *S)

0 commit comments

Comments
 (0)