/****************************************************************** * FUNCTION: volume - working space volume variations and * * derivatives * * FILENAME volume.c * * PROGRAMMER I.Urieli (FORTRAN) * * E. Malroy (C Translation) * * DATE: 11/30/94 (FORTRAN), 03/12/96 (C Translation) * * LAST MODIFIED: by I.Urieli 01/16/97 * * INCLUDE: ,"adiabatic.h","define.h" * * GLOBAL VARIABLES: myeng * * PROTOTYPES: * * void volume(double, double *, double *, double *, double *); * * PRE: crankangle theta and global variables in define.h * * POST: volumes and volume derivatives have been returned * ******************************************************************/ #include #include "define.h" #include "adiabatic.h" void volume(double theta, /* crank angle (radians) */ double *ptr_vc, /* ptr to comp. space volume */ double *ptr_ve, /* ptr to exp. space volume */ double *ptr_dvc, /* ptr to comp space volume derivative */ double *ptr_dve) /* ptr to exp. space volume derivative */ { if(myeng == 's') sinevl(theta, ptr_vc, ptr_ve, ptr_dvc, ptr_dve); if(myeng == 'y') yokevl(theta, ptr_vc, ptr_ve, ptr_dvc, ptr_dve); } /****************************************************************** * FUNCTION: sinevl - sinusoidal volume variations and * * derivatives * * FILENAME volume.c * * PROGRAMMER I.Urieli (FORTRAN) * * E. Malroy (C Translation) * * DATE: 11/30/94 (FORTRAN), 03/12/96 (C Translation) * * LAST MODIFIED: by I.Urieli 08/18/96 * * INCLUDE: ,"define.h" * * GLOBAL VARIABLES: vcle, vclc, vswc, vswe, alpha * * PROTOTYPE: * * void * * sinevl(double, double *, double *, double *, double *); * * PRE: crankangle theta, vclc, vcle, vswc, vswe & alpha * * POST: vc, ve, dvc, dve have been evaluated and returned. * ******************************************************************/ void sinevl(double theta, /* crank angle (radians) */ double *ptr_vc, /* ptr to comp. space volume */ double *ptr_ve, /* ptr to exp. space volume */ double *ptr_dvc, /* ptr to comp space volume derivative */ double *ptr_dve) /* ptr to exp. space volume derivative */ { double vc, ve, dvc, dve; /* volumes and volume derivatives */ vc = vclc + 0.5*vswc*(1.0 + cos(theta)); ve = vcle + 0.5*vswe*(1.0 + cos(theta + alpha)); dvc = -0.5*vswc*sin(theta); dve = -0.5*vswe*sin(theta + alpha); *ptr_vc = vc; *ptr_ve = ve; *ptr_dvc = dvc; *ptr_dve = dve; } /****************************************************************** * FUNCTION: yokevl - volume variations and derivatives for Ross * * yoke drive configuration (inverted yoke) idealized to neglect* * the x component of motion of the link arm to Ross yoke * * FILENAME volume.c * * PROGRAMMER * * E. Malroy (C) * * DATE: 03/28/96 (C) * * LAST MODIFIED: by I.Urieli 01/15/97 * * INCLUDE: ,"define.h" * * GLOBAL VARIABLES: * * vclc, vcle: comp., exp. space clearance volumes (m^3) * * crank: crank radius (m) * * b1,b2: yoke height, base length/2 (m) * * acomp, aexp: area of comp., exp. pistons (m^2) * * ymin: minimum yoke vertical displacement (m) * * PROTOTYPE: * * void * * yokevl(double, double *, double *, double *, double *); * * PRE: the global variables have defined values * * POST: vc, ve, dvc, dve have been evaluated and returned. * ******************************************************************/ #include #include "define.h" void yokevl(double theta, /* crank angle (radians) */ double *ptr_vc, /* ptr to comp. space volume */ double *ptr_ve, /* ptr to exp. space volume */ double *ptr_dvc, /* ptr to comp space volume derivative */ double *ptr_dve) /* ptr to exp. space volume derivative */ { double vc, ve, dvc, dve; /* volumes and volume derivatives */ double sinth, costh, bth, /* local holding variables */ yc, ye; /* yoke comp., exp side vertical displacements (m) */ sinth = sin(theta); costh = cos(theta); bth = sqrt(b1 * b1 - (crank * costh) * (crank * costh)); ye = crank * (sinth + (b2 / b1) * costh) + bth; yc = crank * (sinth - (b2 / b1) * costh) + bth; ve = vcle + aexp * (ye - ymin); vc = vclc + acomp * (yc - ymin); dvc = acomp*crank*(costh + (b2/b1)*sinth + crank*sinth*costh/bth); dve = aexp*crank*(costh - (b2/b1)*sinth + crank*sinth*costh/bth); *ptr_vc = vc; *ptr_ve = ve; *ptr_dvc = dvc; *ptr_dve = dve; }