This document discusses using Simulink for embedded coding of an automobile start-stop system. It describes using Simulink's graphical environment and state-flow blocks to model the system behavior, then generating C code. The start-stop system automatically shuts off the engine at stops to reduce idling time. Key aspects modeled include inputs, signal conditioning, a controller section, state transitions, and code generation to flash to an automotive controller. Relay drivers are also discussed to control the starter and fuel relays.
1. Simulink based Embedded Coding
for
automobile application (start-stop
system)
SWETHA V
113004204
1
2. OBJECTIVE
Understanding the embedded
coding achievable through Simulink
Understanding the state-flow
approach of programming
Implementing this approach for auto-
mobile application
2
3. EMBEDDED CODER
Embedded coding
Easier
understandability of
graphical environment
Time efficient
Interfacing controller
AUTO CODE
GENERATION
Universal code
Standard coding
format
Conventional ‘C’
coding
Difficult to understand
the textual format
Time consuming
Have to know the
entire register &
instruction set
Not an universal code
There is “more than a
way” to do it
3
4. STATE-FLOW
Analogous to finite state-
machines
Describes the entire behavior of
the system
Different from flow-chart
The flowchart will say that the
engine is fired only by means of
cranking. But, in real life scenario,
it is possible to by-pass this
cranking and reach the vehicle
running condition by means of
push start. With the help of state-
flow, this kind of scenarios can be
well captured and brought to
notice. Thus, state-flow forms a
superior way of describing a
system’s behavior.
4
CURRENT STATE TRANSITION CONDITION
ACTION STATEMENT
DESTINATION STATE
5. Overall block diagram
• A stop-start system automatically shuts down
the engine when the vehicle comes to a stop
and restarts the engine to reduce the amount
of time a car spends idling.
• The starter-relay is responsible for starting the
vehicle and the fuel relay is responsible for
stopping the vehicle.
5
6. Input section
Digital inputs:
• Clutch – from the vehicle’s clutch pad
• Crank- the key signal used to turn on the
engine
• Vehicle safety- sensor output from bonnet
• Neutral sensor- sensor output from gear
position
• Auto-stop enable disable switch – user’s
switch present in the vehicle
Analog inputs:
• Coolant temperature- sensor output in
analog form from engine’s coolant
temperature
• Battery voltage – Battery sensor output in
analog form.
Pulsed inputs:
• Engine speed- pulses from alternator in the
form of PWM signal
• Vehicle speed- pulses from sensor in the
form of PWM signal
6
10. Digital inputs: de-bouncing logic
10
•suffer from glitches
• no steady ON or OFF state
Output & =m [1] | m [2] | m [3] |
m [4];
Output | =m [1] & m [2] & m [3] &
m [4];
Here, m [1], m [2], m [3] and m
[4] are values of the input
sampled continuously.
11. Analog inputs – averaging technique
11
•Fluctuations present in the
input voltage.
•Averaging reduces the
fluctuation
•4 samples are taken
continuously and averaged.
12. Pulsed inputs – frequency measure
12
A
B C
D
A- pulsed inputs used.
B- frequency measurement
C-Period capture
D-zero RPM detection
13. State flow block
Booting
This is the initial state where the LED blinks once confirming the working of the
controller. This state is reached when the controller is turned on through the ignition key.
Cranking
This is the state in which the user tries to start the engine. The starter safety measures
are taken out in this state. If the engine is fired in this state, the flow transfers to the
normal running condition.
Key release
This is the state where the user releases the key on account on unsuccessful cranking.
Clutch release
This is the state where the clutch releases the key on account on unsuccessful cranking.
This state is effective only when the vehicle is started after auto stop.
Over cranking
This is the state where the starter has been operated for more than four seconds and is
forced to shut down on account of safety measures. This state also indicates the
unsuccessful cranking of the engine.
13REFER PG: 29 & 30 IN
REPORT
controller-logic.docx
14. Engine off not due to auto-stop
This state indicates that the engine is off initially or engine is off due to reasons other than the auto-
atop feature.
Engine off due to auto-stop
This state indicates that the engine is off due to the auto-atop feature.
Bonnet open – fuel cut
This state is a safety measure feature. When the bonnet is open, the engine is forced to shut down by
turning off the fuel supply. This avoids accidents caused due to open bonnet. Care has to be taken
while implementing this safety feature.
Auto stop – fuel cut
The fuel supply is cut due to the auto stop features. This is indicated by LED on condition. By stopping
the fuel supply, the engine is automatically shut down.
Engine ON, vehicle not reached the initial threshold level
This is the initial running condition of any vehicle before it can reach a certain threshold.
Engine ON, vehicle above threshold level
This is the state where vehicle runs above the threshold speed.
14
15. Vehicle crawling after reaching initial threshold level
This state shows that the vehicle is moving slowly, but has not stopped. This state typically predicts
that the vehicle is in traffic signal.
Engine idling, vehicle not moving after reaching initial threshold level
This state indicates that vehicle is not moving and since initially it has crossed the speed threshold,
the auto-stop feature can be enabled.
Auto stop mode
This state indicates that vehicle is not moving, the auto-stop switch is enabled and other conditions
are full-filled and the system is ready to auto-stop.
LED blinking
This is an indication to the user that the engine is going to shut down due to auto-stop feature.
During this time, the user can disable auto-stop or he can allow the feature to take place.
Push start initially
When the battery is in dip condition, the vehicle can be started by pushing it.
Push start after auto stop
This state is similar to the previous state occurring after auto-stop condition. This condition is a rare
occurrence
15
18. Relay drivers & relay
•The two relays used to control the
start and stop of the vehicle are
the starter relay and fuel-cut
relay. The starter relay is
responsible for starting the
vehicle and fuel-cut relay for
stopping the relay.
•By convention, the starter relay is
assumed to be normally open.
When the control signal comes, it
closes and starts the starter
motor. The fuel-cut relay is
assumed to be normally close.
When the control signal comes, it
cuts the fuel supply to the
vehicle. An LED indicator is used
to indicate the auto-stop
conditions.
18
The control signal coming from the
controller will have a maximum of
3.3 volts. In order to make the relays
to function, drivers are used. These
drivers amplify this 3.3 volt to 12
volts and drive the relays
Relay drivers used were
•VNS1NV04D
•VND5160AJ-E