Updates projects for running the algorithm

This commit is contained in:
Patrick McDonagh
2018-02-01 11:47:29 -06:00
parent 89c4452292
commit efeac5e59c
19 changed files with 1207 additions and 88 deletions

Binary file not shown.

View File

@@ -0,0 +1,367 @@
/*
* File: pocAlgorithm.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/* Include Files */
#include "rt_nonfinite.h"
#include "pocAlgorithm.h"
/* Function Declarations */
static void positionLoadI(double dt, double ai, double ci, double factori,
double lengthi, double lagi, double yi, double areai, unsigned int centeri,
const double topPosArrayI[100], const double topLoadArrayI[100], double
*pumpPosition, double *pumpLoad);
static double rt_roundd_snf(double u);
/* Function Definitions */
/*
* FUNCTION PARAMETERS
* dt [seconds] = amount of time between measurements
* ai [?] = a value for the specific taper
* ci [?] = damping factor for the taper
* factori [?] = factor value for the taper
* lengthi [feet] = length of the taper
* lagi [?] = lag index of the taper
* yi [?] = youngs modulus for the taper
* (SHOULD BE 7.2 * 10^6 or 30.6 * 10^6)
* areai [in^2] = annulus area of the taper
* centeri [?] = centerpoint of the taper
* topPosArrayI [] = array of position values
* topLoadArrayI [] = array of load values
* Arguments : double dt
* double ai
* double ci
* double factori
* double lengthi
* double lagi
* double yi
* double areai
* unsigned int centeri
* const double topPosArrayI[100]
* const double topLoadArrayI[100]
* double *pumpPosition
* double *pumpLoad
* Return Type : void
*/
static void positionLoadI(double dt, double ai, double ci, double factori,
double lengthi, double lagi, double yi, double areai, unsigned int centeri,
const double topPosArrayI[100], const double topLoadArrayI[100], double
*pumpPosition, double *pumpLoad)
{
double loadBefore3;
unsigned int iBefore;
unsigned int iAfter;
double insideIntegral;
int jj;
long i0;
double loadBefore;
double loadAfter;
unsigned int qY;
unsigned int b_qY;
double loadAfter3;
/* Position and Load Function */
/* This function calculates the position and load for a given taper */
loadBefore3 = rt_roundd_snf((double)centeri - lagi);
if (loadBefore3 < 65536.0) {
if (loadBefore3 >= 0.0) {
iBefore = (unsigned int)loadBefore3;
} else {
iBefore = 0U;
}
} else if (loadBefore3 >= 65536.0) {
iBefore = MAX_uint16_T;
} else {
iBefore = 0U;
}
loadBefore3 = rt_roundd_snf((double)centeri + lagi);
if (loadBefore3 < 65536.0) {
if (loadBefore3 >= 0.0) {
iAfter = (unsigned int)loadBefore3;
} else {
iAfter = 0U;
}
} else if (loadBefore3 >= 65536.0) {
iAfter = MAX_uint16_T;
} else {
iAfter = 0U;
}
/* %% Position Calculation */
insideIntegral = 0.0;
loadBefore3 = 2.0 * lagi - 1.0;
for (jj = 0; jj < (int)loadBefore3; jj++) {
i0 = ((long)iBefore + jj) + 1L;
if (i0 < 0L) {
i0 = 0L;
} else {
if (i0 > 65535L) {
i0 = 65535L;
}
}
insideIntegral += dt / (yi * areai) * (exp(-ci * (lagi - (1.0 + (double)jj))
* dt / 2.0) * topLoadArrayI[(int)i0 - 1]);
}
insideIntegral += 0.5 * dt / (yi * areai) * (exp(-ci * lagi * dt / 2.0) *
topLoadArrayI[(int)iBefore - 1] + exp(-ci * -lagi * dt / 2.0) *
topLoadArrayI[(int)iAfter - 1]);
loadBefore = exp(-ci * lagi * dt / 2.0) * topLoadArrayI[(int)iBefore - 1] +
factori * (exp(-ci * (lagi + 1.0) * dt / 2.0) * topLoadArrayI[(int)iBefore -
2] - exp(-ci * lagi * dt / 2.0) * topLoadArrayI[(int)iBefore - 1]);
loadAfter = exp(-ci * -lagi * dt / 2.0) * topLoadArrayI[(int)iAfter - 1] +
factori * (exp(-ci * (-lagi - 1.0) * dt / 2.0) * topLoadArrayI[(int)iAfter]
- exp(-ci * -lagi * dt / 2.0) * topLoadArrayI[(int)iAfter - 1]);
insideIntegral += 0.5 * factori * dt / (yi * areai) * (loadBefore + exp(-ci *
lagi * dt / 2.0) * topLoadArrayI[(int)iBefore - 1]);
insideIntegral += 0.5 * factori * dt / (yi * areai) * (loadAfter + exp(-ci *
-lagi * dt / 2.0) * topLoadArrayI[(int)iAfter - 1]);
insideIntegral *= 0.5 * ai;
qY = iAfter + 1U;
if (qY < iAfter) {
qY = MAX_uint16_T;
}
b_qY = iBefore - 1U;
if (b_qY > iBefore) {
b_qY = 0U;
}
*pumpPosition = 0.5 * (exp(ci * lengthi / (2.0 * ai)) * (topPosArrayI[(int)
iAfter - 1] + factori * (topPosArrayI[(int)qY - 1] - topPosArrayI[(int)
iAfter - 1])) + exp(-ci * lengthi / (2.0 * ai)) * (topPosArrayI[(int)iBefore
- 1] + factori * (topPosArrayI[(int)b_qY - 1] - topPosArrayI[(int)iBefore -
1]))) + insideIntegral;
insideIntegral = 0.0;
loadBefore3 = 2.0 * lagi - 1.0;
for (jj = 0; jj < (int)loadBefore3; jj++) {
i0 = ((long)iBefore + jj) + 1L;
if (i0 < 0L) {
i0 = 0L;
} else {
if (i0 > 65535L) {
i0 = 65535L;
}
}
insideIntegral += dt * (exp(-ci * (lagi - (1.0 + (double)jj)) * dt / 2.0) *
topPosArrayI[(int)i0 - 1]);
}
insideIntegral += 0.5 * dt * (exp(-ci * lagi * dt / 2.0) * topPosArrayI[(int)
iBefore - 1] + exp(-ci * -lagi * dt / 2.0) * topPosArrayI[(int)iAfter - 1]);
loadBefore3 = exp(-ci * lagi * dt / 2.0) * topPosArrayI[(int)iBefore - 1] +
factori * (exp(-ci * (lagi + 1.0) * dt / 2.0) * topPosArrayI[(int)iBefore -
2] - exp(-ci * lagi * dt / 2.0) * topPosArrayI[(int)iBefore - 1]);
loadAfter3 = exp(-ci * -lagi * dt / 2.0) * topPosArrayI[(int)iAfter - 1] +
factori * (exp(-ci * (-lagi - 1.0) * dt / 2.0) * topPosArrayI[(int)iAfter] -
exp(-ci * -lagi * dt / 2.0) * topPosArrayI[(int)iAfter - 1]);
insideIntegral += 0.5 * factori * dt * (loadBefore3 + exp(-ci * lagi * dt /
2.0) * topPosArrayI[(int)iBefore - 1]);
insideIntegral += 0.5 * factori * dt * (loadAfter3 + exp(-ci * -lagi * dt /
2.0) * topPosArrayI[(int)iAfter - 1]);
insideIntegral *= -(ci * lengthi / 4.0) * 0.5 * (ci / (2.0 * ai));
*pumpPosition += insideIntegral;
/* %% Load Calculation */
*pumpLoad = yi * areai * (((exp(ci * lengthi / (2.0 * ai)) * ((topPosArrayI
[(int)iAfter] - topPosArrayI[(int)iAfter - 2]) / (2.0 * dt)) - exp(-ci *
lengthi / (2.0 * ai)) * ((topPosArrayI[(int)iBefore] - topPosArrayI[(int)
iBefore - 2]) / (2.0 * dt))) / (2.0 * ai) + (ci * exp(ci * lengthi / (2.0 *
ai)) * topPosArrayI[(int)iAfter - 1] - ci * exp(-ci * lengthi / (2.0 * ai)) *
topPosArrayI[(int)iBefore - 1]) / (4.0 * ai)) + (0.5 * (ai / (yi * areai)) *
(1.0 / ai) * (loadBefore + loadAfter) - ci * lengthi / 4.0 * (0.5 * (ci /
(2.0 * ai))) * (1.0 / ai) * (loadBefore3 + loadAfter3)));
}
/*
* Arguments : double u
* Return Type : double
*/
static double rt_roundd_snf(double u)
{
double y;
if (fabs(u) < 4.503599627370496E+15) {
if (u >= 0.5) {
y = floor(u + 0.5);
} else if (u > -0.5) {
y = u * 0.0;
} else {
y = ceil(u - 0.5);
}
} else {
y = u;
}
return y;
}
/*
* Arguments : double polishedRodPosition
* double lastPolishedRodPosition
* double polishedRodLoad
* double count_data[]
* int count_size[2]
* double dt
* const double a_data[]
* const int a_size[2]
* const double c_data[]
* const int c_size[2]
* const double factorArray_data[]
* const int factorArray_size[2]
* const double rodLengths_data[]
* const int rodLengths_size[2]
* const double lagIndex_data[]
* const int lagIndex_size[2]
* const double rodYMs_data[]
* const int rodYMs_size[2]
* const double area_data[]
* const int area_size[2]
* const unsigned int lengthRequired_data[]
* const int lengthRequired_size[2]
* const unsigned int centerPoint_data[]
* const int centerPoint_size[2]
* double rodWeightFluidTotal
* double stuffingBoxFriction
* const double force_data[]
* const int force_size[2]
* double topPosArray_data[]
* int topPosArray_size[2]
* double topLoadArray_data[]
* int topLoadArray_size[2]
* double *pumpPosition
* double *pumpLoad
* double *status
* Return Type : void
*/
void pocAlgorithm(double polishedRodPosition, double lastPolishedRodPosition,
double polishedRodLoad, double count_data[], int count_size[2],
double dt, const double a_data[], const int a_size[2], const
double c_data[], const int c_size[2], const double
factorArray_data[], const int factorArray_size[2], const
double rodLengths_data[], const int rodLengths_size[2], const
double lagIndex_data[], const int lagIndex_size[2], const
double rodYMs_data[], const int rodYMs_size[2], const double
area_data[], const int area_size[2], const unsigned int
lengthRequired_data[], const int lengthRequired_size[2], const
unsigned int centerPoint_data[], const int centerPoint_size[2],
double rodWeightFluidTotal, double stuffingBoxFriction, const
double force_data[], const int force_size[2], double
topPosArray_data[], int topPosArray_size[2], double
topLoadArray_data[], int topLoadArray_size[2], double
*pumpPosition, double *pumpLoad, double *status)
{
double tapersAllowed;
int varargin_2;
unsigned int ii;
int tap;
int i1;
double topPosArray[100];
double topLoadArray[100];
double position;
double load;
unsigned int qY;
(void)count_size;
(void)a_size;
(void)c_size;
(void)factorArray_size;
(void)lagIndex_size;
(void)rodYMs_size;
(void)area_size;
(void)lengthRequired_size;
(void)centerPoint_size;
(void)force_size;
/* computeLoadPositionStatus Function */
*pumpPosition = -1.0;
*pumpLoad = -1.0;
*status = -1.0;
tapersAllowed = 1.0;
varargin_2 = rodLengths_size[1];
for (ii = 2U; ii <= lengthRequired_data[0]; ii++) {
topPosArray_data[topPosArray_size[0] * ((int)ii - 2)] =
topPosArray_data[topPosArray_size[0] * ((int)ii - 1)];
topLoadArray_data[topLoadArray_size[0] * ((int)ii - 2)] =
topLoadArray_data[topLoadArray_size[0] * ((int)ii - 1)];
}
topPosArray_data[topPosArray_size[0] * ((int)lengthRequired_data[0] - 1)] =
-polishedRodPosition / 12.0;
if (polishedRodPosition > lastPolishedRodPosition) {
topLoadArray_data[topLoadArray_size[0] * ((int)lengthRequired_data[0] - 1)] =
(polishedRodLoad - rodWeightFluidTotal) - stuffingBoxFriction;
} else if (polishedRodPosition < lastPolishedRodPosition) {
topLoadArray_data[topLoadArray_size[0] * ((int)lengthRequired_data[0] - 1)] =
(polishedRodLoad - rodWeightFluidTotal) + stuffingBoxFriction;
} else {
topLoadArray_data[topLoadArray_size[0] * ((int)lengthRequired_data[0] - 1)] =
polishedRodLoad - rodWeightFluidTotal;
}
for (tap = 0; tap + 1 <= tapersAllowed; tap++) {
count_data[tap]++;
if (count_data[tap] >= lengthRequired_data[tap]) {
if (tap + 2 <= varargin_2) {
/* working our way down to the bottom of the well */
ii = lengthRequired_data[tap + 1];
qY = ii + 1U;
if (qY < ii) {
qY = MAX_uint16_T;
}
for (ii = 2U; ii <= qY; ii++) {
topPosArray_data[(tap + topPosArray_size[0] * ((int)ii - 2)) + 1] =
topPosArray_data[(tap + topPosArray_size[0] * ((int)ii - 1)) + 1];
topLoadArray_data[(tap + topLoadArray_size[0] * ((int)ii - 2)) + 1] =
topLoadArray_data[(tap + topLoadArray_size[0] * ((int)ii - 1)) + 1];
}
for (i1 = 0; i1 < 100; i1++) {
topPosArray[i1] = topPosArray_data[tap + topPosArray_size[0] * i1];
topLoadArray[i1] = topLoadArray_data[tap + topLoadArray_size[0] * i1];
}
positionLoadI(dt, a_data[tap], c_data[tap], factorArray_data[tap],
rodLengths_data[tap], lagIndex_data[tap], rodYMs_data[tap],
area_data[tap], centerPoint_data[tap], topPosArray,
topLoadArray, pumpPosition, pumpLoad);
*status = 0.0;
topPosArray_data[(tap + topPosArray_size[0] * ((int)
lengthRequired_data[tap + 1] - 1)) + 1] = *pumpPosition;
topLoadArray_data[(tap + topLoadArray_size[0] * ((int)
lengthRequired_data[tap + 1] - 1)) + 1] = *pumpLoad;
} else {
for (i1 = 0; i1 < 100; i1++) {
topPosArray[i1] = topPosArray_data[tap + topPosArray_size[0] * i1];
topLoadArray[i1] = topLoadArray_data[tap + topLoadArray_size[0] * i1];
}
positionLoadI(dt, a_data[tap], c_data[tap], factorArray_data[tap],
rodLengths_data[tap], lagIndex_data[tap], rodYMs_data[tap],
area_data[tap], centerPoint_data[tap], topPosArray,
topLoadArray, &position, &load);
*pumpPosition = -12.0 * position;
*pumpLoad = load + force_data[varargin_2 - 1];
*status = 1.0;
}
count_data[tap]--;
tapersAllowed++;
if (tapersAllowed > varargin_2) {
tapersAllowed = varargin_2;
}
}
}
}
/*
* File trailer for pocAlgorithm.c
*
* [EOF]
*/

View File

@@ -0,0 +1,39 @@
/*
* File: pocAlgorithm.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef POCALGORITHM_H
#define POCALGORITHM_H
/* Include Files */
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include "rtwtypes.h"
#include "pocAlgorithm_types.h"
/* Function Declarations */
extern void pocAlgorithm(double polishedRodPosition, double
lastPolishedRodPosition, double polishedRodLoad, double count_data[], int
count_size[2], double dt, const double a_data[], const int a_size[2], const
double c_data[], const int c_size[2], const double factorArray_data[], const
int factorArray_size[2], const double rodLengths_data[], const int
rodLengths_size[2], const double lagIndex_data[], const int lagIndex_size[2],
const double rodYMs_data[], const int rodYMs_size[2], const double area_data[],
const int area_size[2], const unsigned int lengthRequired_data[], const int
lengthRequired_size[2], const unsigned int centerPoint_data[], const int
centerPoint_size[2], double rodWeightFluidTotal, double stuffingBoxFriction,
const double force_data[], const int force_size[2], double topPosArray_data[],
int topPosArray_size[2], double topLoadArray_data[], int topLoadArray_size[2],
double *pumpPosition, double *pumpLoad, double *status);
#endif
/*
* File trailer for pocAlgorithm.h
*
* [EOF]
*/

View File

@@ -0,0 +1,28 @@
/*
* File: pocAlgorithm_initialize.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/* Include Files */
#include "rt_nonfinite.h"
#include "pocAlgorithm.h"
#include "pocAlgorithm_initialize.h"
/* Function Definitions */
/*
* Arguments : void
* Return Type : void
*/
void pocAlgorithm_initialize(void)
{
rt_InitInfAndNaN(8U);
}
/*
* File trailer for pocAlgorithm_initialize.c
*
* [EOF]
*/

View File

@@ -0,0 +1,27 @@
/*
* File: pocAlgorithm_initialize.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef POCALGORITHM_INITIALIZE_H
#define POCALGORITHM_INITIALIZE_H
/* Include Files */
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include "rtwtypes.h"
#include "pocAlgorithm_types.h"
/* Function Declarations */
extern void pocAlgorithm_initialize(void);
#endif
/*
* File trailer for pocAlgorithm_initialize.h
*
* [EOF]
*/

View File

@@ -0,0 +1,28 @@
/*
* File: pocAlgorithm_terminate.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/* Include Files */
#include "rt_nonfinite.h"
#include "pocAlgorithm.h"
#include "pocAlgorithm_terminate.h"
/* Function Definitions */
/*
* Arguments : void
* Return Type : void
*/
void pocAlgorithm_terminate(void)
{
/* (no terminate code required) */
}
/*
* File trailer for pocAlgorithm_terminate.c
*
* [EOF]
*/

View File

@@ -0,0 +1,27 @@
/*
* File: pocAlgorithm_terminate.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef POCALGORITHM_TERMINATE_H
#define POCALGORITHM_TERMINATE_H
/* Include Files */
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include "rtwtypes.h"
#include "pocAlgorithm_types.h"
/* Function Declarations */
extern void pocAlgorithm_terminate(void);
#endif
/*
* File trailer for pocAlgorithm_terminate.h
*
* [EOF]
*/

View File

@@ -0,0 +1,19 @@
/*
* File: pocAlgorithm_types.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef POCALGORITHM_TYPES_H
#define POCALGORITHM_TYPES_H
/* Include Files */
#include "rtwtypes.h"
#endif
/*
* File trailer for pocAlgorithm_types.h
*
* [EOF]
*/

141
pocAlgorithm_pkg/rtGetInf.c Normal file
View File

@@ -0,0 +1,141 @@
/*
* File: rtGetInf.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/*
* Abstract:
* MATLAB for code generation function to initialize non-finite, Inf and MinusInf
*/
#include "rtGetInf.h"
#define NumBitsPerChar 16U
/* Function: rtGetInf ==================================================
* Abstract:
* Initialize rtInf needed by the generated code.
* Inf is initialized as non-signaling. Assumes IEEE.
*/
real_T rtGetInf(void)
{
size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
real_T inf = 0.0;
if (bitsPerReal == 32U) {
inf = rtGetInfF();
} else {
uint16_T one = 1U;
enum {
LittleEndian,
BigEndian
} machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
switch (machByteOrder) {
case LittleEndian:
{
union {
LittleEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0x7FF00000U;
tmpVal.bitVal.words.wordL = 0x00000000U;
inf = tmpVal.fltVal;
break;
}
case BigEndian:
{
union {
BigEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0x7FF00000U;
tmpVal.bitVal.words.wordL = 0x00000000U;
inf = tmpVal.fltVal;
break;
}
}
}
return inf;
}
/* Function: rtGetInfF ==================================================
* Abstract:
* Initialize rtInfF needed by the generated code.
* Inf is initialized as non-signaling. Assumes IEEE.
*/
real32_T rtGetInfF(void)
{
IEEESingle infF;
infF.wordL.wordLuint = 0x7F800000U;
return infF.wordL.wordLreal;
}
/* Function: rtGetMinusInf ==================================================
* Abstract:
* Initialize rtMinusInf needed by the generated code.
* Inf is initialized as non-signaling. Assumes IEEE.
*/
real_T rtGetMinusInf(void)
{
size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
real_T minf = 0.0;
if (bitsPerReal == 32U) {
minf = rtGetMinusInfF();
} else {
uint16_T one = 1U;
enum {
LittleEndian,
BigEndian
} machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
switch (machByteOrder) {
case LittleEndian:
{
union {
LittleEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0xFFF00000U;
tmpVal.bitVal.words.wordL = 0x00000000U;
minf = tmpVal.fltVal;
break;
}
case BigEndian:
{
union {
BigEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0xFFF00000U;
tmpVal.bitVal.words.wordL = 0x00000000U;
minf = tmpVal.fltVal;
break;
}
}
}
return minf;
}
/* Function: rtGetMinusInfF ==================================================
* Abstract:
* Initialize rtMinusInfF needed by the generated code.
* Inf is initialized as non-signaling. Assumes IEEE.
*/
real32_T rtGetMinusInfF(void)
{
IEEESingle minfF;
minfF.wordL.wordLuint = 0xFF800000U;
return minfF.wordL.wordLreal;
}
/*
* File trailer for rtGetInf.c
*
* [EOF]
*/

View File

@@ -0,0 +1,25 @@
/*
* File: rtGetInf.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef RTGETINF_H
#define RTGETINF_H
#include <stddef.h>
#include "rtwtypes.h"
#include "rt_nonfinite.h"
extern real_T rtGetInf(void);
extern real32_T rtGetInfF(void);
extern real_T rtGetMinusInf(void);
extern real32_T rtGetMinusInfF(void);
#endif
/*
* File trailer for rtGetInf.h
*
* [EOF]
*/

View File

@@ -0,0 +1,99 @@
/*
* File: rtGetNaN.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/*
* Abstract:
* MATLAB for code generation function to initialize non-finite, NaN
*/
#include "rtGetNaN.h"
#define NumBitsPerChar 16U
/* Function: rtGetNaN ==================================================
* Abstract:
* Initialize rtNaN needed by the generated code.
* NaN is initialized as non-signaling. Assumes IEEE.
*/
real_T rtGetNaN(void)
{
size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
real_T nan = 0.0;
if (bitsPerReal == 32U) {
nan = rtGetNaNF();
} else {
uint16_T one = 1U;
enum {
LittleEndian,
BigEndian
} machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
switch (machByteOrder) {
case LittleEndian:
{
union {
LittleEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0xFFF80000U;
tmpVal.bitVal.words.wordL = 0x00000000U;
nan = tmpVal.fltVal;
break;
}
case BigEndian:
{
union {
BigEndianIEEEDouble bitVal;
real_T fltVal;
} tmpVal;
tmpVal.bitVal.words.wordH = 0x7FFFFFFFU;
tmpVal.bitVal.words.wordL = 0xFFFFFFFFU;
nan = tmpVal.fltVal;
break;
}
}
}
return nan;
}
/* Function: rtGetNaNF ==================================================
* Abstract:
* Initialize rtNaNF needed by the generated code.
* NaN is initialized as non-signaling. Assumes IEEE.
*/
real32_T rtGetNaNF(void)
{
IEEESingle nanF = { { 0 } };
uint16_T one = 1U;
enum {
LittleEndian,
BigEndian
} machByteOrder = (*((uint8_T *) &one) == 1U) ? LittleEndian : BigEndian;
switch (machByteOrder) {
case LittleEndian:
{
nanF.wordL.wordLuint = 0xFFC00000U;
break;
}
case BigEndian:
{
nanF.wordL.wordLuint = 0x7FFFFFFFU;
break;
}
}
return nanF.wordL.wordLreal;
}
/*
* File trailer for rtGetNaN.c
*
* [EOF]
*/

View File

@@ -0,0 +1,23 @@
/*
* File: rtGetNaN.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef RTGETNAN_H
#define RTGETNAN_H
#include <stddef.h>
#include "rtwtypes.h"
#include "rt_nonfinite.h"
extern real_T rtGetNaN(void);
extern real32_T rtGetNaNF(void);
#endif
/*
* File trailer for rtGetNaN.h
*
* [EOF]
*/

View File

@@ -0,0 +1,100 @@
/*
* File: rt_nonfinite.c
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
/*
* Abstract:
* MATLAB for code generation function to initialize non-finites,
* (Inf, NaN and -Inf).
*/
#include "rt_nonfinite.h"
#include "rtGetNaN.h"
#include "rtGetInf.h"
real_T rtInf;
real_T rtMinusInf;
real_T rtNaN;
real32_T rtInfF;
real32_T rtMinusInfF;
real32_T rtNaNF;
/* Function: rt_InitInfAndNaN ==================================================
* Abstract:
* Initialize the rtInf, rtMinusInf, and rtNaN needed by the
* generated code. NaN is initialized as non-signaling. Assumes IEEE.
*/
void rt_InitInfAndNaN(size_t realSize)
{
(void) (realSize);
rtNaN = rtGetNaN();
rtNaNF = rtGetNaNF();
rtInf = rtGetInf();
rtInfF = rtGetInfF();
rtMinusInf = rtGetMinusInf();
rtMinusInfF = rtGetMinusInfF();
}
/* Function: rtIsInf ==================================================
* Abstract:
* Test if value is infinite
*/
boolean_T rtIsInf(real_T value)
{
return ((value==rtInf || value==rtMinusInf) ? 1U : 0U);
}
/* Function: rtIsInfF =================================================
* Abstract:
* Test if single-precision value is infinite
*/
boolean_T rtIsInfF(real32_T value)
{
return(((value)==rtInfF || (value)==rtMinusInfF) ? 1U : 0U);
}
/* Function: rtIsNaN ==================================================
* Abstract:
* Test if value is not a number
*/
boolean_T rtIsNaN(real_T value)
{
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
return _isnan(value)? TRUE:FALSE;
#else
return (value!=value)? 1U:0U;
#endif
}
/* Function: rtIsNaNF =================================================
* Abstract:
* Test if single-precision value is not a number
*/
boolean_T rtIsNaNF(real32_T value)
{
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
return _isnan((real_T)value)? true:false;
#else
return (value!=value)? 1U:0U;
#endif
}
/*
* File trailer for rt_nonfinite.c
*
* [EOF]
*/

View File

@@ -0,0 +1,55 @@
/*
* File: rt_nonfinite.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef RT_NONFINITE_H
#define RT_NONFINITE_H
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
#include <float.h>
#endif
#include <stddef.h>
#include "rtwtypes.h"
extern real_T rtInf;
extern real_T rtMinusInf;
extern real_T rtNaN;
extern real32_T rtInfF;
extern real32_T rtMinusInfF;
extern real32_T rtNaNF;
extern void rt_InitInfAndNaN(size_t realSize);
extern boolean_T rtIsInf(real_T value);
extern boolean_T rtIsInfF(real32_T value);
extern boolean_T rtIsNaN(real_T value);
extern boolean_T rtIsNaNF(real32_T value);
typedef struct {
struct {
uint32_T wordH;
uint32_T wordL;
} words;
} BigEndianIEEEDouble;
typedef struct {
struct {
uint32_T wordL;
uint32_T wordH;
} words;
} LittleEndianIEEEDouble;
typedef struct {
union {
real32_T wordLreal;
uint32_T wordLuint;
} wordL;
} IEEESingle;
#endif
/*
* File trailer for rt_nonfinite.h
*
* [EOF]
*/

View File

@@ -0,0 +1 @@
Code generation project for pocAlgorithm using toolchain "Clang v3.1 | gmake (64-bit Mac)". MATLAB root = /Applications/MATLAB_R2017a.app.

134
pocAlgorithm_pkg/rtwtypes.h Normal file
View File

@@ -0,0 +1,134 @@
/*
* File: rtwtypes.h
*
* MATLAB Coder version : 3.3
* C/C++ source code generated on : 06-Sep-2017 14:43:17
*/
#ifndef RTWTYPES_H
#define RTWTYPES_H
#ifndef __TMWTYPES__
#define __TMWTYPES__
/*=======================================================================*
* Target hardware information
* Device type: Texas Instruments->C2000
* Number of bits: char: 16 short: 16 int: 16
* long: 32
* native word size: 16
* Byte ordering: LittleEndian
* Signed integer division rounds to: Zero
* Shift right on a signed integer as arithmetic shift: on
*=======================================================================*/
/*=======================================================================*
* Fixed width word size data types: *
* int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
* uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
* real32_T, real64_T - 32 and 64 bit floating point numbers *
*=======================================================================*/
typedef int int8_T;
typedef unsigned int uint8_T;
typedef int int16_T;
typedef unsigned int uint16_T;
typedef long int32_T;
typedef unsigned long uint32_T;
typedef float real32_T;
typedef double real64_T;
/*===========================================================================*
* Generic type definitions: real_T, time_T, boolean_T, int_T, uint_T, *
* ulong_T, char_T and byte_T. *
*===========================================================================*/
typedef double real_T;
typedef double time_T;
typedef unsigned int boolean_T;
typedef int int_T;
typedef unsigned int uint_T;
typedef unsigned long ulong_T;
typedef char char_T;
typedef char_T byte_T;
/*===========================================================================*
* Complex number type definitions *
*===========================================================================*/
#define CREAL_T
typedef struct {
real32_T re;
real32_T im;
} creal32_T;
typedef struct {
real64_T re;
real64_T im;
} creal64_T;
typedef struct {
real_T re;
real_T im;
} creal_T;
typedef struct {
int16_T re;
int16_T im;
} cint16_T;
typedef struct {
uint16_T re;
uint16_T im;
} cuint16_T;
typedef struct {
int32_T re;
int32_T im;
} cint32_T;
typedef struct {
uint32_T re;
uint32_T im;
} cuint32_T;
/*=======================================================================*
* Min and Max: *
* int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers *
* uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers *
*=======================================================================*/
#define MAX_int8_T ((int8_T)(127))
#define MIN_int8_T ((int8_T)(-128))
#define MAX_uint8_T ((uint8_T)(255))
#define MIN_uint8_T ((uint8_T)(0))
#define MAX_int16_T ((int16_T)(32767))
#define MIN_int16_T ((int16_T)(-32768))
#define MAX_uint16_T ((uint16_T)(65535))
#define MIN_uint16_T ((uint16_T)(0))
#define MAX_int32_T ((int32_T)(2147483647))
#define MIN_int32_T ((int32_T)(-2147483647-1))
#define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU))
#define MIN_uint32_T ((uint32_T)(0))
/* Logical type definitions */
#if !defined(__cplusplus) && !defined(__true_false_are_keywords)
# ifndef false
# define false (0U)
# endif
# ifndef true
# define true (1U)
# endif
#endif
/*
* Maximum length of a MATLAB identifier (function/variable)
* including the null-termination character. Referenced by
* rt_logging.c and rt_matrx.c.
*/
#define TMW_NAME_LENGTH_MAX 64
#endif
#endif
/*
* File trailer for rtwtypes.h
*
* [EOF]
*/