%implements "sfun_multirate" "C"
%function Outputs(block, system) Output
%assign portIdxName = ["InputPortIdx0"]
%assign inPortTid0 = LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx0")
%assign inPortTid1 = LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1")
%if inPortTid0 == inPortTid1
%assign tmpBuf = OutputsForTID(block,system,inPortTid0)
%if !WHITE_SPACE(tmpBuf)
/* %<Type> Block: %<Name> */
if (%<LibIsSFcnSampleHit("InputPortIdx0")>) {
%<tmpBuf>
}
%endif
%else
%assign tmpBuf = OutputsForTID(block,system,inPortTid0)
%if !WHITE_SPACE(tmpBuf)
/* %<Type> Block: %<Name> */
if (%<LibIsSFcnSampleHit("InputPortIdx0")>) {
%<tmpBuf>
}
%endif
%assign tmpBuf = OutputsForTID(block,system,inPortTid1)
%if !WHITE_SPACE(tmpBuf)
if (%<LibIsSFcnSampleHit("InputPortIdx1")>) {
%<tmpBuf>
}
%endif
%endif
%endfunction
%function OutputsForTID(block, system, tid) Output
%openfile retBuf
%if tid == LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx0")
%assign enable = LibBlockInputSignal(0, "", "", 0)
%assign enabled = LibBlockIWork(0, "", "", 0)
%assert LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx0") <= ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1")
%assign inputPortTsIsDiff = ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx0") != ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1")
%openfile tmpBuf
%if inputPortTsIsDiff
if (%<LibIsSFcnSpecialSampleHit("InputPortIdx1","InputPortIdx0")>) {
%endif
%<enabled> = (%<enable> > 0.0);
%if inputPortTsIsDiff
}
%endif
%closefile tmpBuf
/* %<Type> Block: %<Name> */
%if LibGetSFcnTIDType("InputPortIdx0") == "continuous"
if (%<LibIsMajorTimeStep()>) {
%<tmpBuf>
}
%else
%<tmpBuf>
%endif
%endif
%if tid == LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1")
%assign enabled = LibBlockIWork(0, "", "", 0)
/* %<Type> Block: %<Name> */
%assign signal = LibBlockInputSignal(1, "", "", 0)
if (%<enabled>) {
%assign tsIsDiff = ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1") != ...
LibGetGlobalTIDFromLocalSFcnTID("OutputPortIdx0")
%if tsIsDiff
if (%<LibIsSFcnSpecialSampleHit("OutputPortIdx0", "InputPortIdx1")>) {
%endif
%assign y = LibBlockOutputSignal(0, "", "", 0)
%<y> = %<signal>;
%if tsIsDiff
}
%endif
%assign tsIsDiff = ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1") != ...
LibGetGlobalTIDFromLocalSFcnTID("OutputPortIdx1")
%if tsIsDiff
if (%<LibIsSFcnSpecialSampleHit("OutputPortIdx1", "InputPortIdx1")>) {
%endif
%assign y = LibBlockOutputSignal(1, "", "", 0)
%<y> = %<signal>;
%if tsIsDiff
}
%endif
%assign tsIsDiff = ...
LibGetGlobalTIDFromLocalSFcnTID("InputPortIdx1") != ...
LibGetGlobalTIDFromLocalSFcnTID("OutputPortIdx2")
%if tsIsDiff
if (%<LibIsSFcnSpecialSampleHit("OutputPortIdx2", "InputPortIdx1")>) {
%endif
%assign y = LibBlockOutputSignal(2, "", "", 0)
%<y> = %<signal>;
%if tsIsDiff
}
%endif
}
%endif
%closefile retBuf
%return retBuf
%endfunction