AMEset二次开发子模型生成错误(AMEset HELP里第一个例子)
/* Submodel RACK50 skeleton created by AME Submodel editing utility?? 3? 14 17:34:13 2016 */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "ameutils.h"
/* *******************************************************************************
TITLE :
------------------------------------------------------------------------------
DESCRIPTION :
------------------------------------------------------------------------------
USAGE :
------------------------------------------------------------------------------
PARAMETER SETTINGS :
------------------------------------------------------------------------------
REVISIONS :
******************************************************************************* */
#define _SUBMODELNAME_ "RACK50"
/* >>>>>>>>>>>>Insert Private Code Here. */
/* <<<<<<<<<<<<End of Private Code. */
/* There is 1 real parameter:
radius radius of the pinion
*/
void rack50in_(int *n, double rp, double *x)
{
int loop, error;
/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Initialization declarations. */
double radius;
radius = rp;
loop = 0;
error = 0;
/*
If necessary, check values of the following:
rp
*x
*/
/* >>>>>>>>>>>>Initialization Function Check Statements. */
/* <<<<<<<<<<<<End of Initialization Check Statements. */
if(error == 1)
{
amefprintf(stderr, "\nWarning in %s instance %d.\n", _SUBMODELNAME_, *n);
}
else if(error == 2)
{
amefprintf(stderr, "\nFatal error in %s instance %d.\n", _SUBMODELNAME_, *n);
amefprintf(stderr, "Terminating the program.\n");
AmeExit(1);
}
/* Common -> SI units conversions. */
rp *= 1.00000000000000e-003;
radius = rp;
/* >>>>>>>>>>>>Initialization Function Executable Statements. */
/* <<<<<<<<<<<<End of Initialization Executable Statements. */
}
void rack50end_(int *n, double rp, double *x)
{
int loop, error;
/* >>>>>>>>>>>>Extra Terminate Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Terminate declarations. */
double radius;
radius = rp;
loop = 0;
error = 0;
/* >>>>>>>>>>>>Terminate Function Executable Statements. */
/* <<<<<<<<<<<<End of Terminate Executable Statements. */
}
/*There are 2 ports.
Port 1 has 2 variables:
1 f1 force at port 1 one line macro 't2/radius'
2 v1 linear velocity at port 1 basic variable input
Port 2 has 2 variables:
1 w2 rotary velocity at port 2 one line macro 'v1/radius'
2 t2 torque at port 2 basic variable input
*/
/*There are 2 internal variables.
1 x displacement of the rack explicit state (derivative `dx')
2 theta angular posision basic variable
*/
void rack50_(int *n, double *v1, double *t2, double *x, double *dx
, double *theta, double rp, int *flag, double *t)
{
int loop, logi;
/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Calculation declarations. */
double radius;
radius = rp;
logi = 0;
loop = 0;
/* Common -> SI units conversions. */
*x *= 1.00000000000000e-003;
/*
Set all submodel outputs below:
*dx = ??;
*theta = ??;
*/
/* >>>>>>>>>>>>Calculation Function Executable Statements. */
*dx = *v1;
*theta = *x/radius;
/* <<<<<<<<<<<<End of Calculation Executable Statements. */
/* SI -> Common units conversions. */
*x /= 1.00000000000000e-003;
*dx /= 1.00000000000000e-003;
*theta /= 1.74532925199433e-002;
}
页:
[1]