c                                            
c     initialize miscellaneous constants
c                      
      data rt,lf / 1,2 /
      data first,second / 1,2 /
      data x,y,z,cntr,rx,ry,rz / 1,2,3,4,4,5,6 /
      data fx,fy,fz,mx,my,mz / 1,2,3,4,5,6 /
      data distal,proximal / 1,2 /
      data flex,abad,inex / 1,2,3 /                            
c
c     initialize segment constants
c
      data rtft,rtcf,rtth / 1,2,3 /
      data lfft,lfcf,lfth / 4,5,6 /
      data pelv,trnk,head / 7,8,13 /
      data rtua,rtla,rthd / 9,10,14 /
      data lfua,lfla,lfhd / 11,12,15 /
c
c     Initialization of segment and joint names moved to ANZ file for
c     file format version 'd' and later - 1/93
c
c      data SegNames / 'RFT','RCF','RTH',
c     &                'LFT','LCF','LTH',
c     &                'PLV','TRK',
c     &                'RUA','RLA',
c     &                'LUA','LLA',
c     &                'HED',
c     &                'RHD','LHD' /
c                                     
c     initialize joint constants
c                      
      data rtak,rtkn,rthp /  1, 2, 3 /
      data lfak,lfkn,lfhp /  4, 5, 6 /
      data pvlb,pvtk,neck /  7, 8,13 /
      data rtwr,rtel,rtsh / 14, 9,10 /
      data lfwr,lfel,lfsh / 15,11,12 /       

c      data JntNames/ 'RAK','RKN','RHP',
c     &               'LAK','LKN','LHP',
c     &               'PVL','PVT',
c     &               'REL','RSH',
c     &               'LEL','LSH',
c     &               'NEC',                
c     &               'RWR','LWR' /           
c                             
c      data JntSegNum /  1,2,   2,3,  3,7,
c     &                  4,5,   5,6,  6,7,
c     &                  7,0,   8,7,  
c     &                  10,9,  9,8,  
c     &                  12,11, 11,8,
c     &                  13,8, 
c     &                  14,10, 15,12  /          
c
c     Initialize component names
c
      data CSAxes / 'X  ','Y  ','Z  ','RX ','RY ','RZ ' /

      data AngAxes / 'FLE','ABD','INT' /

      data FrcNames / 'FX ','FY ','FZ ','MX ','MY ','MZ ' /

      data JCSFrcNames / 'MLF','APF','CDF','FEM','AAM','IEM','FRC','MOM' /
c
c     Initialize names relating to time quantities
c                              
      data TimeNames / 'TIM',  ! time, in seconds
     &                 'FRA',  ! frame numbers
     &                 'PER' / ! percent of cycle, hs to hs or percent
                               ! of # of frames in data set
c
c     Initialize event names
c
      data EventNames / 'RHS','LHS','RTO','LTO' /
c
c     Initialize names of coordinate systems
c
      data CSTypeNames / 'GCS','LCS','PRO','DIS','JCS','EUL','PLV','TRK' /
c
c     Initialize screw and wrench component names
c
      data ScrewCompNames  / 'WX ','WY ','WZ ','PX ','PY ','PZ ','ANG','TRA' /
      data WrenchCompNames / 'WX ','WY ','WZ ','PX ','PY ','PZ ','MOM','FRC' /
c
c     Initialize momentum component names
c
      data MomCompNames / 'X  ','Y  ','Z  ','RX ','RY ','RZ ','RMG','TMG' /
c
c     Initialize impulse component names
c
      data ImpCompNames / 'FX ','FY ','FZ ','MZ ' /
c                        
c     Initialize joint power component names
c
      data PowerCompNames / 'FLE','ABD','INT','MAG' /                     
c
c     Initialize joint translation component names
c
      data JCSTransCompNames / 'MLT','APT','CDT','MAG' /
      data TransCompNames / 'X  ','Y  ','Z  ','MAG' /
c
c     Initialize Pitch Moment/Wrench Arm component names
c
      data PitArmCompNames / 'X  ','Y  ','Z  ','MAG' /
c
c     Initialize data type names
c
      data DataTypeNames / 'motion    ','electrical','force     ','emg       ','muscle    ',
     &                     'marker    ','segment   ','joint     ','reconstruc','time      ' /
c
c     Initialize names of available graph quantities
c                                                          
      data VarNames    / 'MPN',   ! marker position		! 1
     &                   'MVL',   ! marker velocity		! 2
     &                   'MAC',   ! marker acceleration	! 3
                         
     &                   'SPR',   ! segment parameters	! 4
     &                   'SPN',   ! segment position/orientation	! 5
     &                   'SMP',   ! segment markers in segment LCS	! 6
     &                   'SMD',   ! segment intermarker distance	! 7
     &                   'SVL',   ! segment velocity- option of GCS/LCS	! 8
     &                   'SAC',   ! segment acceleration- option of GCS/LCS	! 9
     &                   'SKE',   ! segment kinetic energy			! 10
     &                   'SPE',   ! segment potential energy		! 11
     &                   'STE',   ! segment total energy			! 12
     &                   'SIS',   ! segment instantaneous screw		! 13
     &                   'SFS',   ! segment finite screw			! 14
     &                   'SMM',   ! segment momentum				! 15
     &                   'SAN',   ! segment euler angle to GCS		! 16
     &                   'BKE',   ! body kinetic energy				! 17
     &                   'BPE',   ! body potential energy			! 18
     &                   'BTE',   ! body total energy				! 19
     &                   'BCM',   ! body center of mass				! 20
     &                   'BCV',   ! body center of mass velocity	! 21
     &                   'BMM',   ! body momentum					! 22
                                                        
     &                   'JAN',   ! joint angle- option of JCS/EUL	! 23
     &                   'JVL',   ! joint velocity- option of JCS/EUL	! 24
     &                   'JAC',   ! joint acceleration- option of JCS/EUL	! 25
     &                   'JLD',   ! joint load- opt of PROX/DIST/JCS/GCS	! 26
     &                   'JLL',   ! joint load- leg summed- opt of JCS/GCS	! 27
     &                   'JWR',   ! joint wrench						! 28
     &                   'JPW',   ! joint power transfer				! 29
     &                   'JPL',   ! joint power transfer- leg summed	! 30
     &                   'JIS',   ! joint instantaneous kinematic screw	! 31
     &                   'JFS',   ! joint finite kinematic screw		! 32
     &                   'JTR',   ! joint translation					! 33
     &                   'JSA',   ! joint screw angle					! 34
     &                   'JMA',   ! joint moment arm					! 35
     &                   'JWA',   ! joint wrench arm					! 36
                                                     
     &                   'FPL',   ! Ground reaction load (GRL) on force plates 37
     &                   'FFT',   ! GRL on each foot 38
     &                   'FCB',   ! combined GRL force plate data 39
     &                   'FCP',   ! center of pressure of GRL of force data 40
     &                   'FCF',   ! center of pressure of foot GRL data - GCS/LCS 41
     &                   'FCC',   ! center of pressure of combined data 42
     &                   'FWP',   ! wrench of GRL force plate data 43
     &                   'FWF',   ! wrench of foot GRL data 44
     &                   'FWC',   ! wrench of combined data 45
     &                   'FP1',   ! 1st integral of force plate data 46
     &                   'FF1',   ! 1st integral of foot GRL data 47
     &                   'FC1',   ! 1st integral of combined data 48
     &                   'FP2',   ! 2nd integral of force plate data 49
     &                   'FF2',   ! 2nd integral of foot GRL data 50
     &                   'FC2',   ! 2nd integral of combined data 51
     &                   'FSI',   ! foot strike index 52
     &                   'PMA',   ! Pitch Moment Arm /plv,/trk,/gcs 53
     &                   'PWA',   ! Pitch Wrench Arm /plv,/trk,/gcs 54
     &                   'FCV',   ! Velocity of center of pressure in GCS 55
                             
     &                   'RFT',   ! reconstucted foot GRL - GCS/LCS 56
     &                   'RCB',   ! reconstructed combined load 57
     &                   'RCF',   ! reconstructed foot center of pressure - GCS/LCS 58
     &                   'RCC',   ! reconstructed combined center of pressure 59
     &                   'RSI',   ! reconstructed strike index 60

     &                   'EMG',   ! emg channel signal 61
                        
     &                   'MLN',   ! muscle length 62
     &                   'MVE',   ! muscle velocity - opt of SIMple/KINematic 63
     &                   'MOR',   ! muscle origin position 64
     &                   'MIN',   ! muscle insertion position 65
     &                   'MLA',   ! muscle line of action 66
     &                   'MEM',   ! muscle/IEMG measure 67
  
     &                   'TIM',   ! Time 68
     &                   'FRA',   ! Frame number 69                         
     &                   'PER'/   ! Percent gait cycle or data set 70
c
c     Initialize names of available 3D View quantities
c                                                          
      data Vu3dVarNames / 'MPN',   ! marker position 1
     &                    'MVL',   ! marker velocity 2
     &                    'MAC',   ! marker acceleration 3
                                        
     &                   'SPN',   ! segment position/orientation 4
     &                   'SVL',   ! segment velocity- option of GCS/LCS
     &                   'SAC',   ! segment acceleration- option of GCS/LCS
     &                   'SIS',   ! segment instantaneous screw
     &                   'SFS',   ! segment finite screw
     &                   'SMM',   ! segment momentum 10
     &                   'BCM',   ! body center of mass
     &                   'BCV',   ! body center of mass velocity
     &                   'BMM',   ! body momentum 13
                                                        
     &                   'JLD',   ! joint load- opt of PROX/DIST/JCS/GCS 14
     &                   'JWR',   ! joint wrench
     &                   'JIS',   ! joint instantaneous kinematic screw
     &                   'JFS',   ! joint finite kinematic screw 17
                                                     
     &                   'FPL',   ! Ground reaction load (GRL) on force plates 18
     &                   'FFT',   ! GRL on each foot 
     &                   'FCB',   ! combined GRL force plate data
     &                   'FCP',   ! center of pressure of GRL of force data
     &                   'FCF',   ! center of pressure of foot GRL data - GCS/LCS
     &                   'FCC',   ! center of pressure of combined data
     &                   'FWP',   ! wrench of GRL force plate data
     &                   'FWF',   ! wrench of foot GRL data
     &                   'FWC',   ! wrench of combined data
     &                   'FCV'/   ! Velocity of center of pressure 27
c          
c     Initialize descriptions of how many parameters are required
c     to describe each of the quantities above for graphing
c                               
      data GrNumPrm / 2,2,2,                                 ! marker data 3
     &                0,2,3,2,2,2,2,1,1,2,2,2,2,1,0,0,1,1,1, ! segment data 19 22
     &                2,2,2,2,2,2,2,2,2,2,2,2,2,2,           ! joint data 14 36
     &                2,2,1,2,2,1,2,2,1,2,2,1,2,2,1,1,1,1,2, ! force data 19 55
     &                2,1,2,1,1,                             ! reconstructed GRL 5 60
     &                1,                                     ! emg data 1 61
     &                1,1,2,2,2,1 /                          ! muscle data 6 67
c                         
c     Initialize descriptions of how many parameters are required
c     to describe each of the quantities above for 3d display. 
c     A negative number of parameters means that the quantity is
c     not valid for 3d display.
c
      data TdVuNumPrm / 1,1,1,                                        ! marker 3
     &               -1,1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,0,0,0, ! segment 19 22
     &               -1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,-1,            ! joint 14 36
     &                1,1,1,1,1,0,1,1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,1, ! force 19 55
     &                -1,-1,-1,-1,-1,                                 ! reconst 5 60
     &               -1,                                              ! emg 1 61
     &               -1,-1,-1,-1,-1,-1 /                              ! muscle 6 67
c             
c     Initialize force plate size and location constants
c     This information should really be contained in a parameter
c     file that could be easily modified for different systems.
c
      data PltSize / 0.464 , 0.514, ! width, length (m) plate 1
     &               0.464 , 0.514,                   ! plate 2
     &               0.464 , 0.514,                   ! plate 3
     &               0.0   , 0.0    /                 ! plate 4
                                 
      data PltLoc /  0.0,  1.0,  0.0,     ! plate 1     rotation matrix
     &               1.0,  0.0,  0.0,     ! orientation is transposed here
     &               0.0,  0.0, -1.0,
     &              -0.876,0.0, -0.021,   ! position
c     
     &               0.0,  1.0,  0.0,     ! plate 2 
     &               1.0,  0.0,  0.0,     ! orientation
     &               0.0,  0.0, -1.0,
     &              -0.257,0.0, -0.035,   ! position
c     
     &               0.0, -1.0,  0.0,     ! plate 3 
     &              -1.0,  0.0,  0.0,     ! orientation
     &               0.0,  0.0, -1.0,
     &               0.257,0.0, -0.034,   ! position
c
     &               0.0,  0.0,  0.0,     ! plate 4
     &               0.0,  0.0,  0.0,     ! orientation
     &               0.0,  0.0,  0.0,
     &               0.0,  0.0,  0.0   /  ! position
c
c     Initialize force plate calibration matrices.  Note that due
c     to the way in which the data is read in with a data statement
c     the matrices below are transposed relative to their normal
c     representation.
c
      Data CalMatrix / 1.590,  0.030, -0.010,  0.053, -0.180, -0.241, ! plate 1
     &                -0.020,  1.549, -0.026, -0.147, -0.147,  0.001,
     &                 0.009, -0.012,  2.702, -0.091, -0.159,  0.117,
     &                 0.000,  0.003, -0.003,  1.404, -0.008, -0.003,
     &                -0.001,  0.001,  0.000, -0.012,  1.346,  0.003,
     &                -0.001,  0.000, -0.002, -0.003,  0.003,  0.562,
c
     &                 0.679,  0.002,  0.034,  0.001,  0.001,  0.003, ! plate 2
     &                 0.001,  0.682, -0.001,  0.001,  0.003,  0.001,
     &                -0.003, -0.001,  2.618, -0.001,  0.002, -0.001,
     &                 0.000,  0.003, -0.010,  1.145, -0.001,  0.003,
     &                -0.001,  0.000, -0.008, -0.001,  1.146, -0.002,
     &                 0.001, -0.001, -0.007,  0.000, -0.004,  0.566,
c
     &                 0.684,  0.000,  0.029,  0.003, -0.003, -0.010, ! plate 3
     &                 0.004,  0.695,  0.027, -0.003, -0.002, -0.008,
     &                -0.003,  0.000,  2.640,  0.001,  0.000, -0.001,
     &                 0.000,  0.001, -0.012,  1.150,  0.005,  0.004,
     &                -0.002, -0.001, -0.024,  0.005,  1.159,  0.002,
     &                 0.009, -0.001, -0.012, -0.002,  0.004,  0.574,
c
     &                 0.684,  0.000,  0.029,  0.003, -0.003, -0.010, ! junk
     &                 0.004,  0.695,  0.027, -0.003, -0.002, -0.008,
     &                -0.003,  0.000,  2.640,  0.001,  0.000, -0.001,
     &                 0.000,  0.001, -0.012,  1.150,  0.005,  0.004,
     &                -0.002, -0.001, -0.024,  0.005,  1.159,  0.002,
     &                 0.009, -0.001, -0.012, -0.002,  0.004,  0.574 /
c
c     Amp Gains - Needed to use the above calibration matrices
c     Gains are in units of uV/V excitation - 10**6uV/Gain/10V
c     where individual amp gains are 1000, 2000, or 4000
c
      data OldAmpGain / 100., 100., 100., 100., 100., 100., ! plate 1
     &                  25.0, 25.0, 50.0, 25.0, 25.0, 25.0, ! plate 2
     &                  25.0, 25.0, 50.0, 25.0, 100., 100., ! plate 3
     &                  25.0, 25.0, 50.0, 25.0, 25.0, 25.0 /! junk

      data NewAmpGain / 100., 100., 100., 100., 100., 100., ! plate 1
     &                  25.0, 25.0, 50.0, 25.0, 25.0, 25.0, ! plate 2
     &                  25.0, 25.0, 50.0, 25.0, 25.0, 25.0, ! plate 3
     &                  25.0, 25.0, 50.0, 25.0, 25.0, 25.0 /! junk
c
c     Initialize the names of the various quantities stored in the
c     ANZ format files.  These are used to display the current status
c     of the file reading process.
c
      data AnzVarName  / 'General Parameters  ',  'Motion Parameters   ',
     &                   'Force Parameters    ',  'Gait Parameters     ',

     &                   'Marker Position GCS ',  'Marker Position LCS ',
     &                   'InterMarker Distance',

     &                   'Segment Parameters  ',  'Segment Position    ',
     &                   'Segment Velocity GCS',  'Segment Accel GCS   ',
     &                   'Segment Velocity LCS',  'Segment Accel LCS   ',
     &                   'Segment Kinetic Enr ',  'Segment Potential En',
     &                   'Segment Total Energy',  'Body Kinetic Energy ',
     &                   'Body Potential Enrgy',  'Body Total Energy   ',
     &                   'Segment Finite Screw',  'Body Center of Mass ',
     &                   'Segment Momentum    ',  'Body Momentum       ',
     &                   'Segment Angle GCS   ',
                                                                  
     &                   'Force Plate GRL Data',  'Force Data Validity ',
     &                   'Foot-Floor Contact  ',  'Ind Foot GRL Data   ',
     &                   'Combined Plate GRL  ',  'Foot Center Pressure',
     &                   'Combined Plate CP   ',  'Foot Cntr Pres LCS  ',
     &                   'Foot Strike Index   ',  'Ind Foot GRL Wrench ',
     &                   'Combined GRL Wrench ',  'Ind Ft GRL Integral ',
     &                   'Comb GRL Integral   ',  'Plate Cntr Pressure ',
     &                   'Plate GRL Wrench    ',  'Plate GRL Integral  ',

     &                   'Joint Angle JCS     ',  'Joint Velocity JCS  ',
     &                   'Joint Accel JCS     ',  'Joint Axes JCS      ',
     &                   'Joint Angle Euler   ',  'Joint Velocity Euler',
     &                   'Joint Accel Euler   ',  'Joint Axes Euler    ',
     &                   'Joint Load Validity ',  'Joint Load Calc Type',
     &                   'Joint Load GCS      ',  'Joint Load JCS      ',
     &                   'Joint Load Dist LCS ',  'Joint Load Prox LCS ',
     &                   'Joint Leg Load JCS  ',  'Joint Leg Load GCS  ',
     &                   'Joint Load Wrench   ',  'Joint Power Transfer',
     &                   'Joint Leg Power     ',  'Joint Finite Screw  ',

     &                   'Avg Segment Position',  'Avg Joint Angle JCS ',
     &                   'Avg Joint Angle EUL ',

     &                   'Rec Foot Load LCS   ',  'Rec Foot Load GCS   ',
     &                   'Rec Ft Cntr Pres LCS',  'Rec Ft Cntr Pres GCS',
     &                   'Rec Combined GRL    ',  'Rec Combined CP     ',
     &                   'Rec Ft Strike Index ',

     &                   'EMG Parameters      ',  'EMG Data            ',
     &                   'Seg Instant Screw   ',  'Joint Instant Screw ',
     &                   'Plate GRL Validity  ',  'Comb GRL Validity   ',
     &                   'Foot GRL in LCS     ',  'Joint Trans GCS     ',
     &                   'Joint Trans JCS     ',  'Joint Trans Prox LCS',
     &                   'Joint Trans Dist LCS',
     &                   'Jnt Screw Ang JCS   ',  'Jnt Fsc Ang Prox LCS',
     &                   'Jnt Fsc Ang Dist LCS',
     &                   'Pitch Moment Arm Pnt',  'Pitch Moment Arm Trk',
     &                   'Pitch Moment Arm Plv',  'Pitch Moment Arm GCS',
     &                   'Pitch Wrench Arm Pnt',  'Pitch Wrench Arm Trk',
     &                   'Pitch Wrench Arm Plv',  'Pitch Wrench Arm GCS',
     &                   'Jnt Mom Arm Prox LCS',  'Jnt Mom Arm Dist LCS',
     &                   'Joint Moment Arm GCS',
     &                   'Jnt Wre Arm Prox LCS',  'Jnt Wre Arm Dist LCS',
     &                   'Joint Wrench Arm GCS',
     &                   'Marker Velocity     ',  'Marker Acceleration ',
     &                   'Ind Ft GRL Integral2',  'Comb GRL Integral2  ',
     &                   'Plate GRL Integral2 ',  'Ft GRL CP Velocity  ',
     &                   'Seg Pos Correct Trfm',  'Jnt Ang Correct Trfm',
     &                   'Calculation Flags   ',  'Body CM Velocity    ',
     &                   'Calculation History ',  
     &                   'Segment/Joint Info  ',
     &                   'Joint Ext Load GCS  ',  'Joint Ext Load JCS  ',
     &                   'Joint Ext Load Pro  ',  'Joint Ext Load Dis  ',
     &                   'JRL Angle GCS       ',  'JRL Angle Proximal  ',
     &                   'JRL Angle Distal    ',                      
     &                   'Joint GRL Dist GCS  ',
     &                   'Joint GRL Dist Prox ',  'Joint GRL Dist Dist ',
     &                   'Jnt Mechanical Work ',  'Leg Mechanical Work ',
     &                   'Body Mechanical Work',
     &                   'Dynam Jnt Center GCS',  'Dynam Jnt Cntr Prox ',
     &                   'Dynam Jnt Cntr Dist ',
     &                   'Avg Jnt Cntr Prox   ',  'Avg Jnt Cntr Dist   '/
