%%
%%
%%
%%
%%Copyright1994-2017TheMathWorks,Inc.
%%
%%Abstract:
%%Librarythatholdsthefunctionswhichdetermineifcertain
%%rtModelfieldsarerequiredforagivenmodel
%%
 
%if EXISTS("_RTMISREQFCNS_") == 0
%assign _RTMISREQFCNS_ = 1
 
%%Function:RTMAlwaysReqIsReqFcn==============================================
%%Abstract:
%%This"isRequired"functionisusedforrtModelfieldsthatarealways
%%required.
%%
%function RTMAlwaysReqIsReqFcn() void
  %return TLC_TRUE
%endfunction %% RTMAlwaysReqIsReqFcn
 
%%Function:RTMCGTypeReqIsReqFcn==============================================
%%Abstract:
%%This"isRequired"functionalwaysreturnsfalseitismeanttoactasa
%%recordplaceholdertokeeptheRTM'scgTypefieldsconsistentwiththeTLC
%%record
%%
%function RTMNeverReqIsReqFcn() void
  %return TLC_FALSE
%endfunction
 
%%Function:RTMModelPtrsForNonERTIsReqFcn=========================================
%%Abstract:
%%This"isRequired"functioniscalledforvariousrtModelfieldstofigureout
%%iftheyarerequired.Inparticular,thisisusedforahandfuloffields
%%thatareonlyneededinnon-ERTformat.
%%
%function RTMModelPtrsForNonERTIsReqFcn() void
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper
    %return TLC_TRUE
  %else
    %return TLC_FALSE
  %endif
%endfunction %% RTMModelPtrsForNonERTIsReqFcn
 
 
%%Function:RTMModelPtrsToInstanceDataIsReqFcn=====================================
%%Abstract:
%%This"isRequired"functioniscalledforvariousrtModelfields
%%tofigureoutiftheyarerequired.Inparticular,itisusedfor
%%fieldsthatarepointerstoper-instancedata.Specifically:
%%DWork,BlockIO,ConstBlockIO,DefaultParam,PrevZCSigState,
%%ZCSignalValues,ExternalInputs,ExternalOutputs,xpcData
%%Thesepointersarerequiredtosupportmultipleinstancesofthemodel,
%%inparticularinthecasewhereafunctionisonlypasseda
%%pointertotheRT_MODEL(forthisinstance)anditneedsto
%%getattherightinstanceofoneoftheabovestructs.
%%
%function RTMModelPtrsToInstanceDataIsReqFcn() void
  %if RTMModelPtrsToSharedDataIsReqFcn()
    %return TLC_TRUE
  %elseif ::GenerateClassInterface
    %% For C++ Encapsulation, which must be ERT format,
    %% we don't support the Cross flag and hence never need
    %% these extra RT_MODEL fields
    %return TLC_FALSE
  %else
    %% Otherwise, we return true if the model is reusable but there
    %% are non-reusable subsystems. The CrossNoArgFcnBound flag
    %% is what indicates this, and the AnyCross global indicates
    %% whether we've seen that flag for any subsystem.
    %return ::AnyCross
  %endif
%endfunction %% RTMModelPtrsToInstanceDataIsReqFcn
 
%%Function:RTMModelPtrsToSharedDataIsReqFcn=====================================
%%Abstract:
%%This"isRequired"functioniscalledforvariousrtModelfields
%%tofigureoutiftheyarerequired.Inparticular,itisusedfor
%%fieldsthatarepointerstoshareddata.Specifically:
%%DefaultParam
%%Thesepointersarerequiredtosupportmultipleinstancesofthemodel,
%%inparticularinthecasewhereafunctionisonlypasseda
%%pointertotheRT_MODEL(forthisinstance)anditneedsto
%%getattherightinstanceofoneoftheabovestructs.
%%
%function RTMModelPtrsToSharedDataIsReqFcn() void
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper
    %% Non-ERT formats expect to get BlockIO, DWork, etc, through
    %% the RTModel, so we return true for these.
    %return TLC_TRUE
  %else
    %% Otherwise, we return false
    %return TLC_FALSE
  %endif
%endfunction %% RTMModelPtrsToInstanceDataIsReqFcn
 
%function AccessDataUseRTM(sysIdx, fcnType,cross)
  %if sysIdx != (NumSystems-1) && LibSystemIsReusedFcn(System[sysIdx])
    %return TLC_FALSE
  %elseif ::CompiledModel.HasSimStructVars
    %return TLC_TRUE
  %elseif GenerateClassInterface
    %return TLC_FALSE
  %elseif isGRTMallocOnERT()
    %return cross || sysIdx != (NumSystems-1)
  %else
    %return (cross && MultiInstanceERTCode )
  %endif
%endfunction
 
%%Function:RTMContTimeErtIsReqFcn============================================
%%Abstract:
%%Returnstrueif
%%-non-ERTtarget
%%OR
%%-ERTandthereisacontinuousTIDandnotmodelrefsimtarget
%%
%function RTMContTimeErtIsReqFcn() void
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper
    %return TLC_TRUE
  %else
    %if LibIsContinuous(0) && !IsModelReferenceForASimstructBasedTarget()
      %return TLC_TRUE
    %else
      %return TLC_FALSE
    %endif
  %endif
%endfunction %% RTMContTimeErtIsReqFcn
 
%%Function:RTMContStateErtNoMdlRefIsReqFcn========================================
%%Abstract:
%%Returnstrueif
%%-non-ERTtarget
%%OR
%%-ERTwithcontinuousstatesandnotamodelreftarget.
%%
%function RTMContStateErtNoMdlRefIsReqFcn() void
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper
    %return TLC_TRUE
  %else
    %if NumContStates > 0 && !IsModelReferenceTarget()
      %return TLC_TRUE
    %else
      %return TLC_FALSE
    %endif
  %endif
%endfunction %% RTMContStateErtNoMdlRefIsReqFcn
 
 
%%Function:RTMChildSfunctionIsReqFcn=========================================
%%Abstract:
%%This"isRequired"functionisusedforthe'ChildSfunction'field
%%
%function RTMChildSfunctionIsReqFcn() void
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper
    %return TLC_TRUE
  %else
    %if RTMNonInlinedSFcnsIsReqFcn()
      %return TLC_TRUE
    %else
      %return TLC_FALSE
    %endif
  %endif
%endfunction %% RTMChildSfunctionIsReqFcn
 
%function RTMTimingBridgeIsInstanceBased() void
  %return IsModelReferenceTarget() && ::CompiledModel.OkToMultiInstanceModelref
%endfunction
 
 
%%Function:RTMTimingBridgeIsReqFcn=========================================
%%Abstract:
%%This"isRequired"functionisusedforthe'TimingBridge'field
%%
%function RTMTimingBridgeIsReqFcn() void
  %return RTMTimingBridgeIsInstanceBased() && ::tMdlRefTimingBridgeAccessed || ...
          (!IsModelReferenceTarget() && MultiInstanceERTCode && ::tMdlRefTimingBridgeAccessed)
%endfunction %% RTMTimingBridgeIsReqFcn
 
%%Function:RTMNonInlinedSFcnsIsReqFcn=========================================
%%Abstract:
%%This"isRequired"functionisusedforthe'NonInlinedSFcns'field.
%%Usedforeitherthetopmodelinahieararchythatcontainsnon-inlined
%%s-functions,orforanymodelthatdirectlycontainsnon-inlineds-functions.
%%
%function RTMNonInlinedSFcnsIsReqFcn() void
  %if ::CompiledModel.NumChildSFunctions > 0 || ...
    (::CompiledModel.ModelBlocksHaveNonInlinedSfcns && !IsModelReferenceTarget())
    %return TLC_TRUE
  %else
    %return TLC_FALSE
  %endif
%endfunction %% RTMNonInlinedSFcnsIsReqFcn
 
 
%%Function:RTMSolverYIsReqFcn================================================
%%Abstract:
%%This"isRequired"functionisusedforthe'Y'field(ERTContinuous)
%%
%function RTMSolverYIsReqFcn() void
  %if !SLibIsERTCodeFormat()
    %% return false for now
    %return TLC_FALSE
  %else
    %if (NumContStates > 0) && (::CompiledModel.solverOrder > 1) && !IsModelReferenceTarget()
      %return TLC_TRUE
    %else
      %return TLC_FALSE
    %endif
  %endif
%endfunction %% RTMSolverYIsReqFcn
 
 
%%Function:RTMContainerErtIsReqFcn===========================================
%%Abstract:
%%ThisfunctioniscalledforvariousrtModelfieldstofigureout
%%iftheyarerequired.Thisfunctionisforobjectsthatwewanttostore
%%intheRT_Model.Fornow,thisisintegrationdata,butinthefuturemay
%%beBlockI/O,Parameters,etc.ThiscurrentlyisERT-onlyfields,as
%%ERTandGRTunify,the{RTMContainerErtIsReqFcn,RTMContainerGrtIsReqFcn}
%%functionswillcollapseintoone.
%%
%function RTMContainerErtIsReqFcn() void
  %if !SLibIsERTCodeFormat()
    %return TLC_FALSE
  %else
    %if NumContStates > 0 && !IsModelReferenceTarget()
      %return TLC_TRUE
    %else
      %return TLC_FALSE
    %endif
  %endif
%endfunction %% RTMContainerErtIsReqFcn
 
%%Function:RTMContTimeErtOnlyIsReqFcn========================================
%%Abstract:
%%ThiscanonlybeusedforEmbedded-Ccodeformats.Itreturnstrueif
%%thereisacontinuoustidunlessit'samodelrefsimtarget.
%%
%function RTMContTimeErtOnlyIsReqFcn() void
  %assert SLibIsERTCodeFormat()
  %if LibIsContinuous(0) && !IsModelReferenceForASimstructBasedTarget()
    %return TLC_TRUE
  %else
    %return TLC_FALSE
  %endif
%endfunction %% RTMContTimeErtOnlyIsReqFcn
 
%%Function:RTMErrorStatusIsReqFcn============================================
%%Abstract:
%%This"isRequired"functionisusedfortheerrorstatusfield
%%
%function RTMErrorStatusIsReqFcn() void
  %return (::CompiledModel.SuppressErrorStatus==1) ? TLC_FALSE : TLC_TRUE
%endfunction %% RTMErrorStatusIsReqFcn
 
 
%%Function:RTMErrorStatusNeedVolatile============================================
%%Abstract:
%%ReturnstrueifErrorStatusneedbevolatiletopreventaggressivecompiler
%%optimization.
%%
%function RTMErrorStatusNeedVolatile() void
   
  %if !EXISTS("ErrorStatusPtrAccess")
    %assign ::ErrorStatusPtrAccess = 0
  %endif
   
  %assign retVal = ::ErrorStatusPtrAccess == 0 && ...
    ConfigSet.IsERTTarget && ...
    !IsModelReferenceTarget() && ...
    GenerateSampleERTMain && ...
    ((TargetOS == "BareBoardExample") || (TargetOS == "NativeThreadsExample")) && ...
    ::CompiledModel.NumContStates == 0 && !MatFileLogging && !ExtMode && !EXISTS("ForceSimulatedRTOneStep") %% Not running OneStep
   
   
  %% check is ErrorStatus is used by any child model.
  %% If it used by child mdl, no need to add
  %% volatile, compiler will not optimize it out.
  %%
  %% Note:, synce MdlRef doesn't track usage of ErrorStatusPtr
  %% we can't rely on tracking information.
  %%
  %% ToDo: Consider centralize all ErrorStatusPtr access so that
  %% we can centralize the tracking code.
  %if retVal
    %assign mdlRefBlks = ISFIELD(::CompiledModel,"ModelReferenceBlocks") ? ...
      ::CompiledModel.ModelReferenceBlocks : []
     
    %if !ISEMPTY(mdlRefBlks)
      %foreach rowIdx = SIZE(mdlRefBlks,0)
        %assign mdlRefInfo = mdlRefBlks[rowIdx]
        %assign mSysIdx = mdlRefInfo[0]
        %assign bIdx = mdlRefInfo[1]
        %assign blk = ::CompiledModel.System[mSysIdx].Block[bIdx]
        
        %assert 0 == blk.DeletedInIR
         
        %assign blockInterface = GetModelrefInterface(blk)
        %if blockInterface.NeedsErrorStatus
          %assign retVal = TLC_FALSE
          %break
        %endif
      %endforeach
    %endif
  %endif
   
  %return retVal
%endfunction %% RTMErrorStatusNeedVolatile
 
%%Function:RTMMdlMthIsReqFcn=================================================
%%Abstract:
%%ThisfunctioniscalledforvariousrtModelmodelmethodfieldstofigure
%%outiftheyarerequired.
%%
%function RTMMdlMthIsReqFcn() void
  %if UsingMalloc && GenerateGRTWrapper
    %return TLC_TRUE
  %else
    %return TLC_FALSE
  %endif
%endfunction %% RTMMdlMthIsReqFcn
 
 
%%Function:RTMMdlStopReqIsReqFcn=============================================
%%Abstract:
%%ThisfunctioniscalledtodetermineifthestopRequestedfieldisneeded
%%
%function RTMMdlStopReqIsReqFcn() void
  %if IsModelReferenceForASimstructBasedTarget()
    %return TLC_FALSE
  %endif
  %assign retVal = TLC_FALSE %% assume
  %if CodeFormat == "Embedded-C" && !GenerateGRTWrapper
    %if ((EXISTS("slrealtime") && slrealtime == 1) || ExtMode || ...
          MatFileLogging || RTMStopReqAccessed())
      %assign retVal = TLC_TRUE
    %endif
  %else
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
%endfunction %% RTMMdlStopReqIsReqFcn
 
%%Function:RTMNumSampleTimesReqFcn===========================
%%
%%
%function RTMNumSampleTimesReqFcn() void
  %return RTMContStateErtNoMdlRefIsReqFcn() || ...
    RTMChildSfunctionIsReqFcn() || ...
    (GenerateGRTWrapper && ExtMode)
%endfunction %% RTMNumSampleTimesReqFcn
     
%%Function:RTMStepSizeIsReqFcn===============================================
%%Abstract:
%%IstheStepSizefieldrequired?
%%
%function RTMStepSizeIsReqFcn() void
  %assign retVal = TLC_FALSE %% assume
  %if !SLibIsERTCodeFormat() || GenerateGRTWrapper || ...
      (MatFileLogging && UsingMalloc && !GenerateSampleERTMain)
    %assign retVal = TLC_TRUE
  %endif
  %return retVal
%endfunction %% RTMStepSizeIsReqFcn
 
 
%%Function:RTMStepSizeForTIDIsReqFcn==================================
%%Abstract:
%%IstheStepSize%<tid>fieldrequired?
%%
%function RTMStepSizeForTIDIsReqFcn(tid) void
  %if IsModelReferenceForASimstructBasedTarget() && (LibIsContinuous(tid) || ...
    (::CompiledModel.SolverType == "VariableStep" && LibIsZOHContinuous(tid)))
    %return TLC_FALSE
  %endif
  %if !SLibIsERTCodeFormat()
    %return TLC_FALSE
  %else
    %return SampleTime[tid].NeedFloatTime == "yes" ...
      && !PurelyIntegerCode
  %endif
%endfunction %% RTMStepSizeForTIDIsReqFcn
 
%%Function:RTMIsVarStepSolver==========================================
%%Abstract:
%%Isthesolvervariablestep?
%%
%function RTMIsVarStepSolver() void
  %return ::CompiledModel.SolverType == "VariableStep"
%endfunction %% RTMIsVarStepSolver
 
%%Function:RTMNeedsNonContDerivSigs==========================================
%%Abstract:
%%Doesthemodelneedtotracknoncontinuousderivsignals?
%%
%function RTMNeedsNonContDerivSigs() void
  %return RTMIsVarStepSolver() && ...
    IsModelReferenceForASimstructBasedTarget() && ...
    SolverResetInfo.NumNonContDerivSignals > 0
%endfunction %% RTMNeedsNonContDerivSigs
 
%%Function:ClockTickForTIDIsReqFcn=====================================
%%Abstract:
%%IstheClockTick%<tid>fieldrequiredinthertModel?
%%
%function ClockTickForTIDIsReqFcn(tid) void
  %assign retVal = TLC_FALSE %% assume
   
  %if IsModelReferenceForASimstructBasedTarget() && (LibIsContinuous(tid) || ...
    (::CompiledModel.SolverType == "VariableStep" && LibIsZOHContinuous(tid)))
    %assign retVal = TLC_FALSE
  %elseif ((SLibIsERTCodeFormat()) && (SLibNeedAbsoluteTimeForTID(tid))) || ...
    ((tid < NumSynchronousSampleTimes) && ...
    ::CompiledModel.ModelBlocksReqClockTicks[tid])
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
 
%endfunction %% ClockTickForTIDIsReqFcn
 
%%Function:LongClockTickForTIDIsReqFcn======================================
%%Abstract:
%%IstheClockTickH%<tid>fieldrequiredinthertModel?
%%
%function LongClockTickForTIDIsReqFcn(tid) void
  %assign retVal = TLC_FALSE %% assume
   
  %if ((SLibIsERTCodeFormat()) && (SLibNeedAbsoluteTimeForTID(tid))...
    && SLibClockTickIsUnit32Pair(tid)) || ...
    ((tid < NumSynchronousSampleTimes) && ...
      ::CompiledModel.ModelBlocksReqLongClockTicks[tid])
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
%endfunction %% LongClockTickForTIDIsReqFcn
 
 
%function RTMAbsTimeNeedTransProtection(tid)
  %return SLibIsERTCodeFormat() && ...
    ::CompiledModel.SampleTime[tid].Asynchronous == "yes" && ...
    SLibNeedAbsoluteTimeForTID(tid) && ...
    ::CompiledModel.SampleTime[tid].TimeSource == "BaseRate" && ...
    !::CompiledModel.SampleTime[tid].ClockTickDataTypeAtomic
 
%endfunction
 
 
%%Function:RTMAbsTimeNeedH2LTrans========================
%%Abstract:
%%ReturntrueifEmbedded-Candthistidis
%%1.asynchronoustid,and
%%2.needabsolutetime,and
%%3.dosenotmanageowntimer,needuse
%%timeroffundamentalrate,and
%%4.haslowerprioritythanfundamentalrate.
%%
%%Whenallofabovearetrue,Absolutetimeofbaserate
%%willbereadbyasynctaskthathaslowerpriority.
%%TimedataneedtrasnferfromHighprioritytask(baserate)
%%tolowprioritytask(asyncrate)
%function RTMAbsTimeNeedH2LTrans(tid)
  %assign retVal = TLC_FALSE %% assume
   
  %if RTMAbsTimeNeedTransProtection(tid) && ...
    SLibComparePriority(tid, 0) == 2
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
%endfunction %% RTMAbsTimeNeedH2LTrans
 
 
%%Function:RTMAbsTimeNeedNoPriorityTrans========================
%%Abstract:
%%ReturntrueifEmbedded-Candthistidis
%%1.asynchronoustid,and
%%2.needabsolutetime,and
%%3.dosenotmanageowntimer,needuse
%%timeroffundamentalrate,and
%%4.noprioirityisassigned
%%
%function RTMAbsTimeNeedNoPriorityTrans(tid)
  %assign retVal = TLC_FALSE %% assume
   
  %if RTMAbsTimeNeedTransProtection(tid) && ...
    SLibComparePriority(tid, 0) == -1
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
%endfunction %% RTMAbsTimeNeedH2LTrans
 
 
%%Function:RTMClockTick0H2LIsReqFcn(tid)======================
%%Returntrueifthereisthelowprioritytasksneedread
%%timefrombaseratetask,andClockTikcDataTypeIdofthis
%%taskisnottSS_DOUBLE
%%
%function RTMClockTick0H2LIsReqFcn(tid)
  %assign retVal = RTMAbsTimeNeedH2LTrans(tid) && ...
    ::CompiledModel.SampleTime[tid].ClockTickDataTypeId != tSS_DOUBLE
 
  %return retVal
%endfunction %%RTMClockTick0H2LIsReqFcn()
 
 
%%Function:RTMContTH2LIsReqFcn(tid)=======================
%%Returntrueifthereisthelowprioritytasksneedread
%%timefrombaseratetask,andClockTikcDataTypeIdofthis
%%taskistSS_DOUBLE
%%
%function RTMContTH2LIsReqFcn(tid)
  %assign retVal = RTMAbsTimeNeedH2LTrans(tid) && ...
        !SLibConcurrentTasks() && ...
        ::CompiledModel.SampleTime[tid].ClockTickDataTypeId == tSS_DOUBLE
   
  %return retVal
%endfunction %%RTMContTH2LIsReqFcn()
 
 
%%Function:RTMClockTick0DbBufIsReqFcn(tid)======================
%%
%function RTMClockTick0DbBufIsReqFcn(tid)
  %assign retVal = RTMAbsTimeNeedNoPriorityTrans(tid) && ...
    ::CompiledModel.SampleTime[tid].ClockTickDataTypeId != tSS_DOUBLE
 
  %return retVal
%endfunction %%RTMClockTick0DbBufIsReqFcn()
 
 
%%Function:RTMContTDbBufIsReqFcn(tid)=======================
%%
%function RTMContTDbBufIsReqFcn(tid)
  %assign retVal = RTMAbsTimeNeedNoPriorityTrans(tid) && ...
        !SLibConcurrentTasks() && ...
      ::CompiledModel.SampleTime[tid].ClockTickDataTypeId == tSS_DOUBLE
   
  %return retVal
%endfunction %%RTMContTDbBufIsReqFcn()
 
%%Function:RTMAbsTimeNeedL2HTrans========================
%%Abstract:
%%ReturntrueifEmbedded-Candthistidis
%%1.asynchronoustid,and
%%2.needabsolutetime,and
%%3.dosenotmanageowntimer,needuse
%%timeroffundamentalrate,and
%%4.hashigherprioritythanfundamentalrate.
%%
%%Whenallofabovearetrue,Absolutetimeofbaserate
%%willbereadbyasynctaskthathashigherpriority.
%%Timedataneedtrasnferfromlowprioritytask(baserate)
%%tohighprioritytask(asyncrate)
%function RTMAbsTimeNeedL2HTrans(tid)
  %assign retVal = TLC_FALSE %% assume
   
  %if RTMAbsTimeNeedTransProtection(tid) && ...
    !SLibConcurrentTasks() && ...
    SLibComparePriority(tid, 0) == 1
    %assign retVal = TLC_TRUE
  %endif
   
  %return retVal
%endfunction %% RTMAbsTimeNeedL2HTrans
 
%%Function:RTMClockTick0L2HIsReqFcn()======================
%%Returntrueifthereisanyhigherprioritytasksneedread
%%timefrombaseratetask,andClockTikcDataTypeIdofthis
%%taskisthesameasClockTick0
%%
%function RTMClockTick0L2HIsReqFcn()
  %assign retVal = TLC_FALSE %% assume
   
  %foreach tid = NumSampleTimes
    %if RTMAbsTimeNeedL2HTrans(tid) && ...
      ::CompiledModel.SampleTime[tid].ClockTickDataTypeId != tSS_DOUBLE
      %assign retVal = TLC_TRUE
      %break
    %endif
  %endforeach
 
  %return retVal
%endfunction %%RTMClockTick0L2HIsReqFcn
 
%%Function:RTMContTL2HIsReqFcn()=======================
%%Returntrueifthereisanyhighprioritytasksneedread
%%timefrombaseratetask,andClockTikcDataTypeIdofthis
%%taskistSS_DOUBLE
%%
%function RTMContTL2HIsReqFcn()
  %assign retVal = TLC_FALSE %% assume
   
  %foreach tid = NumSampleTimes
    %if RTMAbsTimeNeedL2HTrans(tid) && ...
      ::CompiledModel.SampleTime[tid].ClockTickDataTypeId == tSS_DOUBLE
      %assign retVal = TLC_TRUE
      %break
    %endif
  %endforeach
       
  %return retVal
%endfunction %%RTMContTL2HIsReqFcn()
 
 
%%Function:RTMTaskTimeIsReqFcnForTID()===============================
%%Abstract:
%%IstheTaskTimeForTID#fieldrequired?
%%
%function RTMTaskTimeIsReqFcnForTID(tid) void
  %assert !IsModelReferenceTarget()
  %assign retVal = TLC_FALSE %% assume
  %if SLibIsERTCodeFormat()
    %if SampleTime[tid].NeedFloatTime == "yes"
      %assign retVal = !RTMTimePtrIsReqFcn()
    %endif
  %endif
   
  %return retVal
%endfunction %% RTMTaskTimeIsReqFcnForTID
 
 
%%Function:RTMTFinalIsReqFcn==============================================
%%Abstract:
%%IstheTFinalfieldrequired?
%%
%function RTMTFinalIsReqFcn() void
  %return (RTMTUseStopTimeAsTFinal() || (NumChildSFunctions > 0))
 
%endfunction %% RTMTFinalIsReqFcn
 
%%Function:RTMTUseStopTimeAsTFinal=======================
%%Abstract:
%%IstheTFinalfieldhonorsstoptime.
%%ThelogicisSimilarwithRTMTFinalIsReqFcn,exceptthat
%%non-inlinedsfcnfunctionwon'tforcehonoringstoptime
%%
%function RTMTUseStopTimeAsTFinal() void
  %assign retVal = TLC_FALSE
   
  %if !IsModelReferenceTarget()
    %if SLibIsERTCodeFormat()
      %assign retVal = GenerateGRTWrapper || ...
        MatFileLogging || (ExtMode && !PurelyIntegerCode)
    %else
      %assign retVal = TLC_TRUE
    %endif
  %endif
  %return retVal
%endfunction %% RTMTUseStopTimeAsTFinal
   
%%Function:RTMFirstInitCondFlagIsReqFcn======================================
%%Abstract:
%%IstheFirstInitCondFlagfieldrequired?
%%
%function RTMFirstInitCondFlagIsReqFcn() void
  %if IsModelReferenceTarget() || (UsingMalloc && GenerateGRTWrapper)
    %return TLC_FALSE
  %endif
   
  %assign retVal = TLC_FALSE %% assume
  %if (SLibIsERTCodeFormat())
     %if SLibGetIsFirstInitCondAccessed()
      %assign retVal = TLC_TRUE
    %endif
  %endif
   
  %return retVal
%endfunction %% RTMFirstInitCondFlagIsReqFcn
 
 
%%Function:RTMTaskCountersIsReqFcn===========================================
%%Abstract:
%%AresomeofthemultirateERTtimingfieldsrequired?
%%
%function RTMTaskCountersIsReqFcn() void
  %if IsModelReferenceTarget() || SLibIsExportFcnDiagram()
    %return TLC_FALSE
  %endif
  %assign retVal = TLC_FALSE %% assume
  
  %if SLibIsERTCodeFormat() && ...
    (LibIsDeploymentDiagram() || ...
     (!LibIsDeploymentDiagram() && (LibNumDiscreteSampleTimes() > 1 || ::CompiledModel.NumControllableSampleTimes > 0 || ::CompiledModel.NumSynchronousSampleTimes < ::CompiledModel.NumRuntimeExportedRates)))
     %assign retVal = !::CompiledModel.SuppressMultiTaskScheduler || ...
       !(InlineSetEventsForThisBaseRateFcn || SuppressSetEventsForThisBaseRateFcn) || ...
       (!GenerateSampleERTMain && !SLibAutosarActive()) || ...
       GenerateGRTWrapper || SLibConcurrentTasks() || ...
       ::CompiledModel.NumControllableSampleTimes > 0
  %endif
 
  %return retVal
%endfunction %% RTMERTMultiRateIsReqFcn
 
%%Function:RTMCtrlRateMdlRefTimingIsReqFcn===========================================
%%Abstract:
%%IsCtrlRateMdlRefTimingrequired?
%%
%function RTMCtrlRateMdlRefTimingIsReqFcn() void
  %assign retVal = TLC_FALSE %% assume
  %if !IsModelReferenceTarget() && ...
      SLibIsERTCodeFormat() && ...
      !LibIsDeploymentDiagram()
      %assign retVal = (::CompiledModel.ContainsModelBlockWithCtrlRate == "yes")
  %endif
  %return retVal
%endfunction %% RTMCtrlRateMdlRefTimingIsReqFcn
 
%%Function:RTMCtrlRateMdlRefTimingIsReqFcn===========================================
%%Abstract:
%%IsthepointertoCtrlRateMdlRefTimingrequired?
%%
%function RTMCtrlRateMdlRefTimingPtrIsReqFcn() void
  %assign retVal = TLC_FALSE %% assume
  %if IsModelReferenceRTWTarget()
    %assign retVal = SLibModelHasControllableRate()
  %endif
  %return retVal
%endfunction %% RTMCtrlRateMdlRefTimingPtrIsReqFcn
 
%%Function:RTMCtrlRateNumTicksToNextHitIsReqFcn===========================================
%%Abstract:
%%IsCtrlRateNumTicksToNextHitrequired?
%%
%function RTMCtrlRateNumTicksToNextHitIsReqFcn() void
  %return SLibModelHasControllableRate() && RTMTaskCountersIsReqFcn()
%endfunction %% RTMCtrlRateNumTicksToNextHitIsReqFcn
 
%%Function:RTMERTPerTaskSampleHitsIsReqFcn===================================
%%Abstract:
%%IstheperTaskSampleHitsfieldneededinthertModel
%%
%function RTMERTPerTaskSampleHitsIsReqFcn() void
  %if IsModelReferenceTarget() && !SuppressMultiTaskScheduler
    %return TLC_FALSE
  %endif
 
  %return ERTPerTaskSampleHitsIsReqFcn()
%endfunction %% RTMERTPerTaskSampleHitsIsReqFcn
 
%%Function:ERTPerTaskSampleHitsIsReqFcn===================================
%%Abstract:
%%IstheperTaskSampleHitsfieldneededforERT
%%
%function ERTPerTaskSampleHitsIsReqFcn() void
  %assign retVal = TLC_FALSE %% assume
 
  %if (SLibIsERTCodeFormat()) && ...
    !RootSystemIsSingleRate && !SLibSingleTasking()
    %assign retVal = SuppressMultiTaskScheduler ? ...
      RequireRateInteraction : RequireMultiRateSampleHits
  %endif
 
  %return retVal
%endfunction %% ERTPerTaskSampleHitsIsReqFcn
 
%%Function:RTMTimePtrIsReqFcn==================================
%%
%%
%function RTMTimePtrIsReqFcn()
  %return !IsModelReferenceTarget() && ...
    ( RTMContTimeErtIsReqFcn() || ...
      RTMChildSfunctionIsReqFcn() || ...
      GenerateGRTWrapper )
%endfunction %% RTMTimePtrIsReqFcn
 
 
%%Function:RTMLogInfoIsReqFcn================================================
%%Abstract:
%%Istheloginfofieldrequired?
%%
%function RTMLogInfoIsReqFcn() void
  %if IsModelReferenceForASimstructBasedTarget()
    %return TLC_FALSE
  %endif
  %assign retVal = TLC_FALSE %% assume
 
  %if (SLibIsERTCodeFormat())
    %if MatFileLogging
      %assign retVal = TLC_TRUE
    %endif
  %else
    %assign retVal = TLC_TRUE
  %endif
 
  %return retVal
%endfunction %% RTMLogInfoIsReqFcn
 
 
%%Function:RTMExtModeInfoIsReqFcn============================================
%%Abstract:
%%Istheextmodefieldrequired?
%%
%function RTMExtModeInfoIsReqFcn() void
  %if IsModelReferenceForASimstructBasedTarget()
    %return TLC_FALSE
  %endif
  %assign retVal = TLC_FALSE %% assume
 
  %if (SLibIsERTCodeFormat() && !GenerateGRTWrapper)
    %if ExtMode == 1
      %assign retVal = TLC_TRUE
    %endif
  %else
    %assign retVal = TLC_TRUE
  %endif
 
  %return retVal
%endfunction %% RTMExtModeInfoIsReqFcn
 
%%Function:RTMMappingInfoIsReqFcn============================================
%%Abstract:
%%Isthemappinginfofieldrequired?
%%
%function RTMMappingInfoIsReqFcn() void
  %if IsModelReferenceForASimstructBasedTarget()
    %return TLC_FALSE
  %endif
  %assign retVal = TLC_FALSE %% assume
 
  %if (SLibIsERTCodeFormat()) && !GenerateGRTWrapper
    %if ExtMode == 1
      %assign retVal = TLC_TRUE
    %endif
  %else
    %assign retVal = TLC_TRUE
  %endif
 
  %return retVal
%endfunction %% RTMMappingInfoIsReqFcn
 
%%Function:RTMDataMapInfoIsReqFcn===========================================
%%Abstract:
%%IstheDataMapInfosubstructrequired?Thissubstructisrequiredwhen
%%generatingCAPIforSignalmonitoringandParametertuning
%%
%function RTMDataMapInfoIsReqFcn() void
  %return RTWCAPI
%endfunction
 
%endif %% _RTMISREQFCNS_
 
%%Function:RTMMdlRefGlobalTIDIsReqFcn========================================
%%Abstract:
%%DowehavetodeclareaGlobalTIDvariableinthertModel?Weonlydo
%%thisifthemodelhasaninheritedsampletimeandcodeisgenerated
%%thatneededtheGlobalTID
%function RTMMdlRefGlobalTIDIsReqFcn() void
  %assign retVal = RTMMdlRefGlobalTIDIsInstanceBased() && ...
    ::tMdlRefGlobalTIDMapAccessed
  %return retVal
   
%endfunction %% RTMMdlRefGlobalTIDIsReqFcn
 
%%Function:RTMMdlRefGlobalTIDIsInstanceBased=================================
%%Abstract:
%%IstheglobalTIDmapformodelreferenceinthertModeloraglobal
%%variable?Onlynon-constantinheritedsubmodelshaveitinthertModel.
%%IfnobodyaccessedtheglobalTIDduringcodegeneration,wewillnot
%%declareitineitherplace,seeRTMMdlRefGlobalTIDIsReqFcn
%function RTMMdlRefGlobalTIDIsInstanceBased() void
  %assign retVal = IsModelReferenceTarget() && ...
    (::CompiledModel.OkToMultiInstanceModelref || ...
     ::CompiledModel.MdlRefGlobalTIDMapIsInstanceBased == "yes")
  %return retVal
   
%endfunction %% RTMMdlRefGlobalTIDIsInstanceBased
 
%%Function:RTMMdlRefTriggerTIDIsReqFcn=======================================
%%Abstract:
%%DidthemodelaccesstheTriggerTIDfieldduringcodegeneration?
%function RTMMdlRefTriggerTIDIsReqFcn() void
  %assign retVal = RTMMdlRefTriggerTIDMayBeRequired() && ...
    ::tMdlRefGlobalTIDMapAccessed
  %return retVal
   
%endfunction %% RTMMdlRefTriggerTIDIsReqFcn
 
%%Function:RTMMdlRefTriggerTIDMayBeRequired===================================
%%Abstract:
%%DowerequireaTriggerTIDtobepassedintothismodelduringmodel
%%reference?Thisistrueonlyifthismodelisaroottriggeredmodel
%%forwhichtheGlobalTIDispassedinas'-1'.Ifnobodyaccessedthe
%%globalTIDduringcodegeneration,wewillnotdeclareit.See
%%RTMMdlReTriggerTIDIsReqFcntodetermineifitisactuallydeclared.
%function RTMMdlRefTriggerTIDMayBeRequired() void
  %assign retVal = IsModelReferenceTarget() && ...
    ::CompiledModel.MdlRefTriggerTIDMayBeRequired == "yes"
  %return retVal
   
%endfunction %% RTMMdlRefTriggerTIDMayBeRequired
 
%%Function:RTMParamIsMallocedIsReqFcn========================================
%%Abstract:
%%Doestheaddressofthestaticallydeclaredparameterstructureneedtobe
%%savedinrtModel.Thisisneededforgrt_malloc.tlctargettoknowwhich
%%instance(s)ofrtModelareusingmalloc'edcopiesofthestructure.
%function RTMParamIsMallocedIsReqFcn() void
  %return TLC_FALSE
%endfunction %% RTMParamIsMallocedIsReqFcn
 
%%Function:RTMModelPtrsToDefaultParamIsReqFcn================================
%%Abstract:
%%Doestheaddressofthestaticallydeclaredparameterstructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%function RTMModelPtrsToDefaultParamIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
   %if !LibParametersStructIsEmpty() && !FcnParamsAreGlobalStruct() && ...
     !GenerateClassInterface && !SLibUseBackwardCompatibleReusableInterface()
      %return TLC_TRUE
   %endif
   %if !LibParametersStructIsEmpty() && ...
     ((::CompiledModel.ConfigSet.SystemTargetFile=="systemverilog_dpi_grt.tlc") || ...
     (::CompiledModel.ConfigSet.SystemTargetFile=="systemverilog_dpi_ert.tlc"))
     %return TLC_TRUE
   %endif
    
   %if FcnParamsAreGlobalStruct()
     %return RTMModelPtrsToSharedDataIsReqFcn()
   %else
     %return RTMModelPtrsToInstanceDataIsReqFcn()
   %endif
   
%endfunction %% RTMModelPtrsToDefaultParamIsReqFcn
 
%%Function:RTMModelPtrsToConstBlockIOIsReqFcn================================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredconstblockIOstructureneedto
%%besavedinrtModel.Thisisalwayssavedforgrt_malloc.tlctarget.
%function RTMModelPtrsToConstBlockIOIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
  %if isGRTMalloc
      %return TLC_TRUE
   %endif
   %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToConstBlockIOIsReqFcn
 
%%Function:RTMModelPtrsToBlockIOIsReqFcn====================================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredblockIOstructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%%xxx:Assumesrootsystem
%function RTMModelPtrsToBlockIOIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
   %assign rootSystem = System[NumSystems-1]
   %assign reqInsts = LibGetSystemField(rootSystem, "ReqRootPrmHdrDataInsts")
   %if !reqInsts.BlockIOInst && LibGetFieldSet(rootSystem, "HasBlockIOArg") == 1 ...
     && !LibBlockIOStructIsEmpty() && MultiInstanceERTCode ...
     && !GenerateClassInterface && !SLibUseBackwardCompatibleReusableInterface()
     %return TLC_TRUE
   %endif
   %return RTMModelPtrsToInstanceDataIsReqFcn()
 
%endfunction %% RTMModelPtrsToBlockIOIsReqFcn
 
%%Function:RTMModelPtrsToPrevZcSigStateIsReqFcn==============================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredPrevZCSigStatestructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%%xxx:Assumesrootsystem
%function RTMModelPtrsToPrevZcSigStateIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
  %assign rootSystem = System[NumSystems-1]
   %assign reqInsts = LibGetSystemField(rootSystem, "ReqRootPrmHdrDataInsts")
   %if !reqInsts.PrevZCStatesInst && LibGetFieldSet(rootSystem, "HasZCEventArg") == 1 ...
     && !LibPrevZCStatesStructIsEmpty() && MultiInstanceERTCode && ...
       !GenerateClassInterface && !SLibUseBackwardCompatibleReusableInterface()
     %return TLC_TRUE
   %endif
  %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToPrevZcSigStateIsReqFcn
  
%%Function:RTMModelPtrsToZCSignalValuesIsReqFcn==============================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredPrevZCSigSigValuestructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%%xxx:Assumesrootsystem
%function RTMModelPtrsToZCSignalValuesIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
  %assign baseSysIdx = GetBaseSystemIdx()
   %if LibGetFieldSet(System[baseSysIdx], "HasZCSignalValueArg") && ...
     !LibZCSignalValueStructIsEmpty() && MultiInstanceERTCode && ...
     !GenerateClassInterface && !SLibUseBackwardCompatibleReusableInterface()
      %return TLC_TRUE
   %endif
  %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToZCSignalValuesIsReqFcn
 
 
%%Function:RTMModelPtrsToInputsIsReqFcn======================================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredExternalInputsstructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%function RTMModelPtrsToInputsIsReqFcn() void
   %if TYPE(ExternalInputsStructDefn) != "Number" ...
     && !LibExternalInputsStructIsEmpty() ...
     && MultiInstanceERTCode && !GenerateClassInterface && ...
     (::CompiledModel.RootIOFormat == "Part of model data structure")
     %return TLC_TRUE
   %elseif (::CompiledModel.NumModelInputs == 0 || ...
     (TYPE(ExternalInputsStructDefn) != "Number" && LibExternalInputsStructIsEmpty())) && ...
     SLibIsERTCodeFormat() && !GenerateGRTWrapper
     %return TLC_FALSE
   %endif
  %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToInputsIsReqFcn
 
%%Function:RTMModelPtrsToOutputsIsReqFcn=====================================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredExternalOutputsstructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%function RTMModelPtrsToOutputsIsReqFcn() void
   %if TYPE(ExternalOutputsStructDefn) != "Number" ...
     && !LibExternalOutputsStructIsEmpty() ...
     && MultiInstanceERTCode && !GenerateClassInterface && ...
     (::CompiledModel.RootIOFormat == "Part of model data structure")
     %return TLC_TRUE
   %elseif (::CompiledModel.NumModelOutputs == 0 || ...
      (TYPE(ExternalOutputsStructDefn) != "Number" && LibExternalOutputsStructIsEmpty())) && ...
      SLibIsERTCodeFormat() && !GenerateGRTWrapper
     %return TLC_FALSE
   %endif
  %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToOutputsIsReqFcn
 
%%Function:RTMModelPtrsToRootDWorkIsReqFcn===================================
%%Abstract:
%%DoestheaddressofthestaticallydeclaredDWorkstructureneedtobe
%%savedinrtModel.Thisisconditionallysavedforsimplifiedreusablecall
%%interfaceandalwayssavedforclassiccallinterface.
%function RTMModelPtrsToRootDWorkIsReqFcn() void
  %if SLibGetUseRTMcgType()
    %return TLC_FALSE
  %endif
  %if !SLibModelDWorkStructIsEmpty() && ...
    MultiInstanceERTCode && !GenerateClassInterface && ...
    !SLibUseBackwardCompatibleReusableInterface()
    %return TLC_TRUE
  %endif
  %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToRootDWorkIsReqFcn
 
%%Function:RTMModelPtrsToReservedForXPCIsReqFcn==============================
%%Abstract:
%%DoestheaddressofthexPCdatastructureneedtobesavedinrtModel.
%%ThisissavedonlyforxPCtargetsorfortargetswithclassiccallinterface
%function RTMModelPtrsToReservedForXPCIsReqFcn() void
   %if !EXISTS("xPC") || (xPC!=1 && !GenerateGRTWrapper)
     %return TLC_FALSE
   %endif
    
   %return RTMModelPtrsToInstanceDataIsReqFcn()
   
%endfunction %% RTMModelPtrsToReservedForXPCIsReqFcn
 
%%Function:RTMMdlRefCPPInstIsReqFcn========================================
%%Abstract:
%%Doesrt_modelneedtohavepointerstoC++modelblockinstancevariables
%%containedinanon-virtualsubsystem.
%function RTMMdlRefCPPInstIsReqFcn() void
  %if GenerateClassInterface
    %return TLC_TRUE
  %else
    %return TLC_FALSE
  %endif
%endfunction %% RTMMdlRefCPPInstIsReqFcn
 
%%[EOF]rtmisreqfcns.ttlc