MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Betriebsanweisung Seite 199

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 210
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 198
Fully Inlined S-Function with the mdlRTW Routine
4-33
cache->evenlySpaced = FALSE;
}
}
#endif /* MDL_START */
/* Function: mdlOutputs ========================================================
* Abstract:
* In this function, we compute the outputs of our S-function
* block. Generally outputs are placed in the output vector, ssGetY(S).
*/
static void mdlOutputs(SimStruct *S, int_T tid)
{
SFcnCache *cache = ssGetUserData(S);
real_T *xData = mxGetPr(XVECT(S));
real_T *yData = mxGetPr(YVECT(S));
InputRealPtrsType uPtrs = ssGetInputPortRealSignalPtrs(S,0);
real_T *y = ssGetOutputPortRealSignal(S,0);
int_T ny = ssGetOutputPortWidth(S,0);
int_T xLen = mxGetNumberOfElements(XVECT(S));
int_T i;
/*
* When the XData is evenly spaced, we use the direct lookup algorithm
* to calculate the lookup
*/
if (cache->evenlySpaced) {
real_T spacing = xData[1] - xData[0];
for (i = 0; i < ny; i++) {
real_T u = *uPtrs[i];
if (u <= xData[0]) {
y[i] = yData[0];
} else if (u >= xData[xLen-1]) {
y[i] = yData[xLen-1];
} else {
int_T idx = (int_T)((u - xData[0])/spacing);
y[i] = yData[idx];
}
}
} else {
/*
* When the XData is unevenly spaced, we use a bisection search to
* locate the lookup index.
*/
for (i = 0; i < ny; i++) {
int_T idx = GetDirectLookupIndex(xData,xLen,*uPtrs[i]);
y[i] = yData[idx];
}
}
Seitenansicht 198
1 2 ... 194 195 196 197 198 199 200 201 202 203 204 ... 209 210

Kommentare zu diesen Handbüchern

Keine Kommentare

Solac Elektrické varné konvice uživatelské příručky

Seznam produktů Solac Elektrické varné konvice obsahuje 1 uživatelské příručky pro 1 modelů. Všechny uživatelské příručky pdf jsou k dispozici ke stažení nebo prohlížení online.

Klepnutím na abecedu níže přejděte na úplný seznam modelů začínajících tímto písmenem

Modely Typ Dokumentu
KT5865
Návod k použití        Solac KT5865, 2 stránky