update gencode
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
#ifndef RTSPLNTYPES_H
|
||||||
|
#define RTSPLNTYPES_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File: rtsplntypes.h
|
||||||
|
*
|
||||||
|
* Abstract:
|
||||||
|
*
|
||||||
|
* Typedefs for spline lookup table algorithms.
|
||||||
|
*
|
||||||
|
* Copyright 1994-2007 The MathWorks, Inc.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
|
||||||
|
/***************************************************************
|
||||||
|
* n-D Table Work Data Structures *
|
||||||
|
***************************************************************/
|
||||||
|
|
||||||
|
typedef struct rt_LUTnWork_tag
|
||||||
|
{
|
||||||
|
const uint32_T *m_dimSizes;
|
||||||
|
void *m_tableData;
|
||||||
|
void **m_bpDataSet;
|
||||||
|
uint32_T *m_bpIndex;
|
||||||
|
void *m_bpLambda;
|
||||||
|
const uint32_T *m_maxIndex;
|
||||||
|
} rt_LUTnWork;
|
||||||
|
|
||||||
|
typedef struct rt_LUTSplineWork_tag
|
||||||
|
{
|
||||||
|
rt_LUTnWork *m_TWork;
|
||||||
|
void *m_yyA;
|
||||||
|
void *m_yyB;
|
||||||
|
void *m_yy2;
|
||||||
|
void *m_up;
|
||||||
|
void *m_y2;
|
||||||
|
const uint32_T *m_numYWorkElts;
|
||||||
|
uint8_T *m_reCalc;
|
||||||
|
void *m_preBp0AndTable;
|
||||||
|
} rt_LUTSplineWork;
|
||||||
|
|
||||||
|
#endif /* RTSPLNTYPES_H */
|
||||||
Binary file not shown.
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Model version : 1.1833
|
* Model version : 1.1833
|
||||||
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
* C/C++ source code generated on : Thu Nov 25 16:43:34 2021
|
* C/C++ source code generated on : Fri Nov 26 15:01:05 2021
|
||||||
*
|
*
|
||||||
* Target selection: ert_shrlib.tlc
|
* Target selection: ert_shrlib.tlc
|
||||||
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
* Embedded hardware selection: Intel->x86-64 (Windows64)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
|||||||
|
/*
|
||||||
|
* File: intrp_NSplcd.c
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include "rt_Spline2Derivd.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
#include "intrp_NSplcd.h"
|
||||||
|
|
||||||
|
/* n-D natural spline calculation function */
|
||||||
|
real_T intrp_NSplcd(uint32_T numDims, const rt_LUTSplineWork * const splWork,
|
||||||
|
uint32_T extrapMethod)
|
||||||
|
{
|
||||||
|
uint32_T il;
|
||||||
|
uint32_T iu, k, i;
|
||||||
|
real_T h, s, p, smsq, pmsq;
|
||||||
|
|
||||||
|
/* intermediate results work areas "this" and "next" */
|
||||||
|
const rt_LUTnWork *TWork_interp = (const rt_LUTnWork *)splWork->m_TWork;
|
||||||
|
const real_T *fraction = (real_T *) TWork_interp->m_bpLambda;
|
||||||
|
const real_T *yp = (real_T *) TWork_interp->m_tableData;
|
||||||
|
real_T *yyA = (real_T *) splWork->m_yyA;
|
||||||
|
real_T *yyB = (real_T *) splWork->m_yyB;
|
||||||
|
real_T *yy2 = (real_T *) splWork->m_yy2;
|
||||||
|
real_T *up = (real_T *) splWork->m_up;
|
||||||
|
real_T *y2 = (real_T *) splWork->m_y2;
|
||||||
|
uint8_T* reCalc = splWork->m_reCalc;
|
||||||
|
real_T *dp = (real_T *) splWork->m_preBp0AndTable;
|
||||||
|
const real_T **bpDataSet = (const real_T **) TWork_interp->m_bpDataSet;
|
||||||
|
const real_T *xp = bpDataSet[0U];
|
||||||
|
real_T *yy = yyA;
|
||||||
|
uint32_T bufBank = 0U;
|
||||||
|
uint32_T len = TWork_interp->m_maxIndex[0U] + 1U;
|
||||||
|
|
||||||
|
/* compare bp0 and table to see whether they get changed */
|
||||||
|
{
|
||||||
|
/* compare the bp0 data */
|
||||||
|
if (memcmp(dp, xp,
|
||||||
|
len * sizeof(real_T)) != 0) {
|
||||||
|
*reCalc = 1;
|
||||||
|
(void) memcpy(dp, xp,
|
||||||
|
len * sizeof(real_T));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compare the table data */
|
||||||
|
dp = &(dp[len]);
|
||||||
|
if (memcmp(dp, yp,
|
||||||
|
len * splWork->m_numYWorkElts[0U] * sizeof(real_T)) != 0) {
|
||||||
|
*reCalc = 1;
|
||||||
|
(void) memcpy(dp, yp,
|
||||||
|
len * splWork->m_numYWorkElts[0U] * sizeof(real_T));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*reCalc == 1) {
|
||||||
|
/* If table and bps are tunable calculate 1st dim 2nd deriv */
|
||||||
|
/* Generate first dimension's second derivatives */
|
||||||
|
for (i = 0U; i < splWork->m_numYWorkElts[0U]; i++) {
|
||||||
|
rt_Spline2Derivd(xp, yp, len, up, y2);
|
||||||
|
yp = &yp[len];
|
||||||
|
y2 = &y2[len];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set pointers back to beginning */
|
||||||
|
yp = (const real_T *) TWork_interp->m_tableData;
|
||||||
|
y2 = (real_T *) splWork->m_y2;
|
||||||
|
}
|
||||||
|
|
||||||
|
*reCalc = 0;
|
||||||
|
|
||||||
|
/* Generate at-point splines in each dimension */
|
||||||
|
for (k = 0U; k < numDims; k++ ) {
|
||||||
|
/* this dimension's input setup */
|
||||||
|
xp = bpDataSet[k];
|
||||||
|
len = TWork_interp->m_maxIndex[k] + 1U;
|
||||||
|
il = TWork_interp->m_bpIndex[k];
|
||||||
|
iu = il + 1U;
|
||||||
|
h = xp[iu] - xp[il];
|
||||||
|
p = fraction[k];
|
||||||
|
s = 1.0 - p;
|
||||||
|
pmsq = p * ((p*p) - 1.0);
|
||||||
|
smsq = s * ((s*s) - 1.0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Calculate spline curves for input in this
|
||||||
|
* dimension at each value of the higher
|
||||||
|
* other dimensions\' points in the table.
|
||||||
|
*/
|
||||||
|
if ((p > 1.0) && (extrapMethod == 2U) ) {
|
||||||
|
real_T slope;
|
||||||
|
for (i = 0U; i < splWork->m_numYWorkElts[k]; i++) {
|
||||||
|
slope = (yp[iu] - yp[il]) + ((y2[il]*h*h)*(1.0/6.0));
|
||||||
|
yy[i] = yp[iu] + (slope * (p-1.0));
|
||||||
|
yp = &yp[len];
|
||||||
|
y2 = &y2[len];
|
||||||
|
}
|
||||||
|
} else if ((p < 0.0) && (extrapMethod == 2U) ) {
|
||||||
|
real_T slope;
|
||||||
|
for (i = 0U; i < splWork->m_numYWorkElts[k]; i++) {
|
||||||
|
slope = (yp[iu] - yp[il]) - ((y2[iu]*h*h)*(1.0/6.0));
|
||||||
|
yy[i] = yp[il] + (slope * p);
|
||||||
|
yp = &yp[len];
|
||||||
|
y2 = &y2[len];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0U; i < splWork->m_numYWorkElts[k]; i++) {
|
||||||
|
yy[i] = yp[il] + p * (yp[iu] - yp[il]) +
|
||||||
|
((smsq * y2[il] + pmsq * y2[iu])*h*h)*(1.0/6.0);
|
||||||
|
yp = &yp[len];
|
||||||
|
y2 = &y2[len];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set pointers to new result and calculate second derivatives */
|
||||||
|
yp = yy;
|
||||||
|
y2 = yy2;
|
||||||
|
if (splWork->m_numYWorkElts[k+1U] > 0U ) {
|
||||||
|
uint32_T nextLen = TWork_interp->m_maxIndex[k+1U] + 1U;
|
||||||
|
const real_T *nextXp = bpDataSet[k+1U];
|
||||||
|
for (i = 0U; i < splWork->m_numYWorkElts[k+1U]; i++) {
|
||||||
|
rt_Spline2Derivd(nextXp, yp, nextLen, up, y2);
|
||||||
|
yp = &yp[nextLen];
|
||||||
|
y2 = &y2[nextLen];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set work vectors yp, y2 and yy for next iteration;
|
||||||
|
* the yy just calculated becomes the yp in the
|
||||||
|
* next iteration, y2 was just calculated for these
|
||||||
|
* new points and the yy buffer is swapped to the space
|
||||||
|
* for storing the next iteration\'s results.
|
||||||
|
*/
|
||||||
|
yp = yy;
|
||||||
|
y2 = yy2;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Swap buffers for next dimension and
|
||||||
|
* toggle bufBank for next iteration.
|
||||||
|
*/
|
||||||
|
if (bufBank == 0U) {
|
||||||
|
yy = yyA;
|
||||||
|
bufBank = 1U;
|
||||||
|
} else {
|
||||||
|
yy = yyB;
|
||||||
|
bufBank = 0U;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( yp[0U] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* File: intrp_NSplcd.h
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_intrp_NSplcd
|
||||||
|
#define SHARE_intrp_NSplcd
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
|
||||||
|
real_T intrp_NSplcd(uint32_T numDims, const rt_LUTSplineWork * const splWork,
|
||||||
|
uint32_T extrapMethod);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* File: linsearch_u32d.c
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "linsearch_u32d.h"
|
||||||
|
|
||||||
|
uint32_T linsearch_u32d(real_T u, const real_T bp[], uint32_T startIndex)
|
||||||
|
{
|
||||||
|
uint32_T bpIndex;
|
||||||
|
|
||||||
|
/* Linear Search */
|
||||||
|
for (bpIndex = startIndex; u < bp[bpIndex]; bpIndex--) {
|
||||||
|
}
|
||||||
|
|
||||||
|
while (u >= bp[bpIndex + 1U]) {
|
||||||
|
bpIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bpIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* File: linsearch_u32d.h
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_linsearch_u32d
|
||||||
|
#define SHARE_linsearch_u32d
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
|
||||||
|
extern uint32_T linsearch_u32d(real_T u, const real_T bp[], uint32_T startIndex);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* File: look_SplNLinSScd.c
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "plook_linxp.h"
|
||||||
|
#include "intrp_NSplcd.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
#include "look_SplNLinSScd.h"
|
||||||
|
|
||||||
|
/* n-D Spline interpolation function */
|
||||||
|
real_T look_SplNLinSScd(uint32_T numDims, const real_T* u, const
|
||||||
|
rt_LUTSplineWork * const SWork)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* n-D column-major table lookup operating on real_T with:
|
||||||
|
* - Spline interpolation
|
||||||
|
* - Spline extrapolation
|
||||||
|
* - Linear breakpoint search
|
||||||
|
* - Uses previous index search result
|
||||||
|
*/
|
||||||
|
rt_LUTnWork * const TWork_look = SWork->m_TWork;
|
||||||
|
real_T* const fraction = (real_T*) TWork_look->m_bpLambda;
|
||||||
|
uint32_T* const bpIdx = TWork_look->m_bpIndex;
|
||||||
|
const uint32_T* const maxIndex = TWork_look->m_maxIndex;
|
||||||
|
uint32_T k;
|
||||||
|
for (k = 0U; k < numDims; k++) {
|
||||||
|
const real_T* const bpData = ((const real_T * const *)
|
||||||
|
TWork_look->m_bpDataSet)[k];
|
||||||
|
bpIdx[k] = plook_linxp(u[k], &bpData[0], maxIndex[k], &fraction[k], &bpIdx[k]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(intrp_NSplcd(numDims, SWork, 3U));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* File: look_SplNLinSScd.h
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_look_SplNLinSScd
|
||||||
|
#define SHARE_look_SplNLinSScd
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
|
||||||
|
real_T look_SplNLinSScd(uint32_T numDims, const real_T* u, const
|
||||||
|
rt_LUTSplineWork * const SWork);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* File: plook_linxp.c
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "linsearch_u32d.h"
|
||||||
|
#include "plook_linxp.h"
|
||||||
|
|
||||||
|
uint32_T plook_linxp(real_T u, const real_T bp[], uint32_T maxIndex, real_T
|
||||||
|
*fraction, uint32_T *prevIndex)
|
||||||
|
{
|
||||||
|
uint32_T bpIndex;
|
||||||
|
uint32_T startIndex;
|
||||||
|
|
||||||
|
/* Prelookup - Index and Fraction
|
||||||
|
Index Search method: 'linear'
|
||||||
|
Extrapolation method: 'Linear'
|
||||||
|
Use previous index: 'on'
|
||||||
|
Use last breakpoint for index at or above upper limit: 'off'
|
||||||
|
Remove protection against out-of-range input in generated code: 'off'
|
||||||
|
*/
|
||||||
|
if (u <= bp[0U]) {
|
||||||
|
bpIndex = 0U;
|
||||||
|
*fraction = (u - bp[0U]) / (bp[1U] - bp[0U]);
|
||||||
|
} else if (u < bp[maxIndex]) {
|
||||||
|
startIndex = *prevIndex;
|
||||||
|
bpIndex = linsearch_u32d(u, bp, startIndex);
|
||||||
|
*fraction = (u - bp[bpIndex]) / (bp[bpIndex + 1U] - bp[bpIndex]);
|
||||||
|
} else {
|
||||||
|
bpIndex = maxIndex - 1U;
|
||||||
|
*fraction = (u - bp[maxIndex - 1U]) / (bp[maxIndex] - bp[maxIndex - 1U]);
|
||||||
|
}
|
||||||
|
|
||||||
|
*prevIndex = bpIndex;
|
||||||
|
return bpIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* File: plook_linxp.h
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_plook_linxp
|
||||||
|
#define SHARE_plook_linxp
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
|
||||||
|
extern uint32_T plook_linxp(real_T u, const real_T bp[], uint32_T maxIndex,
|
||||||
|
real_T *fraction, uint32_T *prevIndex);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* File: rt_Spline2Derivd.c
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
#include "rt_Spline2Derivd.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Second derivative initialization function for spline
|
||||||
|
* for last dimension.
|
||||||
|
*/
|
||||||
|
void rt_Spline2Derivd(const real_T *x, const real_T *y, uint32_T n, real_T *u,
|
||||||
|
real_T *y2)
|
||||||
|
{
|
||||||
|
real_T p, qn, sig, un;
|
||||||
|
uint32_T n1, i, k;
|
||||||
|
n1 = n - 1U;
|
||||||
|
y2[0U] = 0.0;
|
||||||
|
u[0U] = 0.0;
|
||||||
|
for (i = 1U; i < n1; i++) {
|
||||||
|
real_T dxm1 = x[i] - x[i - 1U];
|
||||||
|
real_T dxp1 = x[i + 1U] - x[i];
|
||||||
|
real_T dxpm = dxp1 + dxm1;
|
||||||
|
sig = dxm1 / dxpm;
|
||||||
|
p = (sig * y2[i - 1U]) + 2.0;
|
||||||
|
y2[i] = (sig - 1.0) / p;
|
||||||
|
u[i] = ((y[i + 1U] - y[i]) / dxp1) - ((y[i] - y[i - 1U]) / dxm1);
|
||||||
|
u[i] = (((6.0 * u[i]) / dxpm) - (sig * u[i - 1U])) / p;
|
||||||
|
}
|
||||||
|
|
||||||
|
qn = 0.0;
|
||||||
|
un = 0.0;
|
||||||
|
y2[n1] = (un - (qn * u[n1 - 1U])) / ((qn * y2[n1 - 1U]) + 1.0);
|
||||||
|
for (k = n1; k > 0U; k--) {
|
||||||
|
y2[k-1U] = (y2[k-1U] * y2[k]) + u[k-1U];
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* File: rt_Spline2Derivd.h
|
||||||
|
*
|
||||||
|
* Code generated for Simulink model 'cr929_SIL'.
|
||||||
|
*
|
||||||
|
* Model version : 1.1837
|
||||||
|
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
|
||||||
|
* C/C++ source code generated on : Fri Nov 26 10:04:49 2021
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_rt_Spline2Derivd
|
||||||
|
#define SHARE_rt_Spline2Derivd
|
||||||
|
#include "rtwtypes.h"
|
||||||
|
#include "rtsplntypes.h"
|
||||||
|
|
||||||
|
void rt_Spline2Derivd(const real_T *x, const real_T *y, uint32_T n, real_T *u,
|
||||||
|
real_T *y2);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* File trailer for generated code.
|
||||||
|
*
|
||||||
|
* [EOF]
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user