# -*-octave-*- Put Emacs into octave-mode
# Numerical parameter file (sInvertedPendulumOnCart_numpar.txt)
# Generated by MTT at Wed Aug 25 22:57:05 BST 1999

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.1  1999/12/03 00:50:28  peterg
# %% Initial revision
# %%
# %% Revision 1.1  1999/11/12 06:47:50  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## Same as sInvertedpendulumOnCart with pendulum stuff removed.

# Parameters
j_m = 	3.87e-7;		# Motor inertia
k_m = 	0.00767;		# Motor constant
r_a = 	2.6;			# Armature resistance
l_a = 	0.18e-3;		# Armature inductance

k_g = 	1/3.7;			# Internal gear ratio 
r = 	0.635e-2;		# Motor gear radius

m_c = 	0.455;			# Cart mass

b_m = 	0.0;			# Motor friction
r_c = 	5.0;			# Cart friction

# l_p =   0.61;			# Pendulum length
# m_p =   0.210;			# Pendulum mass
# r_p = 	0.0;			# Pendulum friction
# j_p = m_p*(l_p*l_p)/12;		# Pendulum inertia about cm.

# g = +9.81;			# Gravity

# m_t = 0.0; # Tip mass

## Sensitivity parameters
m_cs = 0;			# Cart mass
b_ms = 0;			# Motor friction 
r_cs = 0;			# Cart friction

# j_ps = 0;			# Pendulum inertia
# m_ps = 0;			# Pendulum mass
# r_ps = 0;			# Pendulum friction

# m_ts = 0;			# Tip mass

## Initial states
i_0 = 0;			# Initial armature current
# omega_0 = 0;			# Initial pendulum velocity
# theta_0 = 0;			# Initial pendulum angle
v_0 = 0;			# Initial cart velocity
x_0 = 0;			# Initial cart position

## Sensitivity parameters
i_0s = 0;			# Initial armature current
# omega_0s = 0;			# Initial pendulum velocity
# theta_0s = 0;			# Initial pendulum angle
v_0s = 0;			# Initial cart velocity
x_0s = 0;			# Initial cart position

## Control parameters
k_1 = 1;
k_2 = 0;
k_3 = 0;
k_4 = 0;

## Control sensitivity parameters
k_1s = 0;
k_2s = 0;
k_3s = 0;
k_4s = 0;


## Which sensitivity function? NB all other sens. coeffs MUST be zero -
## see above
if (mtt_n_parameters>=1)
  mtti = mtt_parameters(1);

  if mtti==1
    k_1s = 1;
  endif
  
  if mtti==2
    k_2s = 1;
  endif
  
  if mtti==3
    k_3s = 1;
  endif

  if mtti==4
    k_4s = 1;
  endif

  if mtti==5
    r_cs = 1;
  endif
  
  if mtti==6
    m_cs = 1;
  endif

#   if mtti==7
#     r_ps = 1;
#   endif

#   if mtti==8
#     m_ts = 1;
#   endif

#   if mtti==9
#     j_ps = 1;
#   endif
  
  if mtti==10
    i_0s = 1;			# Initial armature current
  endif
  
#   if mtti==11
#     omega_0s = 1;		# Initial pendulum velocity
#   endif
  
#   if mtti==12
#     theta_0s = 1;		# Initial pendulum position
#   endif
  
  if mtti==13
    v_0s = 1;			# Initial cart velocity
  endif
  
  if mtti==14
    x_0s = 1;			# Initial cart angle
  endif
  
endif;

## Control parameters

if (mtt_n_parameters>=2)
  k_1 = mtt_parameters(2);
endif;

if (mtt_n_parameters>=3)
  k_2 = mtt_parameters(3);
endif;

if (mtt_n_parameters>=4)
  k_3 = mtt_parameters(4);
endif;

if (mtt_n_parameters>=5)
  k_4 = mtt_parameters(5);
endif;

## Physical parameters
if (mtt_n_parameters>=6)
  r_c = mtt_parameters(6);
endif;

if (mtt_n_parameters>=7)
  m_c = mtt_parameters(7);
endif;

# if (mtt_n_parameters>=8)
#   r_p = mtt_parameters(8);
# endif;

# if (mtt_n_parameters>=9)
#   m_t = mtt_parameters(9);
# endif;

# if (mtt_n_parameters>=10)
#   j_p = mtt_parameters(10);
# endif;

## Initial condition parameters - states are read in
if (mtt_n_parameters>=15)	# 
  i_0 = mtt_parameters(11); # Initial armature current
#   omega_0 = mtt_parameters(12); # Initial cart velocity
#   theta_0 = mtt_parameters(13);	# Initial cart position
  v_0 = mtt_parameters(14); # Initial pendulum velocity
  x_0 = mtt_parameters(15); # Initial pendulum angle
endif;

## Simulation stuff

if (mtt_n_parameters>=16)
  LAST = mtt_parameters(16);
endif;
if (mtt_n_parameters>=17)
  DT = mtt_parameters(17);
endif;

