% Ivar Roskifte Leikarnes
% 140265
% ile012
% 
% Sript for simulating a hybrid electric vehicle
% Base vehicle Toyota Prius 2010

%% Mechanical Modelling
%
 
% Wheels
Vehicle.Wheel.Radius = 0.3;                                           % Radius of wheel in meters
% Dry asphalt
Vehicle.Wheel.Rolling_coefficient = 0.012;                            % Rolling coefficient, wheels
Vehicle.Wheel.Static_friction = 0.7;                                  % Normal tires, "all weather"
Vehicle.Wheel.Kinetic_friction = Vehicle.Wheel.Static_friction - 0.1; % Dry weather

% Vehicle body
Vehicle.Drag_coefficient = 0.25;     % Drag coefficient. Cd = viscous drag coefficient
Vehicle.Mass = 1380;                 % Mass of vehicle in kg
Vehicle.Frontal_area = 0.3;          % Frontal area of the vehicle (23.4 ft^2)

Vehicle.CG_to_front = 1.08;          % Weight distribution percentage about 60/40 (front/rear) 
Vehicle.CG_to_rear = 1.62;           % CG distance = Wheelbase*(1-weight distribution)
Vehicle.CG_height = 0.5;             % Could not find specific value. Used default value (0.5m)

Vehicle.Headwind = 0;                % External headwind to the vehicle
Vehicle.Road_incline = 0;            % Incline of the road


% Engine
Engine.max_power = 73e3;             % Engine max power i watts, 73kW
Engine.rpm_at_max_power = 5.2e3;     % Engine speed at max power, 5200rpms
Engine.max_rpm = 5.5e3;              % Engine max rpms, 5500rpms
Engine.inertia = 0.2;                % Inertia of the engine
Engine.friction = 0;                 % Friction in the engine
Engine.stall_rpm = 500;              % Engine speed at which the engine stalls
Engine.start_rpm = 1000;             % Speed at which the engine enables

% Gears 
Gear.Planetary.Power_split.Ring = 78;                
Gear.Planetary.Power_split.Carrier = 23;             
Gear.Planetary.Power_split.Sun = 30;                  

Gear.Planetary.Speed_reduction.Ring = 58;            
Gear.Planetary.Speed_reduction.Carrier = 18;         
Gear.Planetary.Speed_reduction.Sun = 22;             

Gear.Simple.Counter_gear.Base = 54;                  
Gear.Simple.Counter_gear.Follower = 55;              

Gear.Simple.Final_drive.Base = 24;                   
Gear.Simple.Final_drive.Follower = 77;              


%% Electrical Modelling

% Battery
Electrical.Battery.Nominal_voltage = 201.6;    % Nominal voltage of battery (V)
Electrical.Battery.Rated_capacity = 6.5;       % Capacity in ampere hours (Ah)
Electrical.Battery.Initial_SOC = 75;           % Percentage of battery capacity. State of charge.

% DCDC converter
Electrical.DCDC.output_voltage = 650;          % Output voltage of DCDC converter
Electrical.DCDC.output_power = 27e3;           % Output power of DCDC converter
Electrical.DCDC.Converter_efficiency = 1;      % Efficiency of DCDC converter (set to 100%)

% Motor
% Used for propulsion and regenerative braking
Electrical.Motor.Torque_vector = [205 205 190 100 80 50 30 20];      % Vector of maximum torque values
Electrical.Motor.rpm_vector = [0 2e3 3e3 5e3 6e3 8e3 11e3 13.5e3] ;  % Vector of rotational speeds

% Generator
Electrical.Generator.Torque_vector = [205 205 190 100 80 50 30 20];      % Vector of maximum torque values
Electrical.Generator.rpm_vector = [0 2e3 3e3 5e3 6e3 8e3 11e3 13.5e3] ;  % Vector of rotational speeds

%% Control block

% Lowpass filter constant
Control.Lowpass_filter.fc = 20;

% Electric machine
Control.Vref = 5; 
Control.Motor.Speed_ref = 13500;
Control.Generator.Speed_ref = 13500;

Control.Motor.Max_trq = 205;
Control.Generator.Max_trq = 205;

Control.Engine.Start_rpm = 1000;
Control.Engine.Max_operating_rpm = 5200;

















