%implements Opaque "C"
%function BlockTypeSetup(block,system) void
%assign protoBuf = GetModelUserFcnPrototypes()
%<SLibCacheCodeToFile("baseMdl_data_typedef", protoBuf)>
%endfunction
%function generateType(block, system, fcnType) Output
%assign fileName = TLCFileName + "_" + fcnType
%<GENERATE_TYPE(block, fcnType, fileName, system)>
%assign unused = UNLOAD_GENERATE_TYPE(block, fileName)
%endfunction
%function generateTypeForTID(block, system, fcnType,tid) Output
%assign fileName = TLCFileName + "_" + fcnType
%assign fcnName = "%<fcnType>ForTID"
%<GENERATE_TYPE(block, fcnName, fileName, system,tid)>
%assign unused = UNLOAD_GENERATE_TYPE(block, fileName)
%endfunction
%function generateTypeForSetDims(block, system, fcnType, oidx, ridx) Output
%assign fileName = TLCFileName + "_" + fcnType
%assign fcnName = "%<fcnType>"
%<GENERATE_TYPE(block, fcnName, fileName, system, oidx, ridx)>
%assign unused = UNLOAD_GENERATE_TYPE(block, fileName)
%endfunction
%function BlockInstanceSetup(block, system) void
%<LibBlockSetIsExpressionCompliant(block)>
%<LibBlockSetCustomStorageComplianceLevel(block, 2)>
%if GenerateASAP2
%foreach prmIdx = Parameters[0]
%if Parameter[prmIdx].Name == "InputValues"
%assign group = SLibCreateParameterGroup(block,"Lookup1D")
%assign tmpVar = SLibAddMember(block,group,Parameter[prmIdx])
%assign tmpVar = SLibAddMember(block,group,Parameter[prmIdx+1])
%elseif Parameter[prmIdx].Name == "RowIndex"
%assign group = SLibCreateParameterGroup(block,"Lookup2D")
%assign tmpVar = SLibAddMember(block, group, Parameter[prmIdx])
%assign tmpVar = SLibAddMember(block, group, Parameter[prmIdx+1])
%assign tmpVar = SLibAddMember(block, group, Parameter[prmIdx+2])
%endif
%endforeach
%endif
%assign skipLast = IsModelReferenceTarget()
%foreach moduleIdx = ::CompiledModel.RTWCGModules.NumRTWCGModules - (skipLast ? 1 : 0)
%assign moduleRec = ::CompiledModel.RTWCGModules.RTWCGModule[moduleIdx]
%if moduleRec.RTWFcnConst.HasInstanceSetup == "yes"
%assign fileName = "%<moduleRec.TLCFileName>_BlockInstanceSetup"
%assign origModuleIdx = ::CurrentModuleIdx
%assign ::CurrentModuleIdx = system.CGIRModuleIdx
%<GENERATE_TYPE(block, "BlockInstanceSetup", fileName, system)>
%assign ::CurrentModuleIdx = origModuleIdx
%assign unused = UNLOAD_GENERATE_TYPE(block, fileName)
%endif
%endforeach
%endfunction
%function Start(block, system) Output
%if block.OpaqueBlockMethode.HasStart
%<generateType(block, system, "Start")>
%endif
%endfunction
%function SetupRuntimeResources(block, system) Output
%if block.OpaqueBlockMethode.HasSetupRuntimeResources
%<generateType(block, system, "SetupRuntimeResources")>
%endif
%endfunction
%function InitializeConditions(block, system) Output
%if block.OpaqueBlockMethode.HasInitializeConditions
%<generateType(block, system, "InitializeConditions")>
%endif
%endfunction
%function SystemInitialize(block, system) Output
%if block.OpaqueBlockMethode.HasSystemInitialize
%<generateType(block, system, "SystemInitialize")>
%endif
%endfunction
%function SystemReset(block, system) Output
%if block.OpaqueBlockMethode.HasSystemReset
%<generateType(block, system, "SystemReset")>
%endif
%endfunction
%function OpaqueBlkSingleRateBecauseTID01EQ(block)
%assign tid01Eq = ISEQUAL(SolverType, "FixedStep") && FixedStepOpts.TID01EQ
%if !IsModelReferenceTarget() && tid01Eq
%with block
%return SIZE(TID,1) == 2 && TID[0] == 0 && TID[1] == 1
%endwith
%else
%return TLC_FALSE
%endif
%endfunction
%function Update(block, system) Output
%if block.OpaqueBlockMethode.HasUpdate
%<generateType(block, system, "Update")>
%endif
%endfunction
%function UpdateForTID(block, system, tid) Output
%assert(SIZE(block.TID,1) > 1)
%if block.OpaqueBlockMethode.HasUpdate
%if OpaqueBlkSingleRateBecauseTID01EQ(block)
%if tid == 0
%<generateType(block, system, "Update")>
%endif
%assert(tid == 0 || tid == 1)
%else
%<generateTypeForTID(block, system, "Update", tid)>
%endif
%endif
%endfunction
%function Outputs(block, system) Output
%if block.OpaqueBlockMethode.HasOutputs
%<generateType(block, system, "Outputs")>
%endif
%endfunction
%function OutputsForTID(block, system, tid) Output
%assert(SIZE(block.TID,1) > 1)
%if block.OpaqueBlockMethode.HasOutputs
%if OpaqueBlkSingleRateBecauseTID01EQ(block)
%if tid == 0
%<generateType(block, system, "Outputs")>
%endif
%assert(tid == 0 || tid == 1)
%else
%<generateTypeForTID(block, system, "Outputs", tid)>
%endif
%endif
%endfunction
%function Derivatives(block, system) Output
%if block.OpaqueBlockMethode.HasDerivatives
%<generateType(block, system, "Derivatives")>
%endif
%endfunction
%function ForcingFunction(block, system) Output
%if block.OpaqueBlockMethode.HasForcingFunction
%<generateType(block, system, "ForcingFunction")>
%elseif ::CompiledModel.ModelIsLinearlyImplicit == "yes"
%<Derivatives(block, system)>
%endif
%endfunction
%function MassMatrix(block, system) Output
%if block.OpaqueBlockMethode.HasMassMatrix
%<generateType(block, system, "MassMatrix")>
%endif
%endfunction
%function Projection(block, system) Output
%if block.OpaqueBlockMethode.HasProjection
%<generateType(block, system, "Projection")>
%endif
%endfunction
%function ZeroCrossings(block, system) Output
%if block.OpaqueBlockMethode.HasZeroCrossings
%<generateType(block, system, "ZeroCrossings")>
%endif
%endfunction
%function Enable(block, system) Output
%if block.OpaqueBlockMethode.HasEnable
%<generateType(block, system, "Enable")>
%endif
%endfunction
%function Disable(block, system) Output
%if block.OpaqueBlockMethode.HasDisable
%<generateType(block, system, "Disable")>
%endif
%endfunction
%function CleanupRuntimeResources(block, system) Output
%if block.OpaqueBlockMethode.HasCleanupRuntimeResources
%<generateType(block, system, "CleanupRuntimeResources")>
%endif
%endfunction
%function Terminate(block, system) Output
%if block.OpaqueBlockMethode.HasTerminate
%<generateType(block, system, "Terminate")>
%endif
%endfunction
%function SetDims(block, system, oidx, ridx) Output
%if block.OpaqueBlockMethode.HasSetDims
%<generateTypeForSetDims(block, system, "SetDims", oidx, ridx)>
%endif
%endfunction
%function FinalizeAllDims(block, system) Output
%if block.OpaqueBlockMethode.HasFinalizeAllDims
%<generateType(block, system, "FinalizeAllDims")>
%endif
%endfunction
%function ConstCode(block, system) Output
%if block.OpaqueBlockMethode.HasConstCode
%<generateType(block, system, "ConstCode")>
%endif
%endfunction