You are on page 1of 32

E-Bike Batttery Charging Model: Overview of the MATLAB Environment The MATLAB high-performance language for technical and

computing

integrates

computation,

visualization,

programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include

* * * * * * *

Math and computation Algorithm development Data acquisition Modeling, simulation, and prototyping Data analysis, exploration, and visualization Scientific and engineering graphics Application development, including graphical user

interface building

MATLAB is an interactive system whose basic data element is an array that does not require dimensioning. It allows you to solve many technical computing problems, especially those with matrix and vector formulations, in a fraction of the time it would take to

write a program in a scalar noninteractive language such as C or Fortran. The name MATLAB stands for matrix laboratory. MATLAB was originally written to provide easy access to matrix software developed by the LINPACK and EISPACK projects. Today, MATLAB engines incorporate the LAPACK and BLAS libraries, embedding the state of the art in software for matrix computation.

MATLAB has evolved over a period of years with input from many users. In university environments, it is the standard instructional tool for introductory and advanced courses in mathematics, engineering, and science. In industry, MATLAB is the tool of choice for high-productivity research, development, and analysis.

MATLAB features a family of add-on application-specific solutions called toolboxes. Very important to most users of MATLAB, toolboxes allow you to learn and apply specialized technology. Toolboxes are comprehensive collections of MATLAB functions (Mfiles) that extend the MATLAB environment to solve particular classes of problems. You can add on toolboxes for signal processing, control systems, neural networks, fuzzy logic, wavelets, simulation, and many other areas.

THE MATLAB SYSTEM The MATLAB system consists of these main parts: Desktop Tools and Development Environment This is the set of tools and facilities that help you use and become more productive with MATLAB functions and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and Command Window, a command history, an editor and debugger, a code analyzer and other reports, and browsers for viewing help, the workspace, files, and the search path. Mathematical Function Library This is a vast collection of computational algorithms ranging from elementary functions, like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigenvalues, Bessel functions, and fast Fourier transforms.

The Language This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and objectoriented programming features. It allows both "programming in the small" to rapidly create quick and dirty throw-away programs, and "programming in the large" to create large and complex application programs.

Graphics MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. It includes high-level functions for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level functions that allow you to fully customize the appearance of graphics as well as to build complete graphical user interfaces on your MATLAB applications. External Interfaces This is a library that allows you to write C and Fortran programs that interact with MATLAB. It includes facilities for calling routines from MATLAB (dynamic linking), for calling MATLAB as a computational engine, and for reading and writing MAT-files.

SIMULINK: Simulink Overview: Simulink software models, simulates, and analyzes dynamic systems. It enables you to pose a question about a system, model the system, and see what happens.

With Simulink, you can easily build models from scratch, or modify existing models to meet your needs. Simulink supports

linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two. Systems can also be multirate having different parts that are sampled or updated at different rates.

Thousands of scientists and engineers around the world use Simulink to model and solve real problems in a variety of industries, including:

* Aerospace and Defense * Automotive * Communications * Electronics and Signal Processing * Medical Instrumentation

Tool for Model-Based Design: With Simulink, you can move beyond idealized linear models to explore more realistic nonlinear models, factoring in friction, air resistance, gear slippage, hard stops, and the other things that describe real-world phenomena. Simulink turns your computer into a laboratory for modeling and analyzing systems that would not be possible or practical otherwise.

Whether you are interested in the behavior of an automotive clutch system, the flutter of an airplane wing, or the effect of the monetary supply on the economy, Simulink provides you with the tools to model and simulate almost any real-world problem. Simulink also provides demos that model a wide variety of realworld phenomena (see Simulink Demo Models).

Simulink provides a graphical user interface (GUI) for building models as block diagrams, allowing you to draw models as you would with pencil block and paper. of Simulink sinks, also includes linear a comprehensive library sources, and

nonlinear components, and connectors. If these blocks do not meet your needs, however, you can also create your own blocks. The interactive graphical environment simplifies the modeling process, eliminating the need to formulate differential and difference equations in a language or program Simulink Basics: Starting the Simulink Engine: o start the Simulink software, you must first start the MATLAB technical computing environment. Consult your MATLAB documentation for more information. You can then start the Simulink software in two ways:

* On the toolbar, click the Simulink icon. * Enter the simulink command at the MATLAB prompt.

The Library Browser appears. It displays a tree-structured view of the Simulink block libraries installed on your system. You build models by copying blocks from the Library Browser into a model window (see Editing Blocks).

The Simulink library window displays icons representing the preinstalled block libraries. You can create models by copying blocks from the library into a model window.

How Simulink Works: Simulink is a software package that enables you to model, simulate, and analyze systems whose outputs change over time. Such systems are often referred to as dynamic systems. The Simulink software can be used to explore the behavior of a wide range of real-world dynamic systems, including electrical circuits, shock absorbers, braking systems, and many other electrical,

mechanical, and thermodynamic systems. This section explains how Simulink works.

Simulating a dynamic system is a two-step process. First, a user creates a block diagram, using the Simulink model editor, that graphically depicts time-dependent mathematical relationships among the system's inputs, states, and outputs. The user then commands the Simulink software to simulate the system represented by the model from a specified start time to a specified stop time.

BLOCK EXPLANATION: Sim Power Systems: Introduction SimPowerSystems software and other products of the Physical Modeling product family work together with Simulink software to model electrical, mechanical, and control systems. The Role of Simulation in Design Electrical power systems are combinations of electrical circuits and electromechanical devices like motors and generators. Engineers working in this discipline are constantly improving the performance of the systems. Requirements for drastically increased efficiency have forced power system designers to use

power

electronic

devices

and

sophisticated

control

system

concepts that tax traditional analysis tools and techniques. Further complicating the analyst's role is the fact that the system is often so nonlinear that the only way to understand it is through simulation.

Land-based power generation from hydroelectric, steam, or other devices is not the only use of power systems. A common attribute of these systems is their use of power electronics and control systems to achieve their performance objectives.

SimPowerSystems software is a modern design tool that allows scientists and engineers to rapidly and easily build models that simulate power systems. It uses the Simulink environment, allowing you to build a model using simple click and drag procedures. Not only can you draw the circuit topology rapidly, but your analysis of the circuit can include its interactions with mechanical, thermal, control, and other disciplines. This is possible because all the electrical parts of the simulation interact with the extensive Simulink modeling library. Since Simulink uses the MATLAB computational engine, designers can also use MATLAB toolboxes and Simulink blocksets. SimPowerSystems software belongs to the Physical Modeling product family and uses similar block and connection line interface.

SimPowerSystems Libraries SimPowerSystems libraries contain models of typical power equipment such as transformers, lines, machines, and power electronics. These models are proven ones coming from textbooks, and their validity is based on the experience of the Power Systems Testing and Simulation Laboratory of HydroQubec, a large North American utility located in Canada, and also on the experience of cole de Technologie Suprieure and Universit Laval. The capabilities of SimPowerSystems software for modeling a typical electrical system are illustrated in demonstration files. And for users who want to refresh their knowledge of power system theory, there are also self-learning case studies. The SimPowerSystems main library, powerlib, organizes its blocks into libraries according to their behavior. The powerlib library window displays the block library icons and names. Double-click a library icon to open the library and access the blocks. The main powerlib library window also contains the Powergui block that opens a graphical user interface for the steady-state analysis of electrical circuits. Nonlinear Simulink Blocks for SimPowerSystems Models The nonlinear Simulink blocks of the powerlib library are stored in a special block library named powerlib_models. These masked Simulink models are used by SimPowerSystems software to build the equivalent Simulink model of your circuit.

This Project deals with the battery charging of an electric bile while it moves down a slope. The project represents the electrical appliances like horns, head light, tail lamps, indicators etc in the form of a load resistor in parallel to the battery. The same battery drives the motor and the all these electrical devices, and eventually, the battery gets exhausted. Normally, in a electric bike there will be a controller which detects the charge of the battery and gives indication. Here in this project in order to illustrate the charging and discharging of the battery, we program the controller in such a manner that the motor acts As generator when the battery reaches 40% of its level. At the start of the simulation, the DC machine is started with the battery power. The speed increases to 120 rad/s. The battery is also discharged by the constant DC load of 50 amps. When the SOC drops under 0.4, a mechanical torque of -200 Nm is applied so the machine acts as a generator and provides a current of 100 amps. Hence, 50 amps goes to the load and 50 amps goes to recharge the battery. When the SOC goes over 0.8, the

mechanical torque is removed and the machine operates freely. And then the cycle restarts.

DC Machines: Dc machines are characterized by their versatility. By means of various combinations of shunt-, series-, and separately-excited field windings they can be designed to display a wide variety of volt-ampere or speed-torque characteristics for both dynamic and steady-state operation. Because of the ease with which they can be controlled, systems of dc machines have been frequently used in applications requiring a wide range of motor speeds or precise control of motor output.

Dc Motor: DC Motors are classified as brushless and brushed dc motors. The brushed dc motors are mainly shunt series and compound motors.

The dc machines used may be shunt when the speed should remain at constant speed as motors in mills etc and when starting torque should be very high we choose series motors. When we provide electrical energy to the dc machines the output will be mechanical torque and hence called a motor. If the mechanical torque is provided to the machine the output will electrical. Here we use all these functionality of a dc machine for charging the battery and vehicle movement. Matlab Documentation:

The Battery block implements a generic model parameterized to represent most popular types of rechargeable batteries. The equivalent circuit of the battery is shown below:

where, E = No load voltage (V)

E0 = Constant voltage (V) K = Polarization voltage (V) Q = Battery capacity (Ah) A = Exponential voltage (V) B = Exponential capacity (Ah)

Dialog ox and Parameters

Battery type Provides a set of predetermined discharge curves for four types of battery:

No (User-Defined) Lead-Acid Lithium-Ion Nickel-Cadmium

Nickel-Metal-Hydride

Select one of these preset models to load the corresponding parameters in the entries of the dialog box. Select No (UserDefined) if you do not want to use a preset model. When one of the preset models is used, the detailed parameters (that are visible when you select the Show detailed parameters check box) cannot be modified. If you want to modify the discharge curve, select the desired battery type to load the default parameters, and then select No (User-Defined) to access the detailed parameters. Nominal Voltage The nominal voltage of the battery (Volts). Rated Capacity The rated capacity (Q) of the battery in ampere-hour. The rated capacity is the minimum effective capacity of the battery. The maximum theoretical capacity (when the voltage crosses 0 volts) is generally equal to 105% of the rated capacity. So when you enter the rated capacity, the maximum Q is 1.05*Q. Initial State-Of-Charge The initial State-Of-Charge (SOC %) of the battery. 100% indicates a fully charged battery and 0% indicates an empty

battery. This parameter is used as an initial condition for the simulation and does not affect the discharge curve. Show detailed parameters If selected, the dialog box displays the detailed parameters of the Battery block. The detailed parameters can be modified by setting Battery type to No (User-Defined). Full charge voltage The voltage factor (% of the nominal voltage) corresponding to the fully charged voltage, for a given nominal discharge current. For example, a battery cell with a nominal voltage of 1 volt and a fully charged voltage factor of 110% has a fully charged voltage of 1.1 volt. Note that the fully charged voltage is not the no-load voltage. Nominal Discharge Current The nominal discharge current (% of the rated

capacity/1hour), for which the discharge curve has been measured. For example, a typical discharge current for a 1.5 Ah NiMH battery is 20%: (0.2 * 1.5 Ah / 1h = 0.3A). Internal Resistance The internal resistance of the battery (ohms). When a preset model is used, a generic value is loaded, corresponding to the nominal voltage and the rated capacity of the battery.

The resistance is supposed to be constant during the charge and the discharge cycles and does not vary with the amplitude of the current. Capacity @ Nominal Voltage The capacity (% of the rated capacity) extracted from the battery until the voltage drops under the nominal voltage. This value should be between 0% and 100%. Exponential zone The voltage (% of the nominal voltage) corresponding to the end of the exponential zone. For example, a battery with a nominal voltage of 1 volt and an exponential voltage of 105% indicates that the exponential zone ends at 1.05 volt. The capacity (% of the rated capacity) extracted from the battery until the voltage drops under the exponential voltage. This value should be between 0% and 100%. Plot Discharge Characteristics Plots a figure containing two graphs. The first graph represents the nominal discharge curve (at the Nominal Discharge Current) and the second graph represents the discharge curves at the specified discharge currents. When the check box is selected, the graph remains on and updates itself when a parameter changes in the dialog box. To clear the figure, clear the check box and close the figure.

Discharge current Allows to specify different values of discharge current. The discharge characteristics for these currents are presented in the second part of the graph. Units Choose either Time or Ampere-hour as the x-axis for the plot. DC Machine:

The DC Machine block implements a separately excited DC machine. An access is provided to the field terminals (F+, F-) so that the machine model can be used as a shunt-connected or a seriesconnected DC machine. The torque applied to the shaft is provided at the Simulink input TL. The armature circuit (A+, A-) consists of an inductor La and resistor Ra in series with a counter-electromotive force (CEMF) E.

In a separately excited DC machine model, the voltage constant KE is proportional to the field current If:

where Laf is the field-armature mutual inductance. The electromechanical torque developed by the DC machine is proportional to the armature current Ia.

where KT is the torque constant. The sign convention for Te and TL is

The torque constant is equal to the voltage constant.

The armature circuit is connected between the A+ and A- ports of the DC Machine block. It is represented by a series Ra La branch in series with a Controlled Voltage Source and a Current Measurement block.

The field circuit is represented by an RL circuit. It is connected between the F+ and F- ports of the DC Machine block.

The mechanical part computes the speed of the DC machine from the net torque applied to the rotor. The speed is used to implement the CEMF voltage E of the armature circuit. The mechanical part is represented by Simulink blocks that implement the equation

where J = inertia, Bm = viscous friction coefficient, and Tf = Coulomb friction torque.

Dialog Box Parameters:

Preset Model Provides a set of predetermined electrical and mechanical parameters for various DC machine ratings of power (HP), DC voltage (V), rated speed (rpm), and field voltage (V). Select one of the preset models to load the corresponding electrical and mechanical parameters in the entries of the dialog box. Select No if you do not want to use a preset model. Mechanical input

Allows you to select either the torque applied to the shaft or the rotor speed as the Simulink signal applied to the block's input. Select Torque Tm to specify a torque input, in N.m or in pu, and change labeling of the block's input to Tm. The machine speed is determined by the machine Inertia J (or inertia constant H for the pu machine) and by the difference between the applied mechanical torque Tm and the internal electromagnetic torque Te. The sign convention for the mechanical torque is the following: when the speed is positive, a positive torque signal indicates motor mode and a negative signal indicates generator mode. Select Speed w to specify a speed input, in rad/s or in pu, and change labeling of the block's input to w. The machine speed is imposed and the mechanical part of the model (Inertia J) is ignored. Using the speed as the mechanical input allows modeling a mechanical coupling between two machines and interfacing with SimMechanics and SimDriveline models. The next figure indicates how to model a stiff shaft interconnection in a motor-generator. The speed output of machine 1 (motor) is connected to the speed input of machine 2 (generator), while machine 2 electromagnetic torque output Te is applied to the mechanical torque input Tm of machine 1. The Kw factor takes into account speed

units of both machines (pu or rad/s) and gear box ratio. The KT factor takes into account torque units of both machines (pu or N.m) and machine ratings. Also, as the inertia J2 is ignored in machine 2, J2 referred to machine 1 speed must be added to machine 1 inertia J1.

Relay: The Relay block allows its output to switch between two specified values. When the relay is on, it remains on until the input drops below the value of the Switch off point parameter. When the relay is off, it remains off until the input exceeds the value of the Switch on point parameter. The block accepts one input and generates one output.

The Switch on point value must be greater than or equal to the Switch off point. Specifying a Switch on point value greater than the Switch off point value models hysteresis, whereas specifying equal values models a switch with a threshold at that value.

Dialog Box Parameters:

Switch on point

The "n" threshold for the relay. The Switch on point parameter is converted to the input data type offline using round-to-nearest and saturation. Switch off point The "off" threshold for the relay. The Switch off point parameter is converted to the input data type offline using round-to-nearest and saturation. Output when on The output when the relay is on. Output when off The output when the relay is off. Enable zero crossing detection Select to enable zero crossing detection to detect switch-on and switch-off points. For more information, see ZeroCrossing Detection . Sample time (-1 for inherited) Specify the time interval between samples. To inherit the sample time, set this parameter to -1.

Block diagram:

The block diagram clearly explains the the model function. The battery level is constantly noted and when the battery charge becomes less than 40 percent the relay switches and the motor is provided an external torque which charges the battery again. Once the battery is charged, the battery powers the motor. This cycle is carried on continuously. In a e-bike, the charging is happened when the vehicle is moving through a down slope or when plugged into utility.The waveforms are as shown below.

Output Waveform:

You might also like