Challenge

Project-1: Modelling an electric Car with Li-ion battery

1.Create a MATLAB model of electric car which uses lithium ion battery and suitable motor. Choose suitable blocks from Simscape or Powertrain block set. Implement the vehicle speed control using PI controller and generate brake and accelerator commands. Avoid using readymade driver block for speed control.

Prepare a report about your model including following:

Objectives, System level configurations, Model parameters, Results, Conclusion.

ANS =>

System level configuration:

Drive cycle:

PID controller subsystem:

Sum Block:

Sum:

Add or subtract inputs

Library:

Simulink Math Operations and Fixed-Point Blockset Math

Discription:

The Sum block performs addition or subtraction on its inputs. This block can add or subtract scalar, vector, or matrix inputs. It can also collapse the elements of a single input vector.

You specify the operations of the block with the List of Signs parameter. Plus (+), minus (-), and spacer (|) characters indicate the operations to be performed on the inputs:

  • If there are two or more inputs, then the number of characters must equal the number of inputs. For example, "+-+" requires three inputs and configures the block to subtract the second (middle) input from the first (top) input, and then add the third (bottom) input.
  • All nonscalar inputs must have the same dimensions. Scalar inputs will be expanded to have the same dimensions as the other inputs.
  • A spacer character creates extra space between ports on the block's icon.
  • If only addition of all inputs is required, then a numeric parameter value equal to the number of inputs can be supplied instead of "+" characters.
  • if only one vector is input, then a single "+" or "-" will collapse the vector using the specified operation.

When the Show additional parameters check box is selected, some of the parameters that become visible are common to many blocks. For a detailed description of these parameters, refer to Block Parameters in the Fixed-Point Blockset documentation.

Data Type Support:

The Sum block accepts signals of any complexity and data type, including fixed-point data types, except int64 and uint64. The inputs may be of different data types unless the Require all inputs to have same data type parameter is selected.

Parametar And Dialog Box:

Show additional parameters:

If selected, additional parameters specific to implementation of the block become visible as shown.

Icon shape:Designate the icon shape of the block.

List of signs:Enter as many plus (+) and minus (-) characters as there are inputs. Addition is the default operation, so if you only want to add the inputs, enter the number of input ports. For a single vector input, "+" or "-" will collapse the vector using the specified operation.You can manipulate the positions of the input ports on the block icon by inserting spacers (|) between the signs in the List of signs parameter. For example, "++|--" creates an extra space between the second and third input ports.

Require all inputs to have same data type:Select this parameter to require that all inputs must have the same data type.

Output data type mode:Specify the output data type and scaling to be the same as the first input, or inherit the data type and scaling from an internal rule or by backpropagation. You can also choose a built-in data type from the drop-down list. Lastly, if you choose, the Output data type, Output scaling value, and Lock output scaling against changes by the autoscaling tool parameters become visible.

Output data type:Specify any data type, including fixed-point data types. This parameter is only visible if is selected for the Output data type mode parameter.

Output scaling value:Set the output scaling using radix point-only or [Slope Bias] scaling. This parameter is only visible if is selected for the Output data type mode parameter.

Lock output scaling against changes by the autoscaling tool:If selected,Scalling of out-put is locked.This parameter is only visible if is selected for the Output data type mode parameter.

Round integer calculations toward:Select the rounding mode for fixed-point output.

Saturate on integer overflow:If selected, overflows saturate.

Conversion and Operations:

The Sum block first converts the input data type(s) to the output data type using the specified rounding and overflow modes, and then performs the specified operations. Refer to Rules of Artimetic operation in the Fixed-Point Blockset documentation for more information about the rules that this block obeys when performing fixed-point operations.

Characteristics:

Dimensionalized Yes
Direct Feedthrough Yes
Sample Time Inherited from driving blocks
Scalar Expansion Yes
States 0
Zero Crossing No

PID Controller:

Parameters:

Saturation Block:

Parameters:

Acceleration:

Deceleration:

This block helps to limit the output signal from pid controller and separate deceleration and acceleration values.

The output from these blocks is sent to a transfer function then these are provided to motor controller block.

Motor Controller Subsystem:

  • Controlled Voltage Source:
    • The Controlled Voltage Source block represents an ideal voltage source that is powerful enough to maintain the specified voltage at its output regardless of the current flowing through the source.

    • The output voltage is V = Vs, where Vs is the numerical value presented at the physical signal port.

  • Controlled PWM Voltage:
    • The Controlled PWM Voltage block represents a pulse-width modulated (PWM) voltage source. The block has two modeling variants,
    • Electrical input ports — The block calculates the duty cycle based on the reference voltage across its ref+ and ref- ports. This modeling variant is the default.

    • PS input — Specify the duty cycle value directly by using an input physical signal port.

    • For the Electrical input ports variant of the block, the demanded duty cycle is

      100∗Vref−VminVmax−Vmin %">100∗Vref−VminVmax−Vmin%100

      where:

    • Vref is the reference voltage across the ref+ and ref- ports.

    • Vmin is the minimum reference voltage.

    • Vmax is the maximum reference voltage.

  • H-Bridge:
    • This block is used to change the polarity of the voltage applied across the DC motor so as to run the motor in forward and reverse direction as per the input command.

    • Current Sensor:
      • This block is used to measure the flow of current through a circuit

Motor Subsystem:

  • DC motor:
    • To convert the electrical energy to mechanical energy we use motors. In this electric vehicle model, we have used DC motor. This motor can act as a generator also in case of regenerative braking.

  • Sensor:

  • deal Rotational Motion Sensor Block:
  • the output from this block is in rad/sec. so, unit conversion is done in ps-simulink converter block.

Battery Subsystem:

  • Controlled Current Source:
    • The Controlled Current Source block converts the Simulink input signal into an equivalent current source. The generated current is driven by the input signal of the block.
  • Li-ion battery:
    • The Battery block implements a generic dynamic model that represents most popular types of rechargeable batteries.

Vehicle Body Subsystem:

  • Fixed Gear:
    • The Simple Gear block represents a gearbox that constrains the connected driveline axes of the base gear, B, and the follower gear, F, to corotate with a fixed ratio that is specified.

  • Inertia:
    • The Inertia block represents an ideal mechanical rotational inertia.

  • Tire (Magic Formula):
    • The Tire (Magic Formula) block models a tire with longitudinal behavior given by the Magic Formula an empirical equation based on four fitting coefficients. The block can model tire dynamics under constant or variable pavement conditions.

  • Vehicle Body:
    • The Vehicle Body block represents a two-axle vehicle body in longitudinal motion. The vehicle can have the same or a different number of wheels on each axle. For example, two wheels on the front axle and one wheel on the rear axle. The vehicle wheels are assumed identical in size. The vehicle can also have a center of gravity (CG) that is at or below the plane of travel.
    • The block accounts for body mass, aerodynamic drag, road incline, and weight distribution between axles due to acceleration and road profile. Optionally include pitch and suspension dynamics. The vehicle does not move vertically relative to the ground.
    • The block has an option to include an externally-defined mass and an externally-defined inertia. The mass, inertia, and center of gravity of the vehicle body can vary over the course of simulation in response to system changes.

Result Plot:

Reference voltage vs vehicle velocity

Reference voltage Vs State Of Charge(SOC):

SOC,Current,Voltage:

We Can Change the DC Voltage: We, Get Sum Changes in Out-Put Graph Shown in Below,

Reference voltage vs vehicle velocity

Reference voltage Vs State Of Charge(SOC):

SOC,Current,Voltage:

Conclusion:

MATLAB model of electric car which uses lithium-ion battery and suitable motor is created.

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.