%selectfile NULL_FILE
%function FcnGenerateLookupDirect(thisBlock, lkBlk, data, tableCanPrm)
%with thisBlock
%assign tblMdlPrm = ::CompiledModel.ModelParameters.Parameter[Parameter[0]._idx]
%assign tblPrmLayout = LibGetDataLayout(tblMdlPrm)
%if (tblPrmLayout[1] > 2)
%return TLC_FALSE
%endif
%if (tblPrmLayout[2][0] == 1) && (NumDataInputPorts == 1)
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup1D")
%createrecord directXPrm {Value []; OriginalDataTypeIdx 7; tableType "DirectLookup"}
%assign directXPrm.Value = [0:%]
%assign tmpVar = SLibAddMember(thisBlock, group, directXPrm)
%addtorecord group xAxisIsCanPrm "no"
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%assign rowSig = FcnGetSource(DataInputPort[0].Region[0]._Source)
%assign rowName = ""
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%assign directXPrm.OriginalDataTypeIdx = LibASAP2GetOrigDataTypeId(rowSig)
%endif
%endif
%addtorecord group InputValSigName rowName
%if !ISEMPTY(tableCanPrm)
%if FcnCheckValidityOf1DCanonicalParamGroup(group)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup1D(group)
%endif
%else
%if FcnCheckValidityOf1DParamGroup(group)
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup1D(group)
%endif
%endif
%elseif (tblPrmLayout[2][0] > 1) && (NumDataInputPorts == 2)
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup2D")
%assign colSig = FcnGetSource(thisBlock.DataInputPort[0].Region._Source)
%createrecord directXPrm {Value []; OriginalDataTypeIdx 7; tableType "DirectLookup"}
%assign directXPrm.Value = [0:%]
%assign rowSig = FcnGetSource(thisBlock.DataInputPort[1].Region._Source)
%createrecord directYPrm {Value []; OriginalDataTypeIdx 7; tableType "DirectLookup"}
%assign directYPrm.Value = [0:%]
%assign tmpVar = SLibAddMember(thisBlock, group, directXPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, directYPrm)
%addtorecord group xAxisIsCanPrm "no"
%addtorecord group yAxisIsCanPrm "no"
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%assign rowSig = FcnGetSource(DataInputPort[0].Region[0]._Source)
%assign rowName = ""
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%assign directXPrm.OriginalDataTypeIdx = LibASAP2GetOrigDataTypeId(rowSig)
%endif
%endif
%assign colSig = FcnGetSource(DataInputPort[1].Region[0]._Source)
%assign colName = ""
%if !ISEMPTY(colSig) && FcnIsRecordDataTypeValidForASAP2(colSig)
%assign cdata = FcnGetGlobalMemoryMapData(colSig)
%if FcnRecordIsASAP2TestPointSignal(colSig) || ...
FcnRecordIsASAP2ExternalInput(colSig) || ...
FcnDataSupportsASAP2(cdata)
%assign colName = LibASAP2GetSymbol(colSig)
%assign directYPrm.OriginalDataTypeIdx = LibASAP2GetOrigDataTypeId(colSig)
%endif
%endif
%addtorecord group RowIdxSigName rowName
%addtorecord group ColIdxSigName colName
%if !ISEMPTY(tableCanPrm)
%if FcnCheckValidityOf2DCanonicalParamGroup(group)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup2D(group)
%endif
%else
%if FcnCheckValidityOf2DParamGroup(group)
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup2D(group)
%endif
%endif
%endif
%endwith
%return TLC_TRUE
%endfunction
%function FcnGenerateInterpolation1D(thisBlock, lkBlk, data, tableCanPrm)
%with thisBlock
%if (TYPE(data) == "Scope") && !ISFIELD(data,"UsedInParameterGroup")
%<LibAddIdentifier(data, "UsedInParameterGroup", "")>
%endif
%if (lkBlk.NumPreLookups == 0)
%return TLC_FALSE
%endif
%assign xPreIdx = lkBlk.PreLookupBlock[0].GrSrc
%assign xPreBlk = Subsystem[xPreIdx[0]].Block[xPreIdx[1]]
%if xPreBlk.NumParameters< 1 || xPreBlk.Parameter[0]._idx < 0
%return TLC_FALSE
%endif
%if xPreBlk.Parameter[0].SLName == "BreakpointsFirstPoint"
%return TLC_FALSE
%endif
%assign tblBlkPrm = Parameter[0]
%assign tblMdlPrm = ::CompiledModel.ModelParameters.Parameter[tblBlkPrm._idx]
%assign blkPath = SLibMangledGrBlockPath(lkBlk.GrSrc)
%if FcnDataIsStructuredAndSupportsASAP2(data)
%if (tblBlkPrm._idx != xPreBlk.Parameter[0]._idx)
%return TLC_FALSE
%endif
%assign xPreBlkPath = SLibMangledGrBlockPath(xPreIdx)
%assign retVal = FEVAL("coder.internal.getTableAndAxisPtsForLUT",blkPath, xPreBlkPath)
%if retVal[0]==-1
%return TLC_FALSE
%endif
%assign tableBusElemPos = retVal[1]
%assign bp1BusElemPos = retVal[2]
%if FcnCheckSTDAxisValidityOf1DParam(tblMdlPrm,"Prelookup")
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup1D")
%addtorecord group xAxisType "STD_AXIS"
%assign busObject = data.StructInfo
%if !ISFIELD(busObject,"STDAxisInfo")
%addtorecord busObject STDAxisInfo [%<tableBusElemPos>, %<bp1BusElemPos>]
%endif
%assign xPrm = AxisRecord { BusElement busObject.BusElement[bp1BusElemPos] }
%addtorecord tblMdlPrm AxisRecord { BusElement busObject.BusElement[tableBusElemPos] }
%assign tmpVar = SLibAddMember(thisBlock, group, xPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%addtorecord group tableIsCanPrm "no"
%addtorecord group RecordLayoutName busObject.Name
%assign tmpvar = SLibWriteToRecordLayoutsRecord(busObject)
%else
%return TLC_FALSE
%endif
%else
%assign xPrm = xPreBlk.Parameter[0]
%assign xMdlPrm = ::CompiledModel.ModelParameters.Parameter[xPrm._idx]
%assign xCanPrm = FcnGetCanonicalParameter(xPrm)
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup1D")
%if !ISEMPTY(xCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, xCanPrm)
%addtorecord group xAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%if !FcnCheckValidityOf1DCanonicalParamGroup(group)
%return TLC_FALSE
%endif
%else
%if !FcnCheckValidityOf1DParamGroup(group)
%return TLC_FALSE
%endif
%endif
%endif
%assign rowName = ""
%if (xPreBlk.NumDataInputPorts>0) && (xPreBlk.DataInputPort[0].NumRegions>0)
%assign rowSig = FcnGetSource(xPreBlk.DataInputPort[0].Region[0]._Source)
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%endif
%endif
%endif
%addtorecord group InputValSigName rowName
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup1D(group)
%else
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup1D(group)
%endif
%endwith
%return TLC_TRUE
%endfunction
%function FcnGenerateInterpolation2D(thisBlock, lkBlk, data, tableCanPrm)
%with thisBlock
%assign tblBlkPrm = Parameter[0]
%assign NumDims = 2
%if (TYPE(data) == "Scope") && !ISFIELD(data,"UsedInParameterGroup")
%<LibAddIdentifier(data, "UsedInParameterGroup", "")>
%endif
%assign NumSubtables = lkBlk.NumberOfSubTableSelectionDimensions
%if NumSubtables==2
%return TLC_FALSE
%endif
%assign factor = (thisBlock.NumDataInputPorts - NumSubtables)/(NumDims - NumSubtables)
%if NumSubtables==1
%if (lkBlk.NumPreLookups != factor)
%return TLC_FALSE
%endif
%elseif NumSubtables==0
%if (lkBlk.NumPreLookups != NumDims*factor)
%return TLC_FALSE
%endif
%endif
%assign xPreIdx = lkBlk.PreLookupBlock[0].GrSrc
%assign xPreBlk = Subsystem[xPreIdx[0]].Block[xPreIdx[1]]
%if xPreBlk.NumParameters < 1 || xPreBlk.Parameter[0]._idx < 0
%return TLC_FALSE
%endif
%if NumSubtables == 0
%assign yPreIdx = lkBlk.PreLookupBlock[factor].GrSrc
%assign yPreBlk = Subsystem[yPreIdx[0]].Block[yPreIdx[1]]
%if yPreBlk.NumParameters < 1 || yPreBlk.Parameter[0]._idx < 0
%return TLC_FALSE
%endif
%else
%assign selSig = FcnGetSource(thisBlock.DataInputPort[factor].Region[0]._Source)
%if ISEMPTY(selSig)
%return TLC_FALSE
%endif
%endif
%if xPreBlk.Parameter[0].SLName == "BreakpointsFirstPoint"
%return TLC_FALSE
%endif
%assign tblMdlPrm= ::CompiledModel.ModelParameters.Parameter[tblBlkPrm._idx]
%assign blkPath = SLibMangledGrBlockPath(lkBlk.GrSrc)
%if FcnDataIsStructuredAndSupportsASAP2(data)
%if (tblBlkPrm._idx != xPreBlk.Parameter[0]._idx) || ...
(xPreBlk.Parameter[0]._idx != yPreBlk.Parameter[0]._idx)
%return TLC_FALSE
%endif
%assign xPreBlkPath = SLibMangledGrBlockPath(xPreIdx)
%assign yPreBlkPath = SLibMangledGrBlockPath(yPreIdx)
%assign retVal = FEVAL("coder.internal.getTableAndAxisPtsForLUT", blkPath, xPreBlkPath, yPreBlkPath)
%if retVal[0]==-1
%return TLC_FALSE
%endif
%assign tableBusElemPos = retVal[1]
%assign bp1BusElemPos = retVal[2]
%assign bp2BusElemPos = retVal[3]
%if FcnCheckSTDAxisValidityOf2DParam(tblMdlPrm,"Prelookup")
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup2D")
%addtorecord group xAxisType "STD_AXIS"
%addtorecord group yAxisType "STD_AXIS"
%assign busObject = data.StructInfo
%if !ISFIELD(busObject,"STDAxisInfo")
%addtorecord busObject ...
STDAxisInfo [%<tableBusElemPos>, %<bp1BusElemPos>, %<bp2BusElemPos>]
%endif
%assign xPrm = AxisRecord { BusElement busObject.BusElement[bp1BusElemPos] }
%assign yPrm = AxisRecord { BusElement busObject.BusElement[bp2BusElemPos] }
%addtorecord tblMdlPrm AxisRecord { BusElement busObject.BusElement[tableBusElemPos] }
%assign tmpVar = SLibAddMember(thisBlock, group, xPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, yPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%addtorecord group yAxisIsCanPrm "no"
%addtorecord group tableIsCanPrm "no"
%addtorecord group RecordLayoutName busObject.Name
%assign tmpvar = SLibWriteToRecordLayoutsRecord(busObject)
%else
%return TLC_FALSE
%endif
%else
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup2D")
%assign xPrm = xPreBlk.Parameter[0]
%assign xMdlPrm = ::CompiledModel.ModelParameters.Parameter[xPrm._idx]
%assign xCanPrm = FcnGetCanonicalParameter(xPrm)
%if !ISEMPTY(xCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, xCanPrm)
%addtorecord group xAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%endif
%if NumSubtables == 0
%assign yPrm = yPreBlk.Parameter[0]
%assign yMdlPrm = ::CompiledModel.ModelParameters.Parameter[yPrm._idx]
%assign yCanPrm = FcnGetCanonicalParameter(yPrm)
%if !ISEMPTY(yCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, yCanPrm)
%addtorecord group yAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, yMdlPrm)
%addtorecord group yAxisIsCanPrm "no"
%endif
%else
%assign colSig = FcnGetSource(thisBlock.DataInputPort[2].Region._Source)
%assign typeidx = SLibGetRecordDataTypeId(colSig)
%createrecord yMdlPrm {Value []; OriginalDataTypeIdx typeidx; tableType "DirectLookup"}
%assign len = %<data.NumCols>-1
%assign yMdlPrm.Value = [0:%<len>]
%assign tmpVar = SLibAddMember(thisBlock, group, yMdlPrm)
%addtorecord group yAxisIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%if !FcnCheckValidityOf2DCanonicalParamGroup(group)
%return TLC_FALSE
%endif
%else
%if !FcnCheckValidityOf2DParamGroup(group)
%return TLC_FALSE
%endif
%endif
%endif
%assign rowName = ""
%if (xPreBlk.NumDataInputPorts>0) && (xPreBlk.DataInputPort[0].NumRegions>0)
%assign rowSig = FcnGetSource(xPreBlk.DataInputPort[0].Region[0]._Source)
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%endif
%endif
%endif
%addtorecord group RowIdxSigName rowName
%assign colName = ""
%if (NumSubtables == 0) && (yPreBlk.NumDataInputPorts>0) && (yPreBlk.DataInputPort[0].NumRegions>0)
%assign colSig = FcnGetSource(yPreBlk.DataInputPort[0].Region[0]._Source)
%if !ISEMPTY(colSig) && FcnIsRecordDataTypeValidForASAP2(colSig)
%assign cdata = FcnGetGlobalMemoryMapData(colSig)
%if FcnRecordIsASAP2TestPointSignal(colSig) || ...
FcnRecordIsASAP2ExternalInput(colSig) || ...
FcnDataSupportsASAP2(cdata)
%assign colName = LibASAP2GetSymbol(colSig)
%endif
%endif
%endif
%addtorecord group ColIdxSigName colName
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup2D(group)
%else
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup2D(group)
%endif
%endwith
%return TLC_TRUE
%endfunction
%function FcnGenerateLookupND(thisBlock, lkBlk, data, tableCanPrm)
%with thisBlock
%assign tblBlkPrm = Parameter[0]
%if !FcnDataSupportsASAP2(data) && ...
!FcnDataIsStructuredAndSupportsASAP2(data) && ...
ISEMPTY(tableCanPrm)
%return TLC_FALSE
%endif
%assign tblMdlPrm= ::CompiledModel.ModelParameters.Parameter[tblBlkPrm._idx]
%assign numDims = lkBlk.NumberOfTableDimensions
%if numDims == 1
%if ((NumParameters < 2) || (Parameter[1]._idx < 0))
%return TLC_FALSE
%endif
%if Parameter[1].SLName == "BreakpointsForDimension1FirstPoint"
%return TLC_FALSE
%endif
%if FcnDataIsStructuredAndSupportsASAP2(data)
%assign blkPath = SLibMangledGrBlockPath(lkBlk.GrSrc)
%assign retVal = FEVAL("coder.internal.getTableAndAxisPtsForLUT",blkPath)
%if (retVal[0] == -1)
%return TLC_FALSE
%endif
%if (Parameter[0]._idx != Parameter[1]._idx)
%return TLC_FALSE
%endif
%if FcnCheckSTDAxisValidityOf1DParam(tblMdlPrm,"LookupND")
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup1D")
%addtorecord group xAxisType "STD_AXIS"
%assign tableBusElemPos = retVal[1]
%assign bp1BusElemPos = retVal[2]
%assign busObject = data.StructInfo
%if !ISFIELD(busObject,"STDAxisInfo")
%addtorecord busObject ...
STDAxisInfo [%<tableBusElemPos>, %<bp1BusElemPos>]
%endif
%assign xMdlPrm = AxisRecord { BusElement busObject.BusElement[bp1BusElemPos] }
%addtorecord tblMdlPrm AxisRecord { BusElement busObject.BusElement[tableBusElemPos] }
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%addtorecord group tableIsCanPrm "no"
%addtorecord group RecordLayoutName busObject.Name
%assign tmpvar = SLibWriteToRecordLayoutsRecord(busObject)
%else
%return TLC_FALSE
%endif
%else
%if thisBlock.NumParameters != 2 && thisBlock.NumParameters != 3
%return TLC_FALSE
%endif
%assign xPrm = Parameter[1]
%assign xMdlPrm = ::CompiledModel.ModelParameters.Parameter[xPrm._idx]
%assign xCanPrm = FcnGetCanonicalParameter(xPrm)
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup1D")
%if !ISEMPTY(xCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, xCanPrm)
%addtorecord group xAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%if !FcnCheckValidityOf1DCanonicalParamGroup(group)
%return TLC_FALSE
%endif
%else
%if !FcnCheckValidityOf1DParamGroup(group)
%return TLC_FALSE
%endif
%endif
%endif
%assign rowName = ""
%if (NumDataInputPorts==1) && (DataInputPort[0].NumRegions>0)
%assign rowSig = FcnGetSource(DataInputPort[0].Region[0]._Source)
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%endif
%endif
%endif
%addtorecord group InputValSigName rowName
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup1D(group)
%else
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup1D(group)
%endif
%elseif numDims == 2
%if ((NumParameters < 3) || (Parameter[1]._idx < 0) || (Parameter[2]._idx < 0))
%return TLC_FALSE
%endif
%if Parameter[1].SLName == "BreakpointsForDimension1FirstPoint"
%return TLC_FALSE
%endif
%if FcnDataIsStructuredAndSupportsASAP2(data)
%assign blkPath = SLibMangledGrBlockPath(lkBlk.GrSrc)
%assign retVal = FEVAL("coder.internal.getTableAndAxisPtsForLUT",blkPath)
%if (retVal[0] == -1)
%return TLC_FALSE
%endif
%if (Parameter[0]._idx != Parameter[1]._idx) || ...
(Parameter[1]._idx != Parameter[2]._idx)
%return TLC_FALSE
%endif
%if FcnCheckSTDAxisValidityOf2DParam(tblMdlPrm,"LookupND")
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup2D")
%addtorecord group xAxisType "STD_AXIS"
%addtorecord group yAxisType "STD_AXIS"
%assign tableBusElemPos = retVal[1]
%assign bp1BusElemPos = retVal[2]
%assign bp2BusElemPos = retVal[3]
%assign busObject = data.StructInfo
%if !ISFIELD(busObject,"STDAxisInfo")
%addtorecord busObject ...
STDAxisInfo [%<tableBusElemPos>, %<bp1BusElemPos>, %<bp2BusElemPos>]
%endif
%assign xMdlPrm = AxisRecord { BusElement busObject.BusElement[bp1BusElemPos] }
%assign yMdlPrm = AxisRecord { BusElement busObject.BusElement[bp2BusElemPos] }
%addtorecord tblMdlPrm AxisRecord { BusElement busObject.BusElement[tableBusElemPos] }
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, yMdlPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%addtorecord group yAxisIsCanPrm "no"
%addtorecord group tableIsCanPrm "no"
%addtorecord group RecordLayoutName busObject.Name
%assign tmpvar = SLibWriteToRecordLayoutsRecord(busObject)
%else
%return TLC_FALSE
%endif
%else
%assign arrayLayout = ::CompiledModel.ConfigSet.ArrayLayout
%if ((arrayLayout == "Column-Major") && (thisBlock.NumParameters != 4))
%return TLC_FALSE
%endif
%if ((arrayLayout == "Row-Major") && (thisBlock.NumParameters != 5))
%return TLC_FALSE
%endif
%assign xPrm = Parameter[1]
%assign xMdlPrm = ::CompiledModel.ModelParameters.Parameter[xPrm._idx]
%assign xCanPrm = FcnGetCanonicalParameter(xPrm)
%assign yPrm = Parameter[2]
%assign yMdlPrm = ::CompiledModel.ModelParameters.Parameter[yPrm._idx]
%assign yCanPrm = FcnGetCanonicalParameter(yPrm)
%assign group = SLibCreateParameterGroup(thisBlock,"Lookup2D")
%if !ISEMPTY(xCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, xCanPrm)
%addtorecord group xAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, xMdlPrm)
%addtorecord group xAxisIsCanPrm "no"
%endif
%if !ISEMPTY(yCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, yCanPrm)
%addtorecord group yAxisIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, yMdlPrm)
%addtorecord group yAxisIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = SLibAddMember(thisBlock, group, tableCanPrm)
%addtorecord group tableIsCanPrm "yes"
%else
%assign tmpVar = SLibAddMember(thisBlock, group, tblMdlPrm)
%addtorecord group tableIsCanPrm "no"
%endif
%if !ISEMPTY(tableCanPrm)
%if !FcnCheckValidityOf2DCanonicalParamGroup(group)
%return TLC_FALSE
%endif
%else
%if !FcnCheckValidityOf2DParamGroup(group)
%return TLC_FALSE
%endif
%endif
%endif
%assign rowName = ""
%assign colName = ""
%if (NumDataInputPorts==2) && (DataInputPort[0].NumRegions>0) && ...
(DataInputPort[1].NumRegions>0)
%assign rowSig = FcnGetSource(DataInputPort[0].Region[0]._Source)
%if !ISEMPTY(rowSig) && FcnIsRecordDataTypeValidForASAP2(rowSig)
%assign rdata = FcnGetGlobalMemoryMapData(rowSig)
%if FcnRecordIsASAP2TestPointSignal(rowSig) || ...
FcnRecordIsASAP2ExternalInput(rowSig) || ...
FcnDataSupportsASAP2(rdata)
%assign rowName = LibASAP2GetSymbol(rowSig)
%endif
%endif
%assign colSig = FcnGetSource(DataInputPort[1].Region[0]._Source)
%if !ISEMPTY(colSig) && FcnIsRecordDataTypeValidForASAP2(colSig)
%assign cdata = FcnGetGlobalMemoryMapData(colSig)
%if FcnRecordIsASAP2TestPointSignal(colSig) || ...
FcnRecordIsASAP2ExternalInput(colSig) || ...
FcnDataSupportsASAP2(cdata)
%assign colName = LibASAP2GetSymbol(colSig)
%endif
%endif
%endif
%addtorecord group RowIdxSigName rowName
%addtorecord group ColIdxSigName colName
%if !ISEMPTY(tableCanPrm)
%assign tmpVar = FcnWriteCanonicalCharacteristic_Lookup2D(group)
%else
%assign tmpVar = FcnWriteStandardCharacteristic_Lookup2D(group)
%endif
%endif
%endwith
%return TLC_TRUE
%endfunction
%function FcnGetSource(src) void
%assign portObj = SLibCreateDummyPortRecord()
%assign portObj.SignalSrc = src
%return SLibGetSourceRecord(portObj, 0)
%endfunction
%function FcnCheckValidityOf1DCanonicalParamGroup(group) void
%with group
%assign tablePrm = Member[1].Reference
%assign xParam = Member[0].Reference
%if group.tableIsCanPrm != "yes"
%return TLC_FALSE
%else
%if ISFIELD(tablePrm,"UsedInParameterGroup") && !ISEMPTY(tablePrm.UsedInParameterGroup)
%if (tablePrm.UsedInParameterGroup != "Lookup1D.Member[1]")
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<tablePrm.Name>", "%<tablePrm.UsedInParameterGroup>", "Lookup1D.Member[1]"])>
%endif
%else
%assign dtID = LibGetRecordDataTypeId(tablePrm)
%if !(FcnIsNumericDataTypeValidForASAP2(dtID) || LibIsEnumDataType(dtID))
%return TLC_FALSE
%endif
%if !ISFIELD(tablePrm, "UsedInParameterGroup")
%<LibAddIdentifier(tablePrm, "UsedInParameterGroup", "Lookup1D.Member[1]")>
%else
%assign tablePrm.UsedInParameterGroup = "Lookup1D.Member[1]"
%endif
%endif
%endif
%assign xData = FcnGetGlobalMemoryMapData(xParam)
%if FcnDataSupportsASAP2(xData)
%if ISFIELD(xData,"UsedInParameterGroup")
%if (xData.UsedInParameterGroup != "Lookup1D.Member[0]")
%if ((xData.UsedInParameterGroup != "Lookup2D.Member[0]") &&...
(xData.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xData.Name>", "%<xData.UsedInParameterGroup>", "Lookup1D.Member[0]"])>
%endif
%endif
%else
%<LibAddIdentifier(xData, "UsedInParameterGroup", "Lookup1D.Member[0]")>
%endif
%assign xParamName = LibASAP2GetSymbol(xParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,xParamName)
%addtorecord group isDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<xParamName> 1
%addtorecord group isDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord group xAxisType "COM_AXIS"
%elseif group.xAxisIsCanPrm == "yes"
%if ISFIELD(xParam,"UsedInParameterGroup")
%if (xParam.UsedInParameterGroup != "Lookup1D.Member[0]")
%if ((xParam.UsedInParameterGroup != "Lookup2D.Member[0]") &&...
(xParam.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xParam.Name>", "%<xParam.UsedInParameterGroup>", "Lookup1D.Member[0]"])>
%endif
%endif
%else
%assign dtID = LibGetRecordDataTypeId(xParam)
%if !(FcnIsNumericDataTypeValidForASAP2(dtID) || LibIsEnumDataType(dtID))
%return TLC_FALSE
%endif
%<LibAddIdentifier(xParam, "UsedInParameterGroup", "Lookup1D.Member[0]")>
%endif
%addtorecord group isDuplicateBreakPoint TLC_FALSE
%addtorecord group xAxisType "COM_AXIS"
%else
%if FcnIsParamCandidateForFixAxis(xParam)
%if (FcnAxisIsEvenlySpaced(xParam.Value))
%addtorecord group xAxisType "FIX_AXIS"
%else
%addtorecord group xAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(xParam, "1")>
%return TLC_FALSE
%endif
%endif
%return TLC_TRUE
%endwith
%endfunction
%function FcnCheckValidityOf2DCanonicalParamGroup(group) void
%with group
%assign tablePrm = Member[2].Reference
%assign xParam = Member[0].Reference
%assign yParam = Member[1].Reference
%if group.tableIsCanPrm != "yes"
%return TLC_FALSE
%else
%if ISFIELD(tablePrm,"UsedInParameterGroup") && !ISEMPTY(tablePrm.UsedInParameterGroup)
%if (tablePrm.UsedInParameterGroup != "Lookup2D.Member[2]")
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<tablePrm.Name>", "%<tablePrm.UsedInParameterGroup>", "Lookup2D.Member[2]"])>
%endif
%else
%assign dtID = LibGetRecordDataTypeId(tablePrm)
%if !(FcnIsNumericDataTypeValidForASAP2(dtID) || LibIsEnumDataType(dtID))
%return TLC_FALSE
%endif
%if !ISFIELD(tablePrm, "UsedInParameterGroup")
%<LibAddIdentifier(tablePrm, "UsedInParameterGroup", "Lookup2D.Member[2]")>
%else
%assign tablePrm.UsedInParameterGroup = "Lookup2D.Member[2]"
%endif
%endif
%endif
%assign xData = FcnGetGlobalMemoryMapData(xParam)
%if FcnDataSupportsASAP2(xData)
%if ISFIELD(xData,"UsedInParameterGroup")
%if (xData.UsedInParameterGroup != "Lookup2D.Member[0]")
%if ((xData.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(xData.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xData.Name>", "%<xData.UsedInParameterGroup>", "Lookup2D.Member[0]"])>
%endif
%endif
%else
%<LibAddIdentifier(xData, "UsedInParameterGroup", "Lookup2D.Member[0]")>
%endif
%assign xParamName = LibASAP2GetSymbol(xParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,xParamName)
%addtorecord group xIsDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<xParamName> 1
%addtorecord group xIsDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord group xAxisType "COM_AXIS"
%elseif group.xAxisIsCanPrm == "yes"
%if ISFIELD(xParam,"UsedInParameterGroup")
%if (xParam.UsedInParameterGroup != "Lookup2D.Member[0]")
%if ((xParam.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(xParam.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xParam.Name>", "%<xParam.UsedInParameterGroup>", "Lookup2D.Member[0]"])>
%endif
%endif
%else
%assign dtID = LibGetRecordDataTypeId(xParam)
%if !(FcnIsNumericDataTypeValidForASAP2(dtID) || LibIsEnumDataType(dtID))
%return TLC_FALSE
%endif
%<LibAddIdentifier(xParam, "UsedInParameterGroup", "Lookup2D.Member[0]")>
%endif
%addtorecord group xIsDuplicateBreakPoint TLC_FALSE
%addtorecord group xAxisType "COM_AXIS"
%else
%if FcnIsParamCandidateForFixAxis(xParam)
%if (FcnAxisIsEvenlySpaced(xParam.Value))
%addtorecord group xAxisType "FIX_AXIS"
%else
%addtorecord group xAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(xParam, "1")>
%return TLC_FALSE
%endif
%endif
%assign yData = FcnGetGlobalMemoryMapData(yParam)
%if FcnDataSupportsASAP2(yData)
%if ISFIELD(yData,"UsedInParameterGroup")
%if (yData.UsedInParameterGroup != "Lookup2D.Member[1]")
%if ((yData.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(yData.UsedInParameterGroup != "Lookup2D.Member[0]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<yData.Name>", "%<yData.UsedInParameterGroup>", "Lookup2D.Member[1]"])>
%endif
%endif
%else
%<LibAddIdentifier(yData, "UsedInParameterGroup", "Lookup2D.Member[1]")>
%endif
%assign yParamName = LibASAP2GetSymbol(yParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,yParamName)
%addtorecord group yIsDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<yParamName> 1
%addtorecord group yIsDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord group yAxisType "COM_AXIS"
%elseif group.yAxisIsCanPrm == "yes"
%if ISFIELD(yParam,"UsedInParameterGroup")
%if (yParam.UsedInParameterGroup != "Lookup2D.Member[1]")
%if ((yParam.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(yParam.UsedInParameterGroup != "Lookup2D.Member[0]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<yParam.Name>", "%<yParam.UsedInParameterGroup>", "Lookup2D.Member[1]"])>
%endif
%endif
%else
%assign dtID = LibGetRecordDataTypeId(yParam)
%if !(FcnIsNumericDataTypeValidForASAP2(dtID) || LibIsEnumDataType(dtID))
%return TLC_FALSE
%endif
%<LibAddIdentifier(yParam, "UsedInParameterGroup", "Lookup2D.Member[1]")>
%endif
%addtorecord group yIsDuplicateBreakPoint TLC_FALSE
%addtorecord group yAxisType "COM_AXIS"
%else
%if FcnIsParamCandidateForFixAxis(yParam)
%if (FcnAxisIsEvenlySpaced(yParam.Value))
%addtorecord group yAxisType "FIX_AXIS"
%else
%addtorecord group yAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(yParam, "2")>
%return TLC_FALSE
%endif
%endif
%return TLC_TRUE
%endwith
%endfunction
%function FcnCheckValidityOf1DParamGroup(paramGroup)
%with paramGroup
%assign yData = FcnGetGlobalMemoryMapData(Member[1].Reference)
%if !(FcnDataSupportsASAP2(yData))
%return TLC_FALSE
%endif
%if ISFIELD(yData, "UsedInParameterGroup") && !ISEMPTY(yData.UsedInParameterGroup)
%if (yData.UsedInParameterGroup != "Lookup1D.Member[1]")
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<yData.Name>", "%<yData.UsedInParameterGroup>", "Lookup1D.Member[1]"])>
%endif
%else
%if !ISFIELD(yData, "UsedInParameterGroup")
%<LibAddIdentifier(yData, "UsedInParameterGroup", "Lookup1D.Member[1]")>
%else
%assign yData.UsedInParameterGroup = "Lookup1D.Member[1]"
%endif
%endif
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,yData.Name)
%return TLC_FALSE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<yData.Name> 1
%endif
%assign xParam = Member[0].Reference
%assign xData = FcnGetGlobalMemoryMapData(xParam)
%if (FcnDataSupportsASAP2(xData) || FcnDataIsStructuredAndSupportsASAP2(xData))
%if ISFIELD(xData,"UsedInParameterGroup")
%if (xData.UsedInParameterGroup != "Lookup1D.Member[0]")
%if ((xData.UsedInParameterGroup != "Lookup2D.Member[0]") &&...
(xData.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xData.Name>", "%<xData.UsedInParameterGroup>", "Lookup1D.Member[0]"])>
%endif
%endif
%else
%<LibAddIdentifier(xData, "UsedInParameterGroup", "Lookup1D.Member[0]")>
%endif
%assign xParamName = LibASAP2GetSymbol(xParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,xParamName)
%addtorecord paramGroup isDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<xParamName> 1
%addtorecord paramGroup isDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord paramGroup xAxisType "COM_AXIS"
%if FcnDataIsStructuredAndSupportsASAP2(xData) && xParam.IsBPObject
%assign xBusObject = xData.StructInfo
%if !ISFIELD(xBusObject,"COMAxisInfo")
%addtorecord xBusObject COMAxisInfo TLC_TRUE
%assign tmpvar = SLibWriteToRecordLayoutsRecord(xBusObject)
%endif
%addtorecord xParam RecordLayoutName xBusObject.Name
%endif
%else
%if FcnIsParamCandidateForFixAxis(xParam)
%if (FcnAxisIsEvenlySpaced(xParam.Value))
%addtorecord paramGroup xAxisType "FIX_AXIS"
%else
%addtorecord paramGroup xAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(Member[1].Reference, "1")>
%return TLC_FALSE
%endif
%endif
%return TLC_TRUE
%endwith
%endfunction
%function FcnCheckValidityOf2DParamGroup(paramGroup)
%with paramGroup
%assign zData = FcnGetGlobalMemoryMapData(Member[2].Reference)
%if !(FcnDataSupportsASAP2(zData))
%return TLC_FALSE
%endif
%if ISFIELD(zData, "UsedInParameterGroup") && !ISEMPTY(zData.UsedInParameterGroup)
%if (zData.UsedInParameterGroup != "Lookup2D.Member[2]")
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<zData.Name>", "%<zData.UsedInParameterGroup>", "Lookup2D.Member[2]"])>
%endif
%else
%if !ISFIELD(zData, "UsedInParameterGroup")
%<LibAddIdentifier(zData, "UsedInParameterGroup", "Lookup2D.Member[2]")>
%else
%assign zData.UsedInParameterGroup = "Lookup2D.Member[2]"
%endif
%endif
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,zData.Name)
%return TLC_FALSE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<zData.Name> 1
%endif
%assign xParam = Member[0].Reference
%assign xData = FcnGetGlobalMemoryMapData(xParam)
%if (FcnDataSupportsASAP2(xData) || FcnDataIsStructuredAndSupportsASAP2(xData))
%if ISFIELD(xData,"UsedInParameterGroup")
%if (xData.UsedInParameterGroup != "Lookup2D.Member[0]")
%if ((xData.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(xData.UsedInParameterGroup != "Lookup2D.Member[1]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<xData.Name>", "%<xData.UsedInParameterGroup>", "Lookup2D.Member[0]"])>
%endif
%endif
%else
%<LibAddIdentifier(xData, "UsedInParameterGroup", "Lookup2D.Member[0]")>
%endif
%assign xParamName = LibASAP2GetSymbol(xParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,xParamName)
%addtorecord paramGroup xIsDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<xParamName> 1
%addtorecord paramGroup xIsDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord paramGroup xAxisType "COM_AXIS"
%if FcnDataIsStructuredAndSupportsASAP2(xData) && xParam.IsBPObject
%assign xBusObject = xData.StructInfo
%if !ISFIELD(xBusObject,"COMAxisInfo")
%addtorecord xBusObject COMAxisInfo TLC_TRUE
%assign tmpvar = SLibWriteToRecordLayoutsRecord(xBusObject)
%endif
%addtorecord xParam RecordLayoutName xBusObject.Name
%endif
%else
%if FcnIsParamCandidateForFixAxis(xParam)
%if (FcnAxisIsEvenlySpaced(xParam.Value))
%addtorecord paramGroup xAxisType "FIX_AXIS"
%else
%addtorecord paramGroup xAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(Member[2].Reference, "1")>
%return TLC_FALSE
%endif
%endif
%assign yParam = Member[1].Reference
%assign yData = FcnGetGlobalMemoryMapData(yParam)
%if (FcnDataSupportsASAP2(yData) || FcnDataIsStructuredAndSupportsASAP2(yData))
%if ISFIELD(yData,"UsedInParameterGroup")
%if (yData.UsedInParameterGroup != "Lookup2D.Member[1]")
%if ((yData.UsedInParameterGroup != "Lookup1D.Member[0]") &&...
(yData.UsedInParameterGroup != "Lookup2D.Member[0]"))
%<SLibReportErrorWithIdAndArgs("RTW:tlc:ParameterGroup", ...
["%<yData.Name>", "%<yData.UsedInParameterGroup>", "Lookup2D.Member[1]"])>
%endif
%endif
%else
%<LibAddIdentifier(yData, "UsedInParameterGroup", "Lookup2D.Member[1]")>
%endif
%assign yParamName = LibASAP2GetSymbol(yParam)
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,yParamName)
%addtorecord paramGroup yIsDuplicateBreakPoint TLC_TRUE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<yParamName> 1
%addtorecord paramGroup yIsDuplicateBreakPoint TLC_FALSE
%endif
%addtorecord paramGroup yAxisType "COM_AXIS"
%if FcnDataIsStructuredAndSupportsASAP2(yData) && yParam.IsBPObject
%assign yBusObject = yData.StructInfo
%if !ISFIELD(yBusObject,"COMAxisInfo")
%addtorecord yBusObject COMAxisInfo TLC_TRUE
%assign tmpvar = SLibWriteToRecordLayoutsRecord(yBusObject)
%endif
%addtorecord yParam RecordLayoutName yBusObject.Name
%endif
%else
%if FcnIsParamCandidateForFixAxis(yParam)
%if (FcnAxisIsEvenlySpaced(yParam.Value))
%addtorecord paramGroup yAxisType "FIX_AXIS"
%else
%addtorecord paramGroup yAxisType "FIX_AXIS_PAR_LIST"
%endif
%else
%<FcnWarnForInvalidFixAxis(Member[2].Reference, "2")>
%return TLC_FALSE
%endif
%endif
%return TLC_TRUE
%endwith
%endfunction
%function FcnCheckSTDAxisValidityOf2DParam(tblPrm, LookupType)
%if LookupType == "Prelookup"
%assign numUses = 0
%foreach blkGrIdx = SIZE(tblPrm.GraphicalRef,0)
%assign subsysIdx = tblPrm.GraphicalRef[blkGrIdx][0]
%assign blkIdx = tblPrm.GraphicalRef[blkGrIdx][1]
%if ::CompiledModel.BlockHierarchyMap.Subsystem[subsysIdx].Block[blkIdx].Type ...
!= "ModelReference"
%assign numUses = numUses + 1
%endif
%endforeach
%if numUses != 3
%return TLC_FALSE
%endif
%elseif LookupType == "LookupND"
%assign numUses = 0
%foreach blkGrIdx = SIZE(tblPrm.GraphicalRef,0)
%assign subsysIdx = tblPrm.GraphicalRef[blkGrIdx][0]
%assign blkIdx = tblPrm.GraphicalRef[blkGrIdx][1]
%if ::CompiledModel.BlockHierarchyMap.Subsystem[subsysIdx].Block[blkIdx].Type ...
!= "ModelReference"
%assign numUses = numUses + 1
%endif
%endforeach
%if numUses != 1
%return TLC_FALSE
%endif
%else
%<SLibReportErrorWithIdAndArgs("RTW:tlc:WrongLookupType", LookupType)>
%endif
%assign zData = FcnGetGlobalMemoryMapData(tblPrm)
%if ISFIELD(zData, "UsedInParameterGroup") && !ISEMPTY(zData.UsedInParameterGroup)
%if (zData.UsedInParameterGroup != "STDAxisLookup2D")
%return TLC_FALSE
%endif
%else
%if !ISFIELD(zData, "UsedInParameterGroup")
%<LibAddIdentifier(zData, "UsedInParameterGroup", "STDAxisLookup2D")>
%else
%assign zData.UsedInParameterGroup = "STDAxisLookup2D"
%endif
%endif
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,zData.Name)
%return TLC_FALSE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<zData.Name> 1
%endif
%return TLC_TRUE
%endfunction
%function FcnCheckSTDAxisValidityOf1DParam(tblPrm, LookupType)
%if LookupType == "Prelookup"
%assign numUses = 0
%foreach blkGrIdx = SIZE(tblPrm.GraphicalRef,0)
%assign subsysIdx = tblPrm.GraphicalRef[blkGrIdx][0]
%assign blkIdx = tblPrm.GraphicalRef[blkGrIdx][1]
%if ::CompiledModel.BlockHierarchyMap.Subsystem[subsysIdx].Block[blkIdx].Type ...
!= "ModelReference"
%assign numUses = numUses + 1
%endif
%endforeach
%if numUses != 2
%return TLC_FALSE
%endif
%elseif LookupType == "LookupND"
%assign numUses = 0
%foreach blkGrIdx = SIZE(tblPrm.GraphicalRef,0)
%assign subsysIdx = tblPrm.GraphicalRef[blkGrIdx][0]
%assign blkIdx = tblPrm.GraphicalRef[blkGrIdx][1]
%if ::CompiledModel.BlockHierarchyMap.Subsystem[subsysIdx].Block[blkIdx].Type ...
!= "ModelReference"
%assign numUses = numUses + 1
%endif
%endforeach
%if numUses != 1
%return TLC_FALSE
%endif
%else
%<SLibReportErrorWithIdAndArgs("RTW:tlc:WrongLookupType", LookupType)>
%endif
%assign zData = FcnGetGlobalMemoryMapData(tblPrm)
%if ISFIELD(zData, "UsedInParameterGroup") && !ISEMPTY(zData.UsedInParameterGroup)
%if (zData.UsedInParameterGroup != "STDAxisLookup1D")
%return TLC_FALSE
%endif
%else
%if !ISFIELD(zData, "UsedInParameterGroup")
%<LibAddIdentifier(zData, "UsedInParameterGroup", "STDAxisLookup1D")>
%else
%assign zData.UsedInParameterGroup = "STDAxisLookup1D"
%endif
%endif
%if ISFIELD(::CompiledModel.ASAP2DataEntityRec,zData.Name)
%return TLC_FALSE
%else
%addtorecord ::CompiledModel.ASAP2DataEntityRec %<zData.Name> 1
%endif
%return TLC_TRUE
%endfunction
%function FcnIsParamCandidateForFixAxis(param)
%assign paramDTId = param.OriginalDataTypeIdx
%if ( LibIsDataTypeFixpt(paramDTId) && ...
!LibIsNonBuiltInTypeNeededForFixpt(paramDTId) )
%return TLC_TRUE
%endif
%assign eDTId = LibGetDataTypeIdAliasedThruToFromId(paramDTId)
%if LibIsEnumDataType(eDTId)
%if LibIsEnumTypeStoredAsInt(eDTId)
%return TLC_TRUE
%else
%assign eDTId = LibGetEnumTypeStorageType(eDTId)
%endif
%endif
%if ( LibIsBuiltInDataType(eDTId) && SLibIsIntegerFromId(eDTId) )
%return TLC_TRUE
%else
%return TLC_FALSE
%endif
%endfunction
%function SLibWriteToRecordLayoutsRecord(busObject) void
%if !ISFIELD(busObject,"STDAxisInfo") && !ISFIELD(busObject,"COMAxisInfo")
%assign errStr = "Bus object does not have any information regarding Axis"
%<LibReportFatalError(errStr)>
%endif
%assign recordLayoutName = busObject.Name
%if ISFIELD(::CompiledModel.ASAP2RecordLayouts.RecordLayouts,recordLayoutName)
%return
%endif
%assign %<recordLayoutName> = busObject
%assign recordLayouts = ::CompiledModel.ASAP2RecordLayouts.RecordLayouts
%assign recordLayouts = recordLayouts + %<recordLayoutName>
%assign ::CompiledModel.ASAP2RecordLayouts.NumRecordLayouts = ...
::CompiledModel.ASAP2RecordLayouts.NumRecordLayouts + 1
%endfunction
%function FcnWarnForInvalidFixAxis(tableParam, bpNum) void
%if ISFIELD(tableParam, "UsedInParameterGroup")
%<REMOVEFIELD(tableParam, "UsedInParameterGroup")>
%else
%assign tableData = FcnGetGlobalMemoryMapData(tableParam)
%if TYPE(tableData) == "Scope"
%<REMOVEFIELD(tableData, "UsedInParameterGroup")>
%endif
%endif
%assign lutBlockPath = ""
%if ISFIELD(tableParam, "GraphicalRef")
%assign lutBlockPath = SLibMangledGrBlockPath(tableParam.GraphicalRef[0])
%elseif ISFIELD(tableParam, "MdlPrmIdx")
%assign lutBlockPath = SLibMangledGrBlockPath(ModelParameters.Parameter[tableParam.MdlPrmIdx].GraphicalRef[0])
%endif
%assign warnArgs = ["%<bpNum>", "%<lutBlockPath>"]
%<SLibReportWarningWithIdAndArgs("RTW:asap2:InvalidForFixAxis", warnArgs)>
%endfunction
%function FcnWriteStandardCharacteristic_Lookup1D(paramGroup) Output
%assign xParam = paramGroup.Member[0].Reference
%assign yParam = paramGroup.Member[1].Reference
%<LibASAP2AddCharacteristicToGraphicalGroups(yParam)>
%/
%endfunction
%function FcnWriteCanonicalCharacteristic_Lookup1D(paramGroup) Output
%assign xAxisParam = paramGroup.Member[0].Reference
%assign tableParam = paramGroup.Member[1].Reference
%/
%endfunction
%function FcnWriteStandardCharacteristic_Lookup2D(paramGroup) Output
%assign zParam = paramGroup.Member[2].Reference
%<LibASAP2AddCharacteristicToGraphicalGroups(zParam)>
%/
%endfunction
%function FcnWriteCanonicalCharacteristic_Lookup2D(paramGroup) Output
%/
%endfunction