% M-file name: wheelset.m
% M-file type: Function file
% This function file identifies the single-point (tread contact) and the two-point (tread and flange contact)
%equations that constitute the mathematical model for the dynamics of a single
% wheelset rolling on a straight track. The equations are written in state space form.
% This function is called by the function file 'equations.m' for solving the differential equations
% constituting the motion of wheelset. The wheelset lateral and yaw displacements and
% velocities, and the left and right rail lateral displacements are provided as inputs to this
% function in order to solve for the wheelset. Additionally, the wheelset suspension forces and
% moments are provided as inputs.
% This function calls the following functions
% 'rolling_radius', 'contact_angle', 'onept_creep', 'onept_normal', 'twopt_creep', and
% 'twopt_normal'.
function [xdot1,xdot2,xdot3,xdot4,xdot5,xdot6,phi]=wheelset(x1,x2,x3,x4,x5,x6,Fsuspyw,Msuspzw)
% Parameters used for simulation
% V: Forward velocity of wheelset (m/sec)
% lambda: wheel conicity
% a: wheel base (m)
% r0: Centered rolling radius of the wheel (m)
% yfc: Flange clearance or flange width (m)
% yfctol: Lateral tolerance added to yfc in order to facilitate numerical simulation (m)
% mw: Mass of wheelset (kg)
% Iwz: Yaw principal mass moment of inertia of wheelset (kg-m2)
% Iwy: Pitch principal mass moment of inertia of wheelset (kg-m2)
% krail: Effective lateral stiffness of rail (N/m)
% crail: Effective lateral damping of rail (N/m)
% g: Acceleration due to gravity (m/s2)
% Indicating the global nature of the variables. This means that the value of the variables need
% not be specified in this function file. This value is automatically obtained from the main file
% 'single_wheelset.m'.
global V lambda a r0 yfc yfctol mw Iwz Iwy krail crail g;
% Nomenclature:
% rlt: Rolling radius at left wheel tread contact patch
% rlf: Rolling radius at left wheel flange contact patch
% rrt: Rolling radius at right wheel tread contact patch
% rrf: Rolling radius at right wheel flange contact patch
% deltalt: Contact angle at left wheel tread contact patch
% deltalf: Contact angle at left wheel flange contact patch
% deltart: Contact angle at right wheel tread contact patch
% deltarf: Contact angle at right wheel flange contact patch
% rl: Rolling radius at left wheel contact patch (for single-point contact)
% rr: Rolling radius at right wheel contact patch (for single-point contact)
% deltal: Effective contact angle at left wheel contact patch after compensating for wheelset roll
% angle (for single-point contact)
% deltatl: Effective contact angle at left wheel tread contact patch after compensating for
% wheelset roll angle (for two-point contact)
% deltafl: Effective contact angle at left wheel flange contact patch after compensating for
% wheelset roll angle (for two-point contact)
% deltar: Effective contact angle at right wheel contact patch after compensating for wheelset
% roll angle (for single-point contact)
% deltatr: Effective contact angle at right wheel tread contact patch after compensating for
% wheelset roll angle (for two-point contact)
% deltafr: Effective contact angle at right wheel flange contact patch after compensating for
% wheelset roll angle (for two-point contact)
% lambdal: Slope of tangent at left wheel contact patch (for single-point contact)
% lambdalt: Slope of tangent at left wheel tread contact patch (for two-point contact)
% lambdalf: Slope of tangent at left wheel flange contact patch (for two-point contact)
% lambdar: Slope of tangent at right wheel contact patch (for single-point contact)
% lambdart: Slope of tangent at right wheel tread contact patch (for two-point contact)
% lambdarf: Slope of tangent at right wheel flange contact patch (for two-point contact)
% phi: Wheelset roll angle
% dphi: Rate of change of wheelset roll angle
% etaxl: Longitudinal creepage at left wheel contact patch (for single-point contact)
% etaxlt: Longitudinal creepage at left wheel tread contact patch (for two-point contact)
% etaxlf: Longitudinal creepage at left wheel flange contact patch (for two-point contact)
% etayl: Lateral creepage at left wheel contact patch (for single-point contact)
% etaylt: Lateral creepage at left wheel tread contact patch (for two-point contact)
% etaylf: Lateral creepage at left wheel flange contact patch (for two-point contact)
% etaspl: Spin creepage at left wheel contact patch (for single-point contact)
% etasplt: Spin creepage at left wheel tread contact patch (for two-point contact)
% etasplf: Spin creepage at left wheel flange contact patch (for two-point contact)
% etaxr: Longitudinal creepage at right wheel contact patch (for single-point contact)
% etaxrt: Longitudinal creepage at right wheel tread contact patch (for two-point contact)
% etaxrf: Longitudinal creepage at right wheel flange contact patch (for two-point contact)
% etayr: Lateral creepage at right wheel contact patch (for single-point contact)
% etayrt: Lateral creepage at right wheel tread contact patch (for two-point contact)
% etayrf: Lateral creepage at right wheel flange contact patch (for two-point contact)
% etaspr: Spin creepage at right wheel contact patch (for single-point contact)
% etasprt: Spin creepage at right wheel tread contact patch (for two-point contact)
% etasprf: Spin creepage at right wheel flange contact patch (for two-point contact)
% Fcxl: Longitudinal creep force on left wheel contact patch (for single-point contact)
% Fcxlt: Longitudinal creep force on left wheel tread contact patch (for two-point contact)
% Fcxlf: Longitudinal creep force on left wheel flange contact patch (for two-point contact)
% Fcyl: Lateral creep force on left wheel contact patch (for single-point contact)
% Fcylt: Lateral creep force on left wheel tread contact patch (for two-point contact)
% Fcylf: Lateral creep force on left wheel flange contact patch (for two-point contact)
% Fczl: Vertical creep force on left wheel contact patch (for single-point contact)
% Fczlt: Vertical creep force on left wheel tread contact patch (for two-point contact)
% Fczlf: Vertical creep force on left wheel flange contact patch (for two-point contact)
% Mcxl: Longitudinal creep moment on left wheel contact patch (for single-point contact)
% Mcxlt: Longitudinal creep moment on left wheel tread contact patch (for two-point contact)
% Mcxlf: Longitudinal creep moment on left wheel flange contact patch (for two-point contact)
% Mcyl: Lateral creep moment on left wheel contact patch (for single-point contact)
% Mcylt: Lateral creep moment on left wheel tread contact patch (for two-point contact)
% Mcylf: Lateral creep moment on left wheel flange contact patch (for two-point contact)
% Mczl: Vertical creep moment on left wheel contact patch (for single-point contact)
% Mczlt: Vertical creep moment on left wheel tread contact patch (for two-point contact)
% Mczlf: Vertical creep moment on left wheel flange contact patch (for two-point contact)
% Fcxr: Longitudinal creep force on right wheel contact patch (for single-point contact)
% Fcxrt: Longitudinal creep force on right wheel tread contact patch (for two-point contact)
% Fcxrf: Longitudinal creep force on right wheel flange contact patch (for two-point contact)
% Fcyr: Lateral creep force on right wheel contact patch (for single-point contact)
% Fcyrt: Lateral creep force on right wheel tread contact patch (for two-point contact)
% Fcyrf: Lateral creep force on right wheel flange contact patch (for two-point contact)
% Fczr: Vertical creep force on right wheel contact patch (for single-point contact)
% Fczrt: Vertical creep force on right wheel tread contact patch (for two-point contact)
% Fczrf: Vertical creep force on right wheel flange contact patch (for two-point contact)
% Mcxr: