搜索
查看: 3404|回复: 0

AMEset二次开发子模型生成错误(AMEset HELP里第一个例子)

[复制链接]
发表于 2016-3-14 17:36:58 | 显示全部楼层 |阅读模式
/* 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 [mm -> m]
*/

void rack50in_(int *n, double rp[1], double *x)

{
   int loop, error;
/* >>>>>>>>>>>>Extra Initialization Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Initialization declarations. */
   double radius;

   radius     = rp[0];
   loop = 0;
   error = 0;

/*
   If necessary, check values of the following:

   rp[0..0]
   *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[0]    *= 1.00000000000000e-003;
   radius     = rp[0];


/* >>>>>>>>>>>>Initialization Function Executable Statements. */
/* <<<<<<<<<<<<End of Initialization Executable Statements. */
}

void rack50end_(int *n, double rp[1], double *x)

{
   int loop, error;
/* >>>>>>>>>>>>Extra Terminate Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Terminate declarations. */
   double radius;

   radius     = rp[0];
   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           [N]   one line macro 't2/radius'
      2 v1     linear velocity at port 1 [m/s] basic variable input

   Port 2 has 2 variables:

      1 w2     rotary velocity at port 2 [rev/min] one line macro 'v1/radius'
      2 t2     torque at port 2          [Nm]      basic variable input
*/

/*  There are 2 internal variables.

      1 x         displacement of the rack [mm -> m]       explicit state (derivative `dx')
      2 theta     angular posision         [degree -> rad] basic variable
*/

void rack50_(int *n, double *v1, double *t2, double *x, double *dx
      , double *theta, double rp[1], int *flag, double *t)

{
   int loop, logi;
/* >>>>>>>>>>>>Extra Calculation Function Declarations Here. */
/* <<<<<<<<<<<<End of Extra Calculation declarations. */
   double radius;

   radius     = rp[0];
   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;
}


AMEset二次开发子模型生成错误(AMEset HELP里第一个例子)

AMEset二次开发子模型生成错误(AMEset HELP里第一个例子)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则