next up previous
Next: Bike Simulation Up: Scilab demonstration pages Previous: Two trailers truck

Wheel simulation

This an application of Scilab-Maple interface to a free rolling wheel. Maple (euler.map,npend.map)is used to generate fortran code wheel.f used to compute the state derivative of the rolling wheel. This function is passed as argument to the scilab ode solver.

Details (Maple, Fortran and Scilab code) may be found in <SCIDIR>/demos/wheel2 directory.

path="SCI/demos/wheel2";
getf(path+'/show.sci');
//
if getenv('WIN32','NO')=='OK' & getenv('COMPILER','NO')=='VC++' then 	
  cur_wd = getcwd();
  chdir(SCI+"/demos/wheel2/Maple");
  host("nmake /f Makefile.mak ");
  chdir(cur_wd);
  if ~c_link('wheel') then link('c:/tmp/wheel.dll ','wheel');end
else
  host("cd $"+path+"; make ");
  if ~c_link('wheel') then link('/tmp/wheel.o ','wheel');end
end
tmin=0.0;tmax=15;nn=300;
times=(0:(nn-1));
times=tmax*times/(nn-1) +tmin*((nn-1)*ones(times)-times);
//               INITIAL CONDITIONS
x0=[0;                 	//theta
    %pi/2+0.1;   	//phi
    0;              //psi
    5.0;        	//Dtheta
    0.0;          	//Dphi
    4.0;         	//Dpsi
    0;           	//x
    0];           	//y
//               SIMULATION
x=ode(x0,tmin,times,'wheel');
xselect();
show(x)
m0_14.1.gif animation 66K



Scilab group