diff --git a/algorithm.prj b/algorithm.prj index 2d8a26c..8f7bf67 100644 --- a/algorithm.prj +++ b/algorithm.prj @@ -937,7 +937,7 @@ false false false - 10.12.6 + 10.13.1 false true maci64 diff --git a/pocAlgorithm.prj b/pocAlgorithm.prj index de17b7a..7a394b1 100644 --- a/pocAlgorithm.prj +++ b/pocAlgorithm.prj @@ -1,7 +1,7 @@ - + - false + false option.WorkingFolder.Project @@ -54,7 +54,7 @@ option.ConstantInputs.CheckValues true false - false + true @@ -179,51 +179,51 @@ Automatically locate an installed toolchain Faster Builds - true + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ctdata><configuredHardware/></ctdata> option.target.TargetType.Custom - Texas Instruments - C2000 + ARM Compatible + ARM 10 true - 16 + 8 16 - 16 + 32 32 64 32 64 - 16 + 32 32 32 32 option.HardwareEndianness.Little true false - option.HardwareAtomicIntegerSize.Int - option.HardwareAtomicFloatSize.None + option.HardwareAtomicIntegerSize.Long + option.HardwareAtomicFloatSize.Float option.HardwareDivisionRounding.Zero - Texas Instruments - C2000 + ARM Compatible + ARM 10 false - 16 + 8 16 - 16 + 32 32 64 32 64 - 16 + 32 32 32 32 option.HardwareEndianness.Little true false - option.HardwareAtomicIntegerSize.Int - option.HardwareAtomicFloatSize.None + option.HardwareAtomicIntegerSize.Long + option.HardwareAtomicFloatSize.Float option.HardwareDivisionRounding.Zero option.CastingMode.Nominal option.IndentStyle.K&R @@ -235,12 +235,12 @@ option.GenerateExampleMain.GenerateCodeOnly option.PreserveVariableNames.None option.TargetLang.C - option.CCompilerOptimization.Off + true false - make_rtw - default_tmf + + 10 200 @@ -322,30 +322,34 @@ + + + - + + + - @@ -721,19 +725,19 @@ option.objective.c - workflowSummary + generateCode barneyWellTest - config - false - false - column + + + + option.UseGlobals.No - ${PROJECT_ROOT}/codegen/lib/pocAlgorithm/pocAlgorithm.a - R2012a + ${PROJECT_ROOT}\codegen\lib\pocAlgorithm\pocAlgorithm.lib + true - true + @@ -743,11 +747,11 @@ true - false - false - 1024 - 2048 - false + + + + + true 2565199857 @@ -762,34 +766,34 @@ codegen/mex/pocAlgorithm 2604771377 barneyWellTest - false + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><checksum><includedFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/pocAlgorithm.m</file></includedFiles><value>4064048825</value></checksum> - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/pocAlgorithm.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>\\Mac\Home\GitHub\Henry-Pump\POC-MatLab\pocAlgorithm.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> false false true pocAlgorithm_mex pocAlgorithm option.target.artifact.lib - ${PROJECT_ROOT}/codegen/lib/pocAlgorithm/pocAlgorithm.a + ${PROJECT_ROOT}\codegen\lib\pocAlgorithm\pocAlgorithm.lib true false option.FixedPointMode.None - false + - 16 - 4 - 0 - fimath('RoundingMethod', 'Floor', 'OverflowAction', 'Wrap', 'ProductMode', 'FullPrecision', 'MaxProductWordLength', 128, 'SumMode', 'FullPrecision', 'MaxSumWordLength', 128) - option.FixedPointTypeSource.SimAndDerived + + + + + - false - false - false - false - true + + + + + @@ -798,16 +802,16 @@ - true - false + + _fixpt - false - false - option.DefaultFixedPointSignedness.Automatic - option.FixedPointTypeProposalMode.ProposeFractionLengths - false - option.fixedPointAction.none + + + + + + @@ -815,9 +819,9 @@ - false - option.FixedPointAnalysisMode.Sim - false + + + @@ -896,15 +900,15 @@ - + 1504726901447 - ${PROJECT_ROOT}/barneyWellTest.mlx + ${PROJECT_ROOT}\barneyWellTest.mlx - + @@ -963,11 +967,11 @@ - /Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/codegen/lib/pocAlgorithm/pocAlgorithm.a + \\Mac\Home\GitHub\Henry-Pump\POC-MatLab\codegen\lib\pocAlgorithm\pocAlgorithm.lib - /Applications/MATLAB_R2017a.app + C:\Program Files\MATLAB\R2017a @@ -984,18 +988,18 @@ - true - true - false + false + false + true false false false false false - 10.12.6 + 6.2 false true - maci64 + win64 true diff --git a/pocAlgorithm_pkg/buildInfo.mat b/pocAlgorithm_pkg/buildInfo.mat new file mode 100644 index 0000000..b85d4c6 Binary files /dev/null and b/pocAlgorithm_pkg/buildInfo.mat differ diff --git a/pocAlgorithm_pkg/pocAlgorithm.c b/pocAlgorithm_pkg/pocAlgorithm.c new file mode 100644 index 0000000..947d5ad --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm.h b/pocAlgorithm_pkg/pocAlgorithm.h new file mode 100644 index 0000000..e7a587b --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm.h @@ -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 +#include +#include +#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] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm_initialize.c b/pocAlgorithm_pkg/pocAlgorithm_initialize.c new file mode 100644 index 0000000..03b4542 --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm_initialize.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm_initialize.h b/pocAlgorithm_pkg/pocAlgorithm_initialize.h new file mode 100644 index 0000000..9691796 --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm_initialize.h @@ -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 +#include +#include +#include "rtwtypes.h" +#include "pocAlgorithm_types.h" + +/* Function Declarations */ +extern void pocAlgorithm_initialize(void); + +#endif + +/* + * File trailer for pocAlgorithm_initialize.h + * + * [EOF] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm_terminate.c b/pocAlgorithm_pkg/pocAlgorithm_terminate.c new file mode 100644 index 0000000..f4419f8 --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm_terminate.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm_terminate.h b/pocAlgorithm_pkg/pocAlgorithm_terminate.h new file mode 100644 index 0000000..3f1d3c7 --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm_terminate.h @@ -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 +#include +#include +#include "rtwtypes.h" +#include "pocAlgorithm_types.h" + +/* Function Declarations */ +extern void pocAlgorithm_terminate(void); + +#endif + +/* + * File trailer for pocAlgorithm_terminate.h + * + * [EOF] + */ diff --git a/pocAlgorithm_pkg/pocAlgorithm_types.h b/pocAlgorithm_pkg/pocAlgorithm_types.h new file mode 100644 index 0000000..4d145c9 --- /dev/null +++ b/pocAlgorithm_pkg/pocAlgorithm_types.h @@ -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] + */ diff --git a/pocAlgorithm_pkg/rtGetInf.c b/pocAlgorithm_pkg/rtGetInf.c new file mode 100644 index 0000000..521b96c --- /dev/null +++ b/pocAlgorithm_pkg/rtGetInf.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/rtGetInf.h b/pocAlgorithm_pkg/rtGetInf.h new file mode 100644 index 0000000..8c4db2c --- /dev/null +++ b/pocAlgorithm_pkg/rtGetInf.h @@ -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 +#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] + */ diff --git a/pocAlgorithm_pkg/rtGetNaN.c b/pocAlgorithm_pkg/rtGetNaN.c new file mode 100644 index 0000000..97838a3 --- /dev/null +++ b/pocAlgorithm_pkg/rtGetNaN.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/rtGetNaN.h b/pocAlgorithm_pkg/rtGetNaN.h new file mode 100644 index 0000000..440436b --- /dev/null +++ b/pocAlgorithm_pkg/rtGetNaN.h @@ -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 +#include "rtwtypes.h" +#include "rt_nonfinite.h" + +extern real_T rtGetNaN(void); +extern real32_T rtGetNaNF(void); + +#endif + +/* + * File trailer for rtGetNaN.h + * + * [EOF] + */ diff --git a/pocAlgorithm_pkg/rt_nonfinite.c b/pocAlgorithm_pkg/rt_nonfinite.c new file mode 100644 index 0000000..ab75d36 --- /dev/null +++ b/pocAlgorithm_pkg/rt_nonfinite.c @@ -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] + */ diff --git a/pocAlgorithm_pkg/rt_nonfinite.h b/pocAlgorithm_pkg/rt_nonfinite.h new file mode 100644 index 0000000..9df00a9 --- /dev/null +++ b/pocAlgorithm_pkg/rt_nonfinite.h @@ -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 +#endif + +#include +#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] + */ diff --git a/pocAlgorithm_pkg/rtw_proj.tmw b/pocAlgorithm_pkg/rtw_proj.tmw new file mode 100644 index 0000000..c430ae5 --- /dev/null +++ b/pocAlgorithm_pkg/rtw_proj.tmw @@ -0,0 +1 @@ +Code generation project for pocAlgorithm using toolchain "Clang v3.1 | gmake (64-bit Mac)". MATLAB root = /Applications/MATLAB_R2017a.app. diff --git a/pocAlgorithm_pkg/rtwtypes.h b/pocAlgorithm_pkg/rtwtypes.h new file mode 100644 index 0000000..f69f8b9 --- /dev/null +++ b/pocAlgorithm_pkg/rtwtypes.h @@ -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] + */ diff --git a/wellSetup.prj b/wellSetup.prj index ee95f83..09137a9 100644 --- a/wellSetup.prj +++ b/wellSetup.prj @@ -1,5 +1,5 @@ - + @@ -191,7 +191,7 @@ 8 16 32 - 64 + 32 64 32 64 @@ -212,7 +212,7 @@ 8 16 32 - 64 + 32 64 32 64 @@ -330,6 +330,7 @@ + @@ -343,6 +344,7 @@ + @@ -731,7 +733,7 @@ option.UseGlobals.No - ${PROJECT_ROOT}/codegen/lib/wellSetup/wellSetup.a + ${PROJECT_ROOT}\codegen\lib\wellSetup\wellSetup.lib true @@ -759,14 +761,14 @@ - <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>/Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/wellSetup.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> + <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sourceModel><primarySourceFiles><file>\\Mac\Home\GitHub\Henry-Pump\POC-MatLab\wellSetup.m</file></primarySourceFiles><fixedPointSourceFiles/><fixedPointSourceRegistered>false</fixedPointSourceRegistered><fixedPointSourceSelected>false</fixedPointSourceSelected></sourceModel> false false true wellSetup_mex wellSetup option.target.artifact.lib - ${PROJECT_ROOT}/codegen/lib/wellSetup/wellSetup.a + ${PROJECT_ROOT}\codegen\lib\wellSetup\wellSetup.lib false @@ -899,20 +901,20 @@ - + - ${PROJECT_ROOT}/barneyWellTest.mlx + ${PROJECT_ROOT}\barneyWellTest.mlx - ${PROJECT_ROOT}/wellSetup.m + ${PROJECT_ROOT}\wellSetup.m - /Users/patrickjmcd/GitHub/Henry-Pump/POC-MatLab/codegen/lib/wellSetup/wellSetup.a + \\Mac\Home\GitHub\Henry-Pump\POC-MatLab\codegen\lib\wellSetup\wellSetup.lib - /Applications/MATLAB_R2017a.app + C:\Program Files\MATLAB\R2017a @@ -929,18 +931,18 @@ - true - true - false + false + false + true false false false false false - 10.12.6 + 6.2 false true - maci64 + win64 true