Kennung für das Versionskontroll-System:
char *rcsid = ''$Id: simulation.c,v 1.139 1996/04/23 16:54:12 heuler Exp$'';
Lokale Definitionen:
const double g = GRAV, /* gravitational constant */ m1 = MASS1, /* mass of motorarm */ m2 = MASS2, /* mass of pendulum */ l1 = LEN1, /* length of motorarm */ l2 = LEN2, /* length of pendulum */ thetaA = THETA, /* inertia of motorarm */ thetaP = THETP, /* inertia of pendulum */ thetaM = THETM, /* inertia of motor */ s1 = S1, /* distance from centre of rotation of motorarm to centre of gravity */ s2 = S2, /* distance from centre of rotation of pendulum to centre of gravity */
int simulation; /* hardware oder simulation */ int running; /* simulation running ? */ int display; /* displaying information */ int sleeprate; /* time to sleep for display */ char *name; /* name of thread */ double force; /* current parameter of force */ double zeit = 0.0; /* time */ double h = RUNGESTEP; /* step size for Runge-Kutta method */ double motw, motv, mota; /* current parameters of motor */ double penw, penv, pena; /* current parameters of pendulum */ /* w : angle * v : angle speed * a : acceleration */
static double A, B, C, D, E, F, G, H, L, N; /* variables to speed up calculation */
Berechnet die Beschleunigung des Antriebsarms (für das Runge-Kutta
Verfahren):
double phipp(double t, double phi, double phip, double psi, double psip);
Berechnet die Beschleunigung des Pendels (für das Runge-Kutta
Verfahren):
double psipp(double t, double phi, double phip, double psi, double psip);
Initialisiert die Parameter, die für die Simulation benötigt werden:
void InitSimulation();
Berechnet die neuen Parameter des Pendelsystems für jeden Zeitschritt:
void Simulate();