Major Project Report Final
Major Project Report Final
Braking System
MAJOR PROJECT REPORT
BACHELOR OF
TECHNOLOGY IN
MECHANICAL ENGINEERING
SUBMITTED BY:
Sarim Hashmi(19BME060)
Adnan Qayyum Khan ( 19BME010)
Ansharah Laraib (19BME031)
Zain Zahid(19BME064)
UNDER THE SUPERVISION OF
Prof. S.M. Muzzakir
2023
1
2
ACKNOWLEDGEMENT
We are highly indebted to our supervisor Prof. S.M Muzakkir. We are also thankful to
Prof. Harish Hirani (IIT-D) for their able guidance, which has always been a source of
inspiration to us. We are lucky to get such a great opportunity to work under him. We
would like to thank him for his valuable suggestions and perpetual encouragement to
improve our personality and boost it up to practical life.
We would also like to pay our sincere gratitude to Prof. Zahid Akhtar Khan Head
of Department, Mechanical Engineering, Faculty of Engineering & Technology, Jamia
Millia Islamia, without whose guidance and support, this project would not have been
possible.
We would like to thank Prof. Mohd Suhaib for their support & encouragement.
We are highly indebted to them for their timely & scholarly advice & scientific approach
which helped us in accomplishing this task.
We would like to take this opportunity to express our sincere indebtedness and sense of
gratitude to all those who have contributed greatly towards the successful completion of
this project.
3
4
CERTIFICATION
This is to certify that this Major Project of the topic “Design, Modeling and
Simulation of Magnetorheological Braking System’’ has been successfully
completed under the supervision of Prof S.M. Muzakkir.
5
6
CONTENT
Title Page Number
Abstract 8
1. Introduction and Literature Review
1.1. Introduction 9-11
2.1. Literature Review 12-14
3. Methodology 16-27
3.1. Model-Based Systems Engineering of Conventional Braking System 17-19
3.2. Using Gaphor to create a SysML model of Conventional Braking System 19-21
3.3. Create a Conventional braking system in OpenModelica 21-23
3.4. Simulating the system using standard testing procedures 23-25
3.5. Comparison of results with standard value 25-28
4. Modeling & Simulation using Open Modelica and Python 29-34
Part A : Study of Conventional Braking System 29-31
Part B : Study of Magneto-rheological braking System 31-34
5. Results and Discussion 35-39
References 42-43
Annexure A 44-71
7
ABSTRACT
The automobile industry relies on effective braking systems to ensure safe and controlled
stops. Traditional braking systems like hydraulic and mechanical brakes have been the
industry standard, continuously improving in performance and safety features over time.
However, the rapid advancement of technology calls for new braking systems that offer
higher levels of performance, efficiency, active control, and safety. One promising
technology is magnetorheological braking systems (MRBs), which utilise
magnetorheological fluids to control braking force and enhance stopping power. MRBs
offer advantages such as shorter stopping distances, increased safety, and responsiveness
to driving conditions. This study proposes a methodology for designing and configuring
braking parameters in conventional systems using the OpenModelica platform and
Python for modelling and controlling various parameters. The methodology can be
extended to incorporate additional parameters specific to Magnetorheological braking
systems.
8
9
Chapter 1
Introduction And Literature Review
Braking systems play a vital role in ensuring the safety and control of automobiles
during deceleration and stopping. Over the years, traditional braking systems, such
as hydraulic and mechanical brakes, have been widely employed in the automotive
industry, continuously evolving to improve performance and safety. However, the
ever-growing demand for enhanced performance, efficiency, and safety calls for
the exploration of novel braking technologies. One such promising technology that
has garnered significant attention is magnetorheological braking systems (MRBs).
10
Fig. 1 Orthogonal and Sectional Views of MRBs
11
1.2 PROSPECT OF STUDY
The design, modelling, and simulation of magnetorheological braking systems
present intriguing avenues for research and engineering exploration. These systems
offer numerous advantages over conventional braking systems, including shorter
stopping distances, improved safety, and enhanced adaptability to varying driving
conditions. Exploring the design aspects and modelling techniques associated with
MRBs can lead to innovative braking system configurations that maximise
performance and efficiency while ensuring optimal control and safety.
12
2 LITERATURE REVIEW
In this section, the literature review required for the present work has been dealt in a
thorough manner as well as describing the shortcomings of the work done on the topic till
date.
13
Nguyen and Choi (2012) used FEA to predict the magnetic density across MR
gaps and rheological properties of MR fluids, proposing a hybrid MR brake
configuration that offers improved performance for middle-sized motorcycles.
Nguyen et al. (2019) conducted an optimization procedure for an MR brake using
a first-order optimization method, considering maximum braking torque and mass.
The proposed brake design exhibited higher braking torque and a more compact
size compared to traditional designs.
While the literature review provides valuable insights into the design, modeling, and
simulation of MRBs, several potential gaps can be identified.
14
research on the implementation and practical performance of MRBs in real-world
scenarios. Further studies could focus on the integration of MRBs into actual
vehicles and evaluate their performance under various operating conditions.
3. Optimization beyond performance parameters: While optimization techniques
have been employed to enhance performance parameters like braking torque and
power consumption, there is a potential gap in exploring other aspects of MRB
design optimization, such as cost-effectiveness, manufacturability, and reliability.
4. Standardization and compatibility: As MRBs continue to evolve, there is a need
for standardization and compatibility among different MRB designs and control
systems. Future research could focus on establishing industry standards, protocols,
and interfaces to facilitate the integration of MRBs into different automotive
platforms.
5. Environmental impact assessment: With the increasing focus on sustainability and
environmental concerns, it would be valuable to conduct studies that assess the
environmental impact of MRBs compared to traditional braking systems.
Evaluating factors such as energy efficiency, material usage, and end-of-life
disposal could provide insights into the overall sustainability of MRBs.
15
Chapter 2
Problem Statement and Objectives
The automotive industry seeks to develop new braking systems that surpass the
limitations of traditional hydraulic and mechanical brakes. These new systems should
offer improved performance, efficiency, and safety. The study aims to address this need
by proposing a methodology for designing and configuring braking parameters using the
OpenModelica platform and Python. The methodology can be further expanded to
incorporate parameters specific to Magnetorheological braking systems.
16
Chapter 3
Methodology
3.1 - Model-based Systems Engineering(MBSE) of Conventional
braking system
In the context of a conventional braking system, MBSE can provide a structured
and systematic approach to design and analyze the system. It involves creating
models that capture the system's behaviour, components, interactions, and
requirements. These models help engineers simulate and evaluate the system's
performance, identify potential issues, and make informed design decisions.
To apply MBSE to the conventional braking system, we can break down the
process into several stages:
1 - Requirements Analysis: The first step is to gather and analyze the requirements
of the braking system. This involves understanding the desired performance,
safety standards, regulatory requirements, and other relevant factors. Engineers
can use modelling techniques, such as use case diagrams or requirement diagrams,
to capture and refine these requirements.
17
3 - Behavioural Modelling: Behavioural models capture the dynamic aspects of the
braking system. Engineers can use techniques like state diagrams or activity
diagrams to represent the system's behaviour during various scenarios, such as
normal braking, emergency braking, or anti-lock braking. These models allow
engineers to assess the system's response, validate its performance against
requirements, and refine the design if necessary.
18
By leveraging MBSE in the design of conventional braking systems, engineers can
benefit from a systematic and model-based approach. It allows for early detection
of design flaws, efficient optimization, and improved overall system performance.
Furthermore, MBSE facilitates collaboration, reduces development time, and
supports effective decision-making throughout the entire braking system
development lifecycle.
19
braking system, such as Brake Pedal, Master Cylinder, Brake Lines, Brake
Calipers, Brake Pads, and Brake Discs.
4 - Modelling Interactions:
In the IBD, create part properties within the blocks to represent the internal
structure of the components. For instance, within the Brake Caliper block, you can
add part properties for Brake Pads and Brake Discs. Connectors between the parts
represent the flow of signals or information.
5 - Defining Behaviours:
Utilize activity diagrams to define the behaviours and flow of actions in the
braking system. For example, you can model the activities related to the brake
pedal being pressed, the hydraulic pressure being generated, and the brake pads
making contact with the brake discs.
20
6 - Refining the Model:
Continue refining the model by adding more details, such as constraints,
requirements, and parametric diagrams to capture system constraints and
performance characteristics. You can also use state machine diagrams to represent
the different states of the braking system, such as "braking," "idle," or
"maintenance."
21
In OpenModelica, create a new model to represent the conventional braking
system. This model will consist of interconnected components that simulate the
behaviour of the system.
5 - Connect Components:
Create connections between the components to represent their interactions. Use
signals or variables to model the flow of information or physical interactions. For
example, connect the BrakePedal component to the MasterCylinder component to
represent the mechanical linkage between the two.
6 - Model Behavior:
Define the behaviour of the braking system by specifying the equations that
govern the system's dynamics. This can include equations related to pressure
changes, friction force, and the motion of brake pads and discs. Consider using
physical laws and empirical data to model these behaviours accurately.
22
the system's response under various conditions, such as different braking pressures
or vehicle speeds.
9 - Model Refinement:
Iteratively refine the model based on simulation results and feedback. Adjust
component parameters, equations, or connections to improve the model's accuracy
and capture the braking system's characteristics more effectively.
23
Fig 3. Plots related to the model under NEDC cycle.
This model requires the power train efficiency to be specified either directly on
the eleDrive mask or in a txt file. To replicate the results, you can use the
provided "EVmaps.txt." The brake action is simulated by adding a braking force
to the mass's flange_b. Although a more advanced brake model exists, it was not
chosen for simplicity over completeness. It's worth noting that the torque sum is
24
automatically performed by any Modelica tool, such as OpenModelica, as torque
is a flow variable and is algebraically summed up when multiple connectors are
connected. The requested braking force is only non-zero when the electric
braking from eleDrive is insufficient.
In practice, real EVs rely more on mechanical braking, which can be compared
with MR brake Plot d) presents energy-related information obtained using direct
equation writing. The energies include enBatDel (energy delivered by the
battery), enP1del (energy supplied to the left flange of mass), and enBattLoss
(battery power loss). The efficiency of the power train eleDrive affects the
difference between enBatDel and enP1Del. When "mapsOnFile" is set to false
and the default efficiency table is used (unity efficiency), the two curves overlap.
from enum import Enum: Imports the Enum class from the enum module. Enum is
used to define a set of named constants.
import matplotlib.pyplot as plt: Imports the pyplot module from the matplotlib
library, which is used for plotting graphs and charts.
VehicleCategory Enum:
This is a custom Enum class that represents different categories of vehicles related
to a conventional braking system.
25
This function calculates the Mean Fully Developed Deceleration (MFDD) of a
vehicle given its initial and final velocities, as well as the distances traveled.
get_x_for_rear_wheel_braking Function:
This function returns a variable (x) based on the vehicle category provided as an
argument.
This function calculates the stopping distance of a vehicle based on its velocity,
vehicle category, and the get_x function.
26
plot_stopping_distance_vs_velocity Function:
This function creates a graph that illustrates the relationship between velocity and
stopping distance for different vehicle categories.
The function uses the Matplotlib library to create subplots and plot the data.
It initializes a 2x2 subplot layout and defines a list of velocities and vehicle
categories.
The stopping distances for each velocity and category are calculated using a list
comprehension.
The stopping distances for each category are plotted on the respective subplot
along with appropriate labels and titles.
The subplots are adjusted for spacing, and the graph is displayed using plt.show().
Duplicate Function:
27
28
Chapter 4
Modelling & Simulation using
OpenModelica and Python
The study is going to be conducted in two parts:
2. Identify the key aspects of the conventional braking system to focus on in the study:
● Analyze the information gathered from the literature review to identify common
themes or areas of interest.
● Based on the analysis, select specific aspects of the conventional braking system
that will be the main focus of the study, such as braking performance, energy
efficiency, or safety.
● Clearly define the research objectives and questions related to the chosen aspects.
● Develop a plan or methodology for evaluating and measuring the chosen aspects,
considering the available resources and constraints.
29
Figure-3 Typical Automotive Braking System
30
Figure - 5 MBSE of Vehicle braking system
31
Part B: Study of MR Braking System
32
Figure 8 OpenModelica model of MR Brake
3. Simulate the MR braking system model in OpenModelica using standard input data.
This involves providing relevant parameters, such as vehicle speed, braking force, or
magnetic field strength, to the model and observing its response.
4. Compare the simulation results obtained from the MR braking system model with
established standard values or benchmarks. This step helps assess the accuracy and
reliability of the model in capturing the expected behaviour and performance of an MR
braking system.
33
Figure 9 Stopping distance and Velocity vs Time graph
5. Compare the simulated stopping distance obtained from the MR braking system model
with established standards or benchmarks. Stopping distance refers to the distance
travelled by the vehicle from the moment the brakes are applied until it comes to a
complete stop. This comparison will help evaluate the model's accuracy in predicting the
braking performance of an MR braking system.
34
● Provide a comprehensive discussion on the limitations and uncertainties associated
with the model's predictions and highlight areas for future improvement or
refinement.
By focusing on the comparison of stopping distance, we can assess the model's ability to
accurately predict braking performance and determine its usability in evaluating the
effectiveness of an MR braking system.
35
Chapter 5
Results and Discussion
Figure (a)
36
Figure (b)
37
Figure (c)
Figure (d)
Figure 8 - The above graph are Stopping Distance ( m ) vs Velocity ( m/s ) for 4 different
vehicle platform namely two wheel moped ( Figure (a) ) , Motor cycle ( Figure (b) ) ,
three wheel moped ( Figure © ) , Motorcycle with Sidecar ( Figure (d))
38
Figure - 9. MR braking distance (m) vs Time (s) and Current ( A ) vs Time (s)
The simulation results of the MR braking system model showed a comparable stopping
distance to the conventional braking system, indicating that MR brakes can be considered
as a viable option when designing a vehicle. The distance obtained is in line with what is
found in the BIS braking system testing standards, therefore it can be concluded that the
presented methodology successfully works when applied to conventional braking systems
of a two-wheeler vehicle. Further scope of this study on which it can be further built is
39
with regards to Magnetorheological brakes which can be tested and simulated in a similar
manner with changes being only in terms of the parameters wherein parameters such as
calliper and hydraulics will be replaced by MRF characteristics and intensity of current
and magnetic field etc.
40
Chapter 6
● High braking force: MR brakes can generate very high braking forces, making
them ideal for applications where high stopping power is required.
● Rapid response: MR brakes can respond to changes in speed very quickly,
making them ideal for applications where rapid braking is required.
● Low maintenance: MR brakes require very little maintenance, making them a
cost-effective option for long-term use.
● Long life: MR brakes have a long service life, making them a reliable option for
demanding applications.
● Environmentally friendly: MR brakes do not produce any emissions, making them
a more environmentally friendly option than traditional brakes.
● Compact and lightweight: MR brakes are typically smaller and lighter than
traditional brakes, making them a good option for applications where space and
weight are limited.
41
● Customizable: MR brakes can be customized to meet the specific requirements
of different applications. This makes them a versatile option for a wide range of
applications.
42
References
1. Hai, X., Zhang, S., & Xu, X. (2017, July). Civil aircraft landing gear brake system
development and evaluation using model based system engineering. In 2017 36th
Chinese Control Conference (CCC) (pp. 10192-10197). IEEE.
2. Kalikate, S. M., Patil, S. R., & Sawant, S. M. (2018). Simulation-based estimation
of an automotive magnetorheological brake system performance. Journal of
Advanced Research, 14, 43-51.
3. Nguyen, Q. H., & Choi, S. B. (2010). Optimal design of an automotive
magnetorheological brake considering geometric dimensions and zero-field
friction heat. Smart materials and structures, 19(11), 115024.
4. Simic, D. and Bauml, T., Implementation of Hybrid Electric Vehicles using the
Vehicle Interfaces and the Smart Electric Drives Libraries, Proceedings of the 6 th
International Modelica Conference, pp 557-563, Bielefeld, Germany, 2008.
5. Le, D. T., Nguyen, N. D., Le, D. T., Nguyen, N. T., Pham, V. V., & Nguyen, Q. H.
(2019), Development of Magnetorheological Brake with Tooth-Shaped Disc for
Small Size Motorcycle. In applied mechanics and materials ( pp 508 - 517 )
6. Sohn JW, Gang HG, Choi S-B. An experimental study on torque characteristics of
magnetorheological brake with modified magnetic core shape. Advances in
Mechanical Engineering. 2018;10(1). doi:10.1177/1687814017752222
7. Jung Woo Sohn and Juncheol Jeon and Quoc Hung Nguyen and Seung-Bok
Choi,Optimal design of disc-type magneto-rheological brake for mid-sized
motorcycle: experimental evaluation in journal Smart Materials and
Structures(2015),10.1088/0964-1726/24/8/085009
8. Jung Woo Sohn, Jong-Soek Oh, Seung-Bok Choi, Design of MR brake featuring
tapered inner magnetic core, Proc. SPIE 9431, Active and Passive Smart
Structures and Integrated Systems 2015, 943133 (2 April 2015);
https://doi.org/10.1117/12.2084137
9. Hadi Shamieh and Ramin Sedaghati 2017 , Multi-objective design optimization
and control of magnetorheological fluid brakes for automotive applications in
journal Smart Materials and Structures, Volume 26, Number 12
10. Zainordin A Z et al 2013 IOP Conf. Ser.: Mater. Sci. Eng. 50 012038
11. C. Rossa, A. Jaegy, J. Lozada and A. Micaelli, "Design Considerations for
Magnetorheological Brakes," in IEEE/ASME Transactions on Mechatronics, vol.
19, no. 5, pp. 1669-1680, Oct. 2014, doi: 10.1109/TMECH.2013.2291966.
12. Q H Nguyen et al 2015 Smart Mater. Struct. 24 067001 , DOI 10.1088 / 0964 -
1726 / 24 / 6 / 067001
13. Nguyen, Hung & Choi, S.. (2012). Optimal Design of a T-Shaped Drum-Type
Brake for Motorcycle Utilizing Magnetorheological Fluid. Mechanics Based
43
Design of Structures and Machines - MECH BASED DES STRUCT MECH. 40.
153-162. 10.1080 / 15397734 . 2011 . 616479.
14. Q H Nguyen and S B Choi 2012 Smart Mater. Struct. 21 055003
15. Nguyen ND, Le-Duc T, Hiep LD, Nguyen QH. Development of a new
magnetorheological fluid–based brake with multiple coils placed on the side
housings. Journal of Intelligent Material Systems and Structures.
2019;30(5):734-748. doi:10.1177/1045389X18818385
16. Optimal design of disc-type magneto-rheological brake for mid-sized motorcycle:
Experimental evaluation - Scientific Figure on ResearchGate. Available from:
https://www.researchgate.net/figure/Schematic-configuration-of-the-MR-brake_fig
2_279826090 [accessed 21 May, 2023]
44
Annexure A
Code Associated with driver
45
Placement(visible = true, transformation(extent = {{-42,
-10}, {-22, 10}}, rotation = 0)));
// Drive cycle signal
Modelica.Blocks.Sources.CombiTimeTable driveCyc(columns = {2},
extrapolation = extrapolation, fileName = CycleFileName,
tableName = "Cycle", tableOnFile = true) annotation (
Placement(visible = true, transformation(extent = {{-80,
-10}, {-60, 10}}, rotation = 0)));
// Feedback signal
Modelica.Blocks.Math.Feedback feedback annotation (
Placement(visible = true, transformation(extent = {{-10,
-10}, {10, 10}}, rotation = 0)));
// Controller Gain
Modelica.Blocks.Math.Gain gain(k = k) annotation (
Placement(visible = true, transformation(extent = {{14, -10},
{34, 10}}, rotation = 0)));
// limiter for acceleration signal
Modelica.Blocks.Nonlinear.Limiter limAcc(uMax = yMax, uMin = 0)
annotation (
Placement(visible = true, transformation(origin = {2, 40},
extent = {{52, -10}, {72, 10}}, rotation = 0)));
// limiter for brake signal
Modelica.Blocks.Nonlinear.Limiter limBrak(uMax = 0, uMin =
-yMax) annotation (
Placement(visible = true, transformation(origin = {0, -40},
extent = {{52, -10}, {72, 10}}, rotation = 0)));
// Output signal for torque reference
Modelica.Blocks.Interfaces.RealOutput tauRef(unit = "N.m")
annotation (
Placement(visible = true, transformation(extent = {{100,
-10}, {120, 10}}, rotation = 0), iconTransformation(extent =
{{100, -10}, {120, 10}}, rotation = 0)));
// Define two RealOutput variables with units of "N.m" and set their placement on the graphical
diagram
Modelica.Blocks.Interfaces.RealOutput accelTau(unit = "N.m")
annotation (
Placement(visible = true, transformation(origin = {110, 40},
extent = {{-10, -10}, {10, 10}}, rotation = 0),
iconTransformation(extent = {{100, 52}, {120, 72}}, rotation =
0)));
Modelica.Blocks.Interfaces.RealOutput brakeTau(unit = "N.m")
annotation (
46
Placement(visible = true, transformation(origin = {110, -40},
extent = {{-10, -10}, {10, 10}}, rotation = 0),
iconTransformation(extent = {{100, -70}, {120, -50}}, rotation =
0)));
// Define a Nonlinear Limiter component and set its placement on the graphical diagram
Modelica.Blocks.Nonlinear.Limiter limiter1(uMax=yMax)
annotation (
Placement(visible=true, transformation(
origin={4,0},
extent={{52,-10},{72,10}},
rotation=0)));
initial equation
//For the meaning of the following if see the definition of
dummy
// Set the initial value of "dummy" based on the "extrapolation" input parameter
initial equation
if extrapolation ==
Modelica.Blocks.Types.Extrapolation.HoldLastPoint then
dummy = true;
else
dummy = false;
end if;
// Set up the connections between different components on the graphical diagram and set the
color of the lines
equation
connect(V, feedback.u2) annotation (
Line(points = {{0, -66}, {0, -66}, {0, -8}, {0, -8}}, color =
{0, 0, 127}));
connect(from_kmh.u, driveCyc.y[1]) annotation (
Line(points = {{-44, 0}, {-59, 0}}, color = {0, 0, 127}));
connect(from_kmh.y, feedback.u1) annotation (
Line(points = {{-21, 0}, {-8, 0}}, color = {0, 0, 127}));
connect(feedback.y, gain.u) annotation (
Line(points = {{9, 0}, {12, 0}}, color = {0, 0, 127}));
connect(limBrak.y, brakeTau) annotation (
Line(points = {{73, -40}, {104, -40}, {104, -40}, {110,
-40}}, color = {0, 0, 127}));
connect(limAcc.y, accelTau) annotation (
Line(points = {{75, 40}, {102, 40}, {102, 40}, {110, 40}},
color = {0, 0, 127}));
connect(limBrak.u, gain.y) annotation (
Line(points = {{50, -40}, {40, -40}, {40, 0}, {35, 0}, {35,
0}}, color = {0, 0, 127}));
47
connect(limAcc.u, gain.y) annotation (
Line(points = {{52, 40}, {40, 40}, {40, 0}, {35, 0}, {35,
0}}, color = {0, 0, 127}));
connect(limiter1.u, gain.y) annotation (
Line(points = {{54, 0}, {34, 0}, {34, 0}, {35, 0}}, color =
{0, 0, 127}));
connect(limiter1.y, tauRef) annotation (
Line(points = {{77, 0}, {102, 0}, {102, 0}, {110, 0}}, color
= {0, 0, 127}));
annotation (
Documentation(info = "<html><head></head><body><p>Simple
driver model.</p><p>It reads a reference cycle from a file then
controls speed with a simple proportional feedback law.</p>
</body></html>"),
Icon(coordinateSystem(preserveAspectRatio = false,
initialScale = 0.1), graphics={ Rectangle(fillColor = {255,
255, 255}, fillPattern = FillPattern.Solid, extent = {{-100,
100}, {100, -100}}), Ellipse(fillColor = {255, 213, 170},
fillPattern = FillPattern.Solid, extent = {{-23, 22}, {-12,
-4}}, endAngle = 360), Text(origin = {2, -0.1894}, lineColor =
{0, 0, 255}, extent = {{-104, 142.189}, {98, 104}}, textString =
"%name"), Polygon(fillColor = {215, 215, 215}, pattern =
LinePattern.None, fillPattern = FillPattern.Solid, points =
{{-22, -60}, {-42, -88}, {-16, -88}, {16, -88}, {-22, -60}}),
Polygon(fillColor = {135, 135, 135}, pattern = LinePattern.None,
fillPattern = FillPattern.Solid, points = {{-32, 40}, {-62,
-52}, {-30, -52}, {-30, -52}, {-32, 40}}, smooth =
Smooth.Bezier), Polygon(fillColor = {135, 135, 135}, pattern =
LinePattern.None, fillPattern = FillPattern.Solid, points =
{{-68, -36}, {-14, -90}, {10, -50}, {0, -50}, {-68, -36}},
smooth = Smooth.Bezier), Polygon(fillColor = {175, 175, 175},
fillPattern = FillPattern.Solid, points = {{-22, 10}, {-30, 6},
{-40, -48}, {2, -46}, {2, -34}, {0, 2}, {-22, 10}}, smooth =
Smooth.Bezier), Ellipse(fillColor = {255, 213, 170}, fillPattern
= FillPattern.Solid, extent = {{-30, 44}, {-3, 10}}, endAngle =
360), Polygon(pattern = LinePattern.None, fillPattern =
FillPattern.Solid, points = {{-38, 34}, {-16, 50}, {-2, 36}, {4,
36}, {6, 36}, {-38, 34}}, smooth = Smooth.Bezier),
Polygon(fillColor = {95, 95, 95}, fillPattern =
FillPattern.Solid, points = {{30, -44}, {-32, -28}, {-36, -44},
{-24, -58}, {30, -44}}, smooth = Smooth.Bezier),
Polygon(fillPattern = FillPattern.Solid, points = {{42, -70},
48
{36, -84}, {48, -78}, {52, -72}, {50, -68}, {42, -70}}, smooth =
Smooth.Bezier), Line(points = {{48, -14}, {26, 0}, {26, 0}},
thickness = 0.5), Line(points = {{20, -10}, {34, 10}, {34, 10}},
thickness = 0.5), Polygon(fillColor = {255, 213, 170},
fillPattern = FillPattern.Solid, points = {{28, 4}, {32, 8},
{28, 2}, {34, 6}, {30, 2}, {34, 4}, {30, 0}, {26, 2}, {34, 0},
{26, 0}, {26, 2}, {28, 4}, {28, 4}, {26, 2}, {26, 2}, {26, 2},
{28, 8}, {28, 6}, {28, 4}}, smooth = Smooth.Bezier),
Polygon(fillColor = {175, 175, 175}, fillPattern =
FillPattern.Solid, points = {{-18, 0}, {28, 6}, {26, -2}, {-16,
-16}, {-20, -16}, {-24, -6}, {-18, 0}}, smooth = Smooth.Bezier),
Polygon(fillColor = {215, 215, 215}, fillPattern =
FillPattern.Solid, points = {{72, -6}, {48, -6}, {36, -26}, {58,
-86}, {72, -86}, {72, -6}}), Polygon(fillColor = {95, 95, 95},
fillPattern = FillPattern.Solid, points = {{49, -94}, {17, -40},
{7, -44}, {-1, -50}, {49, -94}}, smooth = Smooth.Bezier),
Line(points = {{-7, 31}, {-3, 29}}), Line(points = {{-9, 18},
{-5, 18}}), Line(points = {{-7, 31}, {-3, 31}}), Text(lineColor
= {238, 46, 47}, extent = {{-100, 90}, {100, 58}}, textString =
"%CycleFileName")}),
Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}},
preserveAspectRatio = false, initialScale = 0.1, grid = {2,
2})));
end PropDriver;
INPUT - Driver Cycle for e.g. NEDC (New European Driving Cycle)
49
connect(variableLimiter.u, tauRef) annotation (
Line(points = {{-2, 30}, {14, 30}, {14, -66}, {-118, -66}},
color = {0, 0, 127}));
annotation (
Documentation(info = "<html>
<p>This is a model that models an electric drive: electornic
converter + electric machine.</p>
<p>The only model dynamics is its inertia. </p>
<p>The input signal is a torque request (Nm). The requested
torque is applied to a mechanical inertia. </p>
<p>The maximum available torque is internally computed
considering a direct torque maximum (tauMax) and a power maximum
(powMax) </p>
<p>The model then computes the inner losses and absorbs the
total power from the DC input.</p>
<p>Note that to evaluate the inner losses the model uses an
efficiency map (i.e. a table), in which torques are ratios of
actual torques to tauMax and speeds are ratios of w to wMax.
Because of this wMax must be supplied as a parameter.</p>
</html>"),
Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}},
preserveAspectRatio = false, initialScale = 0.1)),
Icon(coordinateSystem(extent = {{-100, -80}, {100, 100}},
preserveAspectRatio = false, initialScale = 0.1)));
end OneFlange;
50
parameter String effTableName = "noName" "name of the on-file
efficiency matrix" annotation (
Dialog(enable = mapsOnFile));
parameter Real effTable[:, :] = [0.00, 0.00, 0.25, 0.50, 0.75,
1.00; 0.00, 0.75, 0.80, 0.81, 0.82, 0.83; 0.25, 0.76, 0.81,
0.82, 0.83, 0.84; 0.50, 0.77, 0.82, 0.83, 0.84, 0.85; 0.75,
0.78, 0.83, 0.84, 0.85, 0.87; 1.00, 0.80, 0.84, 0.85, 0.86,
0.88] annotation (
Dialog(enable = not mapsOnFile));
//the name is passed because a file can contain efficiency
tables for
//different submodels, e.g. genEfficiency for generator and
motEfficiency for motor.
Modelica.Blocks.Tables.CombiTable2Ds toEff(
tableOnFile=mapsOnFile,
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments,
fileName=mapsFileName,
tableName=effTableName,
table=effTable) "normalised efficiency" annotation
(Placement(
transformation(
extent={{-12,-12},{12,12}},
rotation=0,
origin={22,-20})));
Modelica.Blocks.Interfaces.RealInput w annotation (
Placement(transformation(extent = {{-140, -60}, {-100,
-20}}), iconTransformation(extent = {{-140, -60}, {-100,
-20}})));
Modelica.Blocks.Interfaces.RealInput tau annotation (
Placement(transformation(extent = {{-140, 20}, {-100, 60}}),
iconTransformation(extent = {{-140, 20}, {-100, 60}})));
Modelica.Blocks.Interfaces.RealOutput elePow annotation (
Placement(transformation(extent = {{96, -10}, {116, 10}})));
Modelica.Blocks.Math.Abs abs1 annotation (
Placement(transformation(extent = {{-76, -50}, {-56,
-30}})));
Modelica.Blocks.Math.Abs abs2 annotation (
Placement(transformation(extent = {{-80, 40}, {-60, 60}})));
Modelica.Blocks.Math.Gain normalizeTau(k = 1 / tauMax)
annotation (
Placement(transformation(extent = {{-10, -10}, {10, 10}},
rotation = 0, origin = {-36, 50})));
51
SupportModels.MapBasedRelated.Pel applyEta annotation (
Placement(transformation(extent = {{60, -10}, {84, 12}})));
Modelica.Blocks.Math.Product PMOT annotation (
Placement(transformation(extent = {{-72, 0}, {-52, 20}})));
Modelica.Blocks.Math.Gain normalizeSpeed(k = 1 / wMax)
annotation (
Placement(transformation(extent = {{-10, -10}, {10, 10}},
rotation = 0, origin = {-34, -40})));
equation
connect(tau, abs2.u) annotation (
Line(points = {{-120, 40}, {-94, 40}, {-94, 50}, {-82, 50}},
color = {0, 0, 127}, smooth = Smooth.None));
connect(w, abs1.u) annotation (
Line(points = {{-120, -40}, {-78, -40}}, color = {0, 0, 127},
smooth = Smooth.None));
connect(abs2.y, normalizeTau.u) annotation (
Line(points = {{-59, 50}, {-48, 50}}, color = {0, 0, 127},
smooth = Smooth.None));
connect(normalizeTau.y, toEff.u1) annotation (Line(
points={{-25,50},{-18,50},{-18,-12.8},{7.6,-12.8}},
color={0,0,127},
smooth=Smooth.None));
connect(applyEta.Pel, elePow) annotation (
Line(points = {{85.2, 1}, {92.48, 1}, {92.48, 0}, {106, 0}},
color = {0, 0, 127}, smooth = Smooth.None));
connect(toEff.y, applyEta.eta) annotation (Line(
points={{35.2,-20},{48,-20},{48,-5.6},{57.6,-5.6}},
color={0,0,127},
smooth=Smooth.None));
connect(PMOT.u1, tau) annotation (
Line(points = {{-74, 16}, {-84, 16}, {-84, 40}, {-120, 40}},
color = {0, 0, 127}, smooth = Smooth.None));
connect(PMOT.u2, w) annotation (
Line(points = {{-74, 4}, {-84, 4}, {-84, -40}, {-120, -40}},
color = {0, 0, 127}, smooth = Smooth.None));
connect(PMOT.y, applyEta.P) annotation (
Line(points = {{-51, 10}, {42, 10}, {42, 7.6}, {57.6, 7.6}},
color = {0, 0, 127}, smooth = Smooth.None));
connect(abs1.y, normalizeSpeed.u) annotation (
Line(points = {{-55, -40}, {-46, -40}}, color = {0, 0, 127},
smooth = Smooth.None));
connect(normalizeSpeed.y, toEff.u2) annotation (Line(
52
points={{-23,-40},{-2,-40},{-2,-27.2},{7.6,-27.2}},
color={0,0,127},
smooth=Smooth.None));
annotation (
Diagram(coordinateSystem(preserveAspectRatio = false, extent
= {{-100, -80}, {100, 80}})),
Icon(coordinateSystem(preserveAspectRatio = false, extent =
{{-100, -100}, {100, 100}}), graphics={ Rectangle(extent =
{{-100, 72}, {100, -72}}, lineColor = {0, 0, 0}, fillColor =
{255, 255, 255}, fillPattern = FillPattern.Solid), Line(points =
{{-74, -54}, {-74, 58}}, color = {0, 0, 0}, smooth =
Smooth.None), Line(points = {{-82, -48}, {78, -48}}, color = {0,
0, 0}, smooth = Smooth.None), Line(points = {{-74, 38}, {-24,
38}, {-4, 12}, {28, -8}, {60, -22}, {62, -48}}, color = {0, 0,
0}, smooth = Smooth.None), Polygon(points = {{-20, 14}, {-40,
24}, {-56, -4}, {-38, -36}, {12, -38}, {26, -28}, {22, -20}, {8,
-6}, {-8, 4}, {-20, 14}}, lineColor = {0, 0, 0}, smooth =
Smooth.None, fillColor = {255, 255, 255}, fillPattern =
FillPattern.Solid), Polygon(points = {{-28, 4}, {-38, 2}, {-32,
-20}, {0, -32}, {10, -28}, {12, -20}, {-28, 4}}, lineColor = {0,
0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid), Text(extent = {{-102, 118},
{100, 78}}, lineColor = {0, 0, 255}, fillColor = {255, 255,
255}, fillPattern = FillPattern.Solid, textString = "%name"),
Text(extent = {{26, 46}, {76, 4}}, lineColor = {0, 0, 0},
textString = "T")}),
Documentation(info = "<html>
<p>This block computes the machine and inverter losses from the
mechanical input quantities and determines the power to be drawn
from the electric circuit. The "drawn" power can be
also a negative numer, meaning that themachine is actually
delivering electric power.</p>
<p>The given efficiency map is intended as being built with
torques being ratios of actual torques to tauMax and speeds
being ratios of w to wMax. In case the user uses, in the given
efficiency map, torques in Nm and speeds in rad/s, the block can
be used selecting tauTmax=1, wMax=1.</p>
<p>The choice of having normalised efficiency computation allows
simulations of machines different in sizes and similar in
characteristics to be repeated without having to rebuild the
efficiency maps. </p>
53
<p>Torques are written in the first matrix column, speeds on the
first row.</p>
</html>"));
end EfficiencyT;
54
if w < (1 + alpha)*wMax then
state := 2;
yH := powMax/wMax*(1 - (w - wMax)/(alpha*wMax));
else
state := 3;
yH := 0;
end if;
end if;
yL := -yH;
annotation(
Diagram(coordinateSystem(preserveAspectRatio = false, extent
= {{-100, -100}, {100, 100}})),
Icon(coordinateSystem(preserveAspectRatio = false, extent =
{{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-98,
126}, {96, 90}}, lineColor = {0, 0, 255}, fillColor = {255, 255,
255}, fillPattern = FillPattern.Solid, textString = "%name
"), Rectangle(fillColor = {255, 255, 255}, fillPattern =
FillPattern.Solid, extent = {{-100, 90}, {100, -88}}),
Line(points = {{-72, 80}, {-72, -80}}, arrow = {Arrow.Filled,
Arrow.None}, arrowSize = 2), Text(lineColor = {0, 0, 255},
extent = {{-98, 54}, {-84, 48}}, textString = "T"), Line(points
= {{92, -2}, {-74, -2}}, arrow = {Arrow.Filled, Arrow.None},
arrowSize = 2), Text(lineColor = {0, 0, 255}, extent = {{72,
-22}, {86, -28}}, textString = "W"), Line(points = {{-72, 54},
{-12, 54}, {-2, 40}, {16, 26}, {30, 18}, {44, 14}}), Line(points
= {{-72, -58}, {-12, -58}, {-2, -44}, {16, -30}, {30, -22}, {42,
-18}})}),
Documentation(info = "<html>
<p>Gives the maximum output torque as a function of the input
speed.</p>
<p>When w<wMax the output is Tmax if Tmax*w<Pnom,
othersise it is Pnom/w</p>
<p>But if w is over wMax Tmax is rapidly falling to zero
(reaches zero when speed overcomes wMax by 10%).</p>
<p>Torques and powers are in SI units</p>
</html>"));
end LimTau;
55
model Batt1 "Battery model based on one R-C block in its
electric circuit"
parameter Modelica.Units.SI.ElectricCharge QCellNom(min=0) =
10*3600.0
"Nominal electric charge" annotation (Dialog(tab="Cell
data"));
parameter Modelica.Units.SI.Voltage ECellMin(min=0) = 3.3
"Minimum open source voltage" annotation (Dialog(tab="Cell
data"));
parameter Modelica.Units.SI.Voltage ECellMax(min=0.0001) = 4.15
"Maximum open source voltage" annotation (Dialog(tab="Cell
data"));
parameter Real SOCMin(min = 0, max = 1) = 0 "Minimum state of
charge" annotation (
Dialog(group = "SOC parameters"));
parameter Real SOCMax(min = 0, max = 1) = 1 "Maximum state of
charge" annotation (
Dialog(group = "SOC parameters"));
parameter Real SOCInit(min = 0, max = 1) = 0.5 "Initial state
of charge" annotation (
Dialog(group = "SOC parameters"));
parameter Modelica.Units.SI.Current ICellMax(min=0) =
10*QCellNom/
3600.0 "Maximum admissible current"
annotation (Dialog(tab="Cell data"));
parameter Modelica.Units.SI.Resistance R0Cell(min=0) =
0.05*ECellMax/
ICellMax "Serial resistance \"R0\"" annotation (Dialog(tab=
"Cell data", group="Electric circuit parameters"));
parameter Modelica.Units.SI.Resistance R1Cell(min=0) = R0Cell
"Serial resistance \"R1\"" annotation (Dialog(tab="Cell
data", group=
"Electric circuit parameters"));
parameter Modelica.Units.SI.Capacitance C1Cell(min=0) =
60/R1Cell
"Capacitance in parallel with R1" annotation
(Dialog(tab="Cell data",
group="Electric circuit parameters"));
parameter Real efficiency(min = 0, max = 0.9999) = 0.85
"Overall charging/discharging energy efficiency" annotation (
Dialog(group = "Parameters related to losses"));
56
parameter Modelica.Units.SI.Current iCellEfficiency(min=0) =
0.5*
ICellMax "Charging/discharging current the efficiency refers
to"
annotation (Dialog(group="Parameters related to losses"));
parameter Integer ns = 1 "Number of serial connected cells per
string" annotation (
Dialog(tab = "Battery pack data", group = "Size of the
package"));
parameter Integer np = 1 "Number of parallel connected strings"
annotation (
Dialog(tab = "Battery pack data", group = "Size of the
package"));
Modelica.Units.SI.Voltage uBat(start=EBatteryMin +
SOCInit*(EBatteryMax
- EBatteryMin), fixed=true);
Modelica.Units.SI.Power powerLoss;
Modelica.Electrical.Analog.Basic.Capacitor cBattery(final C =
CBattery) annotation (
Placement(transformation(origin = {-60, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 270)));
Modelica.Electrical.Analog.Basic.Resistor R0(final R =
R0Battery) annotation (
Placement(transformation(origin = {20, 60}, extent = {{-10,
-10}, {10, 10}}, rotation = 180)));
Modelica.Electrical.Analog.Sources.SignalCurrent Ip annotation
(
Placement(transformation(origin = {-6, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 270)));
Modelica.Electrical.Analog.Interfaces.Pin p annotation (
Placement(transformation(extent = {{90, 50}, {110, 70}}),
iconTransformation(extent = {{90, 50}, {110, 70}})));
Modelica.Electrical.Analog.Interfaces.NegativePin n annotation
(
Placement(transformation(extent = {{90, -70}, {110, -50}}),
iconTransformation(extent = {{91, -70}, {111, -50}})));
Modelica.Electrical.Analog.Basic.Resistor R1(final R =
R1Battery) annotation (
Placement(transformation(origin = {-37, 74}, extent = {{-10,
-10}, {10, 10}}, rotation = 180)));
Modelica.Electrical.Analog.Basic.Capacitor C1(C = C1Battery)
annotation (
57
Placement(transformation(extent = {{-10, -10}, {10, 10}},
rotation = 180, origin = {-37, 50})));
Modelica.Blocks.Interfaces.RealOutput SOC annotation (
Placement(visible = true, transformation(origin = {-90, 0},
extent = {{-10, -10}, {10, 10}}, rotation = 180),
iconTransformation(origin = {-110, 0}, extent = {{-10, -10},
{10, 10}}, rotation = 180)));
Modelica.Electrical.Analog.Basic.Capacitor cDummy(C = C1Battery
/ 10000) annotation (
Placement(visible = true, transformation(origin = {88, 0},
extent = {{-10, -10}, {10, 10}}, rotation = -90)));
// The following row is substituted by the next one, since this
fomula erroneously mixed cell data with battery data:
// it would gibe wrong results whenever np>1
// parameter Real efficiencyMax = (EBatteryMin + EBatteryMax -
2 * Rtot * iCellEfficiency) / (EBatteryMin + EBatteryMax + 2 *
Rtot * iCellEfficiency);
protected
parameter Real efficiencyMax = (ECellMin + ECellMax - 2 *
RtotCell * iCellEfficiency) / (ECellMin + ECellMax + 2 *
RtotCell * iCellEfficiency);
parameter Modelica.Units.SI.Capacitance C=QCellNom/(ECellMax -
ECellMin)
"Cell capacitance";
// determine fraction of drain current with respect to the
total package current
parameter Real k = ((1 - efficiency) * (EBatteryMax +
EBatteryMin) - 2 * (1 + efficiency) * Rtot * iCellEfficiency) /
((1 + efficiency) * (EBatteryMax + EBatteryMin) - 2 * (1 -
efficiency) * Rtot * iCellEfficiency);
parameter Modelica.Units.SI.Current IBatteryMax=ICellMax*np
"Maximum battery current";
parameter Modelica.Units.SI.Voltage EBatteryMin=ECellMin*ns
"Minimum battery voltage";
parameter Modelica.Units.SI.Voltage EBatteryMax=ECellMax*ns
"Maximum battery voltage";
parameter Modelica.Units.SI.ElectricCharge
QBatteryNominal=QCellNom*np
"Battery admissible electric charge";
parameter Modelica.Units.SI.Capacitance CBattery=C*np/ns
"Battery capacitance";
parameter Modelica.Units.SI.Resistance R0Battery=R0Cell*ns/np
58
"Serial inner resistance R0 of cell package";
parameter Modelica.Units.SI.Resistance R1Battery=R1Cell*ns/np
"Serial inner resistance R1 of cell package";
parameter Modelica.Units.SI.Resistance Rtot=R0Battery +
R1Battery;
parameter Modelica.Units.SI.Resistance RtotCell=R0Cell +
R1Cell;
parameter Modelica.Units.SI.Capacitance C1Battery=C1Cell*np/ns
"Battery series inner capacitance C1";
protected
Modelica.Units.SI.Voltage ECell "Cell e.m.f.";
Modelica.Units.SI.Current iCellStray "Cell stray current";
Modelica.Units.SI.Voltage EBattery(start=EBatteryMin +
SOCInit*(
EBatteryMax - EBatteryMin), fixed=true) "Battery e.m.f.";
Modelica.Units.SI.Current iBatteryStray "Cell parasitic
current";
Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor
annotation (
Placement(transformation(extent = {{60, 50}, {80, 70}},
rotation = 0)));
Modelica.Blocks.Math.Gain gain(k = k) annotation (
Placement(transformation(origin = {52, 0}, extent = {{-10,
-10}, {10, 10}}, rotation = 180)));
Modelica.Blocks.Math.Abs abs1 annotation (
Placement(transformation(extent = {{34, -10}, {14, 10}},
rotation = 0)));
equation
connect(cDummy.n, n) annotation (
Line(points = {{88, -10}, {88, -10}, {88, -60}, {100, -60},
{100, -60}}, color = {0, 0, 255}));
connect(cDummy.p, currentSensor.n) annotation (
Line(points = {{88, 10}, {88, 10}, {88, 60}, {80, 60}, {80,
60}}, color = {0, 0, 255}));
assert(SOCMin >= 0, "SOCMin must be greater than, or equal to
0");
assert(SOCMax <= 1, "SOCMax must be smaller than, or equal to
1");
assert(efficiency <= efficiencyMax, "Overall
charging/discharging energy efficiency is too big with respect
to the actual serial resistance (EfficiencyMax =" +
String(efficiencyMax) + ")");
59
assert(SOCMin < SOCMax, "SOCMax(=" + String(SOCMax) + ") must
be greater than SOCMin(=" + String(SOCMin) + ")");
assert(SOCInit >= SOCMin, "SOCInit(=" + String(SOCInit) + ")
must be greater than, or equal to SOCMin(=" + String(SOCMin) +
")");
assert(SOCInit <= SOCMax, "SOCInit(=" + String(SOCInit) + ")
must be smaller than, or equal to SOCMax(=" + String(SOCMax) +
")");
iBatteryStray = Ip.i;
iCellStray = iBatteryStray / np;
EBattery = cBattery.v;
//Solo per dare maggiore chiarezza all'utente con un nome
significativo
uBat = p.v - n.v;
powerLoss = R0.LossPower + R1.LossPower + Ip.v * Ip.i;
ECell = EBattery / ns;
assert(abs(p.i / np) < ICellMax, "Battery cell current i=" +
String(abs(p.i / np)) + "\n exceeds max admissable ICellMax (="
+ String(ICellMax) + "A)");
SOC = (EBattery - EBatteryMin) / (EBatteryMax - EBatteryMin);
//*(SOCMax-SOCMin)+SOCMin);
assert(SOC <= SOCMax, "Battery is fully charged: State of
charge reached maximum limit (=" + String(SOCMax) + ")");
assert(SOCMin <= SOC, "Battery is fully discharged: State of
charge reached minimum limit (=" + String(SOCMin) + ")");
connect(R0.p, currentSensor.p) annotation (
Line(points = {{30, 60}, {60, 60}}, color = {0, 0, 255}));
connect(Ip.p, R0.n) annotation (
Line(points = {{-6, 10}, {-6, 60}, {10, 60}}, color = {0, 0,
255}));
connect(currentSensor.i, gain.u) annotation (
Line(points = {{70, 50}, {70, -1.46958e-015}, {64,
-1.46958e-015}}, color = {0, 0, 127}));
connect(abs1.u, gain.y) annotation (
Line(points = {{36, 0}, {39.5, 0}, {39.5, 1.34711e-015}, {41,
1.34711e-015}}, color = {0, 0, 127}));
connect(abs1.y, Ip.i) annotation (
Line(points = {{13, 0}, {7, 0}, {7, -1.28588e-015}, {1,
-1.28588e-015}}, color = {0, 0, 127}));
connect(currentSensor.n, p) annotation (
Line(points = {{80, 60}, {80, 60}, {100, 60}}, color = {0, 0,
255}));
60
connect(Ip.n, n) annotation (
Line(points = {{-6, -10}, {-6, -60}, {100, -60}}, color = {0,
0, 255}));
connect(n, cBattery.n) annotation (
Line(points = {{100, -60}, {-60, -60}, {-60, -10}}, color =
{0, 0, 255}));
connect(R1.n, cBattery.p) annotation (
Line(points = {{-47, 74}, {-60, 74}, {-60, 10}}, color = {0,
0, 255}, smooth = Smooth.None));
connect(C1.n, cBattery.p) annotation (
Line(points = {{-47, 50}, {-60, 50}, {-60, 10}}, color = {0,
0, 255}, smooth = Smooth.None));
connect(R1.p, C1.p) annotation (
Line(points = {{-27, 74}, {-18, 74}, {-18, 50}, {-27, 50}},
color = {0, 0, 255}, smooth = Smooth.None));
connect(R1.p, R0.n) annotation (
Line(points = {{-27, 74}, {-18, 74}, {-18, 60}, {10, 60}},
color = {0, 0, 255}, smooth = Smooth.None));
annotation (
Documentation(info = "<html>
<p>Battery model with non-unity coulombic efficiency. </p>
<p>The main cell branch contains an e.m.f. that is linearly
increasing with SOC, simulated through an equivalent capacitor,
the resistance R0 and a parallel R-C couple. </p>
<p>The full battery is composed by np rows in parallel, each of
them containing ns cells in series.</p>
</html>", revisions = "<html><table border=\"1\"
rules=\"groups\">
<thead>
<tr><td>Version</td> <td>Date</td> <td>Comment</td></tr>
</thead>
<tbody>
<tr><td>1.0.0</td> <td>2006-01-12</td> <td> </td></tr>
<tr><td>1.0.3</td> <td>2006-08-31</td> <td> Improved assert
statements </td></tr>
<tr><td>1.0.6</td> <td>2007-05-14</td> <td> The documentation
changed slightly </td></tr>
</tbody>
</table>
</html>"),
Diagram(coordinateSystem(preserveAspectRatio = true, extent =
{{-100, -100}, {100, 100}}, grid = {2, 2}), graphics),
61
Icon(coordinateSystem(initialScale = 0.1), graphics={
Rectangle(lineColor = {95, 95, 95}, fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid, extent = {{-100, 100}, {78,
-100}}), Line(origin = {2, -2}, points = {{-92, 7}, {-56, 7}},
color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255},
fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid, extent
= {{-82, -3}, {-65, -10}}), Line(points = {{-73, 63}, {98, 64}},
color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255},
fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid,
extent = {{38, 69}, {68, 57}}), Rectangle(lineColor = {0, 0,
255}, fillColor = {255, 255, 255}, fillPattern =
FillPattern.Solid, extent = {{-37.5, 68}, {-6.5, 56}}),
Line(points = {{-19.5, 49}, {-19.5, 32}}, color = {0, 0, 255}),
Line(points = {{-54.5, 63}, {-54.5, 41}, {-25.5, 41}}, color =
{0, 0, 255}), Line(points = {{9.5, 62}, {9.5, 40}, {-19.5, 40}},
color = {0, 0, 255}), Line(points = {{-73, 63}, {-73, 5}}, color
= {0, 0, 255}), Line(points = {{-73, -6}, {-73, -60}, {96,
-60}}, color = {0, 0, 255}), Line(points = {{26, 63}, {26,
-61}}, color = {0, 0, 255}), Line(points = {{-25.5, 49}, {-25.5,
32}}, color = {0, 0, 255}), Polygon(lineColor = {0, 0, 255},
fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid,
points = {{26, 22}, {14, 4}, {26, -14}, {38, 4}, {26, 22}}),
Line(points = {{20, 4}, {32, 4}}, color = {0, 0, 255}),
Polygon(lineColor = {0, 0, 255}, points = {{22, -20}, {30, -20},
{26, -32}, {22, -20}}), Text(lineColor = {0, 0, 255}, extent =
{{-100, 150}, {100, 110}}, textString = "%name"), Text(origin =
{-53, -1}, lineColor = {238, 46, 47}, extent = {{-3, 3}, {9,
-13}}, textString = "E", fontName = "Times New Roman"),
Text(origin = {-25, 83}, lineColor = {238, 46, 47}, extent =
{{-3, 3}, {9, -13}}, textString = "R1", fontName = "Times New
Roman"), Text(origin = {-23, 29}, lineColor = {238, 46, 47},
extent = {{-3, 3}, {9, -13}}, textString = "C1", fontName =
"Times New Roman"), Text(origin = {47, 9}, lineColor = {238, 46,
47}, extent = {{-3, 3}, {9, -13}}, textString = "Ip", fontName =
"Times New Roman"), Text(origin = {51, 83}, lineColor = {238,
46, 47}, extent = {{-3, 3}, {9, -13}}, textString = "R0",
fontName = "Times New Roman")}));
end Batt1;
62
model DragForce "Vehicle rolling and aerodinamical drag
force"
import Modelica.Constants.g_n;
extends
Modelica.Mechanics.Translational.Interfaces.PartialElementa
ryOneFlangeAndSupport2;
extends
Modelica.Mechanics.Translational.Interfaces.PartialFriction
;
Modelica.Units.SI.Force f "Total drag force";
Modelica.Units.SI.Velocity v "vehicle velocity";
Modelica.Units.SI.Acceleration a "Absolute acceleration of
flange";
Real Sign;
parameter Modelica.Units.SI.Mass m "vehicle mass";
parameter Modelica.Units.SI.Density rho=1.226 "air
density";
parameter Modelica.Units.SI.Area S "vehicle cross area";
parameter Real fc(start = 0.01) "rolling friction
coefficient";
parameter Real Cx "aerodinamic drag coefficient";
protected
parameter Real A = fc * m * g_n;
parameter Real B = 1 / 2 * rho * S * Cx;
constant Real f_pos[:,2]=[0,1];
equation
// s = flange.s;
v = der(s);
a = der(v);
// Le seguenti definizioni seguono l'ordine e le richieste
del modello "PartialFriction" di
// Modelica.Mechanics.Translational.Interfaces"
v_relfric = v;
a_relfric = a;
f0 = A "force at 0 speed 0 but with slip";
f0_max = A "max force at 0 speed without slip";
free = false "in principle should become true whenthe
wheel loose contact with road";
// Now the computation of f, and its attribution to the
flange:
flange.f - f = 0;
63
// friction force
if v > 0 then
Sign = 1;
else
Sign = -1;
end if;
//The following equation equates dragForce to the force
applied when locked=true, otherwise term A.
f - B * v ^ 2 * Sign = if locked then sa * unitForce else
f0 * (if startForward then
Modelica.Math.Vectors.interpolate(f_pos[:, 1], f_pos[:, 2],
v, 1) else if startBackward then
-Modelica.Math.Vectors.interpolate(f_pos[:, 1], f_pos[:,
2], -v, 1) else if pre(mode) == Forward then
Modelica.Math.Vectors.interpolate(f_pos[:, 1], f_pos[:, 2],
v, 1) else -Modelica.Math.Vectors.interpolate(f_pos[:, 1],
f_pos[:, 2], -v, 1));
/*
f - B * v ^ 2 * Sign =if locked then sa*unitForce else
f0*(if startForward
then ObsoleteModelica4.Math.tempInterpol1(
v,
[0,1],
2) else if startBackward then
-ObsoleteModelica4.Math.tempInterpol1(
-v,
[0,1],
2) else if pre(mode) == Forward then
ObsoleteModelica4.Math.tempInterpol1(
v,
[0,1],
2) else -ObsoleteModelica4.Math.tempInterpol1(
-v,
[0,1],
2));
*/
annotation (
64
Documentation(info = "<html>
<p>This component models the total (rolling and
aerodynamic) vehicle drag resistance: </p>
<p>F=fc*m*g+(1/2)*rho*Cx*S*v^2 </p>
<p>It models reliably the stuck phase. Based on
Modelica-Intrerfaces.PartialFriction model </p>
</html>"),Icon(coordinateSystem(preserveAspectRatio = true,
extent = {{-100, -100}, {100, 100}}), graphics={
Polygon(points = {{-98, 10}, {22, 10}, {22, 41}, {92, 0},
{22, -41}, {22, -10}, {-98, -10}, {-98, 10}}, lineColor =
{0, 127, 0}, fillColor = {215, 215, 215}, fillPattern =
FillPattern.Solid), Line(points = {{-42, -50}, {87, -50}},
color = {0, 0, 0}), Polygon(points = {{-72, -50}, {-41,
-40}, {-41, -60}, {-72, -50}}, lineColor = {0, 0, 0},
fillColor = {128, 128, 128}, fillPattern =
FillPattern.Solid), Line(points = {{-90, -90}, {-70, -88},
{-50, -82}, {-30, -72}, {-10, -58}, {10, -40}, {30, -18},
{50, 8}, {70, 38}, {90, 72}, {110, 110}}, color = {0, 0,
255}, thickness = 0.5), Text(extent = {{-82, 90}, {80,
50}}, lineColor = {0, 0, 255}, textString = "%name")}),
Diagram(coordinateSystem(preserveAspectRatio = true,
extent = {{-100, -100}, {100, 100}}), graphics));
end DragForce;
Python code
class VehicleCategory(Enum):
"""
Category 3 vehicle — A power driven vehicle
with 2 or 3 wheels designed and constructed for the
carriage of persons and/or goods.
"""
TWO_WHEELED_MOPED = '3-1'
65
THREE_WHEELED_MOPED = '3-2'
TWO_WHEELED_MOTORCYCLE = '3-3'
MOTORCYCLE_WITH_SIDECAR = '3-4'
TRICYCLE = '3-4'
66
"""
if x is not None:
return 0.1 * velocity + x * (velocity ** 2)
else:
raise Exception("Not applicable to this category of vehicle")
def plot_stopping_distance_vs_velocity():
"""
Plots a graph between velocity and stopping distance for
:return: None
"""
# Vehicle Categories
vehicles = [
VehicleCategory.TWO_WHEELED_MOPED,
VehicleCategory.THREE_WHEELED_MOPED,
VehicleCategory.TWO_WHEELED_MOTORCYCLE,
VehicleCategory.MOTORCYCLE_WITH_SIDECAR
]
67
]
plt.show()
68
if category is VehicleCategory.TWO_WHEELED_MOTORCYCLE:
return 0.013
if category is VehicleCategory.MOTORCYCLE_WITH_SIDECAR:
return 0.010
return None
plot_stopping_distance_vs_velocity()
""" For front wheel braking"""
def get_x_for_front_wheel_braking(category: VehicleCategory):
""" variable based on the requirement for each test. """
if category is VehicleCategory.TWO_WHEELED_MOPED:
return 0.011
if category is VehicleCategory.THREE_WHEELED_MOPED:
return 0.014
if category is VehicleCategory.TWO_WHEELED_MOTORCYCLE:
return 0.008
if category is VehicleCategory.MOTORCYCLE_WITH_SIDECAR:
return 0.010
return None
def plot_stopping_distance_vs_velocity_for_front_wheel_brakig():
"""
Plots a graph between velocity and stopping distance
:return: None
"""
# Vehicle Categories
69
vehicles = [
VehicleCategory.TWO_WHEELED_MOPED,
VehicleCategory.THREE_WHEELED_MOPED,
VehicleCategory.TWO_WHEELED_MOTORCYCLE,
VehicleCategory.MOTORCYCLE_WITH_SIDECAR
]
70
plt.show()
def plot_stopping_distance_vs_velocity_for_cbs_brakig():
"""
Plots a graph between velocity and stopping distance
:return: None
"""
# Vehicle Categories
vehicles = [
VehicleCategory.TWO_WHEELED_MOPED,
VehicleCategory.THREE_WHEELED_MOPED,
VehicleCategory.TWO_WHEELED_MOTORCYCLE,
VehicleCategory.MOTORCYCLE_WITH_SIDECAR,
71
VehicleCategory.TRICYCLE
]
axis[0].plot(velocities, stopping_distances[0])
axis[0].set_title('Two Wheel Moped')
axis[0].set_xlabel('Velocity (km/h)') # Add x-label
axis[0].set_ylabel('Stopping Distance (m)') # Add y-label
axis[1].plot(velocities, stopping_distances[1])
axis[1].set_title('Three Wheel Moped')
axis[1].set_xlabel('Velocity (km/h)') # Add x-label
axis[1].set_ylabel('Stopping Distance (m)') # Add y-label
axis[2].plot(velocities, stopping_distances[2])
axis[2].set_title('Two Wheel Motorcycle')
axis[2].set_xlabel('Velocity (km/h)') # Add x-label
axis[2].set_ylabel('Stopping Distance (m)') # Add y-label
axis[3].plot(velocities, stopping_distances[3])
axis[3].set_title('Motorcycle With Sidecar')
axis[3].set_xlabel('Velocity (km/h)') # Add x-label
axis[3].set_ylabel('Stopping Distance (m)') # Add y-label
axis[4].plot(velocities, stopping_distances[4])
axis[4].set_title('Tricycle')
axis[4].set_xlabel('Velocity (km/h)') # Add x-label
axis[4].set_ylabel('Stopping Distance (m)') # Add y-label
72
plt.show()
73