/* Copyright (C) 2013 Riccardo Greco rigreco.grc@gmail.com. * * This project is based on 1999-2000 Thesis work of Greco Riccardo. * It implement an Runge Kutta 4(5)^ order integration numerical method of differential equations set * by use of double precision floating point operation in Aztec C65 language. * It allow to simulate different mathematical models such as: * Resistance Capacitor electrical circuit, Direct Current electric motor, * Alternative Current three phase induction motor. * * Thanks to Bill Buckels for his invaluable support: * Aztec C compilers http://www.aztecmuseum.ca/compilers.htm */ /* PROCESS MODULE */ #include #include #include #include #define rkfr 1.0e-3 /* RKF max resolution hrkfr); */ /* y3 y4 weighted average of operators 5^ order */ y[0]=(double)(y_init[0]+(ips5[0]*r11+ips5[2]*r31+ips5[3]*r41+ips5[4]*r51)*h); y[1]=(double)(y_init[1]+(ips5[0]*r12+ips5[2]*r32+ips5[3]*r42+ips5[4]*r52)*h); /* ------------------------------------------------------------------------------*/ } ovmain() { char buf[20]; /*double atof(); /* DON'T FORGET THIS */ double x,y[2],y_init[2]; struct data rk; /* inizialization */ cnt= (int)0.0; /* Reset counter */ y[0] = (double)0.0; y[1] = (double)0.0; y_init[0]= (double)0.0; /* init value of current ia(t) (for Harmonic oscillator y_3=10.0) */ y_init[1]= (double)0.0; /* init value of angular speed w(t) (for Harmonic oscillator y_4=10.0) */ x=(double)0.0; /* time in simulation */ /* Start simulation */ scr_clear(); scr_curs(0,0); puts("Pocessing..."); /* open and write header data to file */ open(FILE_NAME,O_WRONLY|O_APPEND,0xC3); write(fd,fbuf,80); buf[0]='\0'; /* buffers reset */ fbuf[0]='\0'; /* RK main Cycle */ while (x