Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Commit 4f67e3d

Browse files
committed
Remove Mat file logging
add STEP_SIZE and DISCRETE definitions and remove rtmGetStepSize()
1 parent 0ad7e5e commit 4f67e3d

File tree

5 files changed

+15
-28
lines changed

5 files changed

+15
-28
lines changed

grtfmi/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ set(SOURCES
6767
${REFMODEL_SOURCES}
6868
${RTW_DIR}/fmiwrapper.inc
6969
${CMAKE_SOURCE_DIR}/fmi2Functions.c
70-
${MATLAB_ROOT}/rtw/c/src/rt_logging.c
71-
${MATLAB_ROOT}/rtw/c/src/rt_logging_mmi.c
72-
${MATLAB_ROOT}/rtw/c/src/rtw_modelmap_utils.c
7370
${CUSTOM_SOURCE}
7471
)
7572

grtfmi/fmi2Functions.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <float.h> /* for DBL_EPSILON */
12
#include "fmi2Functions.h"
23

34
#include "fmiwrapper.inc"
@@ -58,12 +59,6 @@ fmi2Component fmi2Instantiate(fmi2String instanceName,
5859

5960
#ifdef REUSABLE_FUNCTION
6061
instance->S = MODEL();
61-
62-
const char_T *errmsg = rt_StartDataLogging(rtmGetRTWLogInfo(instance->S),
63-
rtmGetTFinal(instance->S),
64-
rtmGetStepSize(instance->S),
65-
&rtmGetErrorStatus(instance->S));
66-
6762
MODEL_INITIALIZE(instance->S);
6863
#else
6964
MODEL_INITIALIZE();
@@ -121,12 +116,6 @@ fmi2Status fmi2Reset(fmi2Component c) {
121116
MODEL_TERMINATE(instance->S);
122117

123118
instance->S = MODEL();
124-
125-
const char_T *errmsg = rt_StartDataLogging(rtmGetRTWLogInfo(instance->S),
126-
rtmGetTFinal(instance->S),
127-
rtmGetStepSize(instance->S),
128-
&rtmGetErrorStatus(instance->S));
129-
130119
MODEL_INITIALIZE(instance->S);
131120
#else
132121
MODEL_TERMINATE();
@@ -365,17 +354,21 @@ fmi2Status fmi2DoStep(fmi2Component c,
365354

366355
ModelInstance *instance = (ModelInstance *)c;
367356

357+
#ifndef DISCRETE
368358
time_T tNext = currentCommunicationPoint + communicationStepSize;
369359

370-
while (rtmGetT(instance->S) + rtmGetStepSize(instance->S) < tNext + DBL_EPSILON) {
360+
while (rtmGetT(instance->S) + STEP_SIZE < tNext + DBL_EPSILON) {
361+
#endif
371362
MODEL_STEP(instance->S);
372363
const char *errorStatus = rtmGetErrorStatus(instance->S);
373364
if (errorStatus) {
374365
instance->logger(instance->componentEnvironment, instance->instanceName, fmi2Error, "error", errorStatus);
375366
return fmi2Error;
376367
}
368+
#ifndef DISCRETE
377369
}
378-
370+
#endif
371+
379372
return fmi2OK;
380373
}
381374

grtfmi/grtfmi_make_rtw_hook.m

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
function grtfmi_make_rtw_hook(hookMethod, modelName, rtwRoot, templateMakefile, buildOpts, buildArgs, buildInfo)
22

33
switch hookMethod
4-
5-
case 'entry'
6-
7-
stop_time = get_param(modelName, 'StopTime');
8-
stop_time = str2double(stop_time);
9-
10-
if isfinite(stop_time)
11-
warning(['The model has a finite stop time and cannot be simulated beyond that time. ' ...
12-
'Set inf as stop time for arbitrary simulation times.']);
13-
end
144

155
case 'after_make'
166

grtfmi/grtfmi_selectcallback.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ function grtfmi_selectcallback(hDlg, hSrc)
99
slConfigUISetVal(hDlg, hSrc, 'CodeInterfacePackaging', 'Reusable function');
1010
end
1111

12+
% disable Mat file logging
13+
slConfigUISetVal(hDlg, hSrc, 'MatFileLogging', 'off');
14+
slConfigUISetEnabled(hDlg, hSrc, 'MatFileLogging', false);
15+
1216
% declare model reference compliance
1317
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
1418
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);

grtfmi/grtfmixml.tlc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
#define MODEL_STEP %<OrigName>_step
6868
#define MODEL_TERMINATE %<OrigName>_terminate
6969
#define RT_MDL_TYPE %<tSimStructType>
70+
#define STEP_SIZE %<FixedStepOpts.FixedStep>
71+
%if Solver == "FixedStepDiscrete"
72+
#define DISCRETE
73+
%endif
7074

7175
/* R2019a defines the block parameters as extern */
7276
#ifndef rtmGetDefaultParam
@@ -80,7 +84,6 @@
8084
#define RT_MDL_INSTANCE %<tSimStruct>
8185
#define rtmGetU(S) (&%<tInput>)
8286
#define rtmGetY(S) (&%<tOutput>)
83-
#define rtmGetStepSize(rtm) (rtm->Timing.stepSize0)
8487
%endif
8588

8689
void *getScalarVariable(RT_MDL_TYPE *S, int vr, BuiltInDTypeId *dtypeID) {

0 commit comments

Comments
 (0)