electronics engineering
Course handbook · Fifth year · Edition with space for notes
Automation Systems Design
Design of automation systems: modelling, simulation with MATLAB and Simulink, and implementation of industrial controllers.
- 9Topics
- 11Solved exercises
- 16Formula sheet
Free handbook generated from the lessons of the site and updated often, every time a lesson or an exercise changes: the latest version is always at www.electronics-engineering.com/handbook/automatic-proj-systems. Links work in the PDF too.
1Architecture and availability
Designing an automated system (a bottling line, a water treatment plant, a robotic warehouse) means much more than writing a program for a PLC: sensors and actuators, networks, controllers and supervisory systems must be chosen, people’s safety guaranteed, and a plant delivered that will work for twenty years. In this lesson we look at the layered architecture of an automation system, the project life cycle, and system availability with the formulas for components in series and in parallel proved and an example.
The automation pyramid
Industrial systems are organised in levels, according to the model of the ISA-95 standard (IEC 62264):

- level 0, the field: sensors (temperatures, pressures, positions) and actuators (motors, valves, cylinders), with times of the order of milliseconds;
- level 1, control: PLCs, controllers, drives, executing logic and regulation (Process Control lesson on PLCs);
- level 2, supervision: SCADA (supervisory control and data acquisition) with operator stations, alarms and data history;
- level 3, production management: the MES (manufacturing execution system) follows orders, batch traceability, quality and efficiency (lesson on commissioning);
- level 4, the enterprise: the ERP handles orders, warehouse, purchasing and accounting (Business Management lessons).
Going up, data are more aggregated and times longer; going down, the requirements for determinism and reliability grow. Today the levels are converging (Industry 4.0): field data go directly to analytics systems and the cloud through protocols such as OPC UA (lesson on industrial networks), and cybersecurity becomes part of the design.
The project life cycle
An automation project usually follows the V model:
- requirements specification: what the plant must do, with what performance, under what environmental conditions, under which standards;
- risk analysis: what hazards exist for people and the plant, and which safety functions are needed (lesson on functional safety);
- functional specification: sequences, control loops, alarms, operator interfaces;
- design of the hardware (electrical panels, choice of sensors, actuators, controllers and networks) and the software;
- implementation;
- on the rising branch, the verifications corresponding to each step: module tests, integration tests, factory acceptance test (FAT) and site acceptance test (SAT), validation against the requirements.
Every requirement must be verifiable, and every test must trace back to a requirement: requirements traceability is often required by the customer and, for safety functions, by the standards.
Availability
For a production plant the most important quantity is often availability: the fraction of time it works. If a component fails on average after a time MTBF (mean time between failures) and repair takes on average MTTR (mean time to repair), the availability is
![]()
because in each failure-and-repair cycle the component works for MTBF out of a total of MTBF + MTTR. Example. MTBF = 50,000 h and MTTR = 4 h give
. Reducing repair time (spares in stock, clear diagnostics) increases availability as much as increasing reliability.
Theorem. With independent failures, a system of
components in series (it works only if all work) has availability
; a system of components in parallel (it works if at least one works) has availability
.
Proof.
is the probability that component
works at a randomly chosen instant. In series the system works if all work, and by independence the probability is the product. In parallel the system is down only if all are down, with probability
, and availability is the complement (Signal Theory lesson on probability). ∎
Example. A cell with a PLC (
), network (
) and I/O station (
) in series has
: about 22 hours of downtime a year. Duplicating the PLC with a second one in hot standby, the equivalent PLC has
, but the system only reaches
, about 13 hours: now the network and the I/O weigh. Redundancy must be placed on the weak links, and the chain is as strong as its weakest link. The formulas hold if failures really are independent: two PLCs fed by the same power supply are not.
2Sensors and field connections
An automated system sees the plant through sensors and acts through actuators; the link between the field and the controller must carry signals over hundreds of metres, in environments full of noise, and report its own faults. In this lesson we look at the 4-20 mA current loop with the voltage budget proved and an example, scaling and the “live zero”, sensor parameters, and incremental and absolute encoders with the proofs on quadrature decoding and Gray code.
The 4-20 mA current loop
The most widespread standard for analogue field signals transmits the measurement as a current between 4 and 20 mA, proportional to the value between the minimum and maximum of the range.

Why a current and not a voltage? In a series circuit the current is the same at every point (Kirchhoff’s current law): the wire resistance, which changes with length and temperature, does not alter the measurement, whereas a voltage would arrive reduced by the drop across the wires. Moreover, the low impedance of the circuit makes it insensitive to capacitive disturbances (Electromagnetic Compatibility lesson on coupling). And two wires are enough, carrying both the transmitter’s supply and the signal.
The measured value is obtained with
. The zero of the range corresponds to 4 mA, not 0: this is the live zero. A current below about 3.6 mA (broken wire, failed transmitter) or above 21 mA (short circuit) is outside the range and is recognised as a fault (NAMUR recommendation NE 43). With a zero at 0 mA a cut wire would look like a valid minimum reading: for example an empty tank, while it is overflowing.
Theorem. A loop supplied with voltage
, with a transmitter needing at least
to operate, works over the whole range if the total loop resistance (wires plus measuring resistor) satisfies
![]()
Proof. By Kirchhoff’s voltage law, the voltage available across the transmitter is
. It is minimum when the current is maximum,
mA (or a little more if the high fault must be signalled). It must remain at least
:
, hence the formula. ∎
Example.
V,
V:
Ω. With 250 Ω of measuring resistance, 350 Ω remain for the wires: with 0.5 mm² cable (about 36 Ω/km per conductor, i.e. 72 Ω/km out and back) almost 5 km can be reached. If other instruments are inserted in the loop (a local indicator, an intrinsic safety barrier for explosive areas), each uses part of the budget.
On top of the analogue current the HART protocol superimposes a frequency-modulated digital signal with zero mean, which does not disturb the measurement and allows the transmitter to be configured and its diagnostics read. More and more often sensors are connected directly to a network (IO-Link, fieldbuses, lesson on industrial networks).
Sensor parameters
- Measuring range and permissible overload.
- Accuracy: how close the measurement is to the true value, including all errors (Electrical Measurements lesson on uncertainty).
- Repeatability: how similar repeated measurements under the same conditions are. For many control loops it matters more than accuracy, because a constant error is compensated.
- Resolution: the smallest detectable change.
- Response time, often expressed as a time constant: a slow sensor adds a delay to the control loop (lesson on process models).
- Ingress protection (IP), operating temperature, certifications for explosive atmospheres (ATEX).
Encoders
An incremental encoder measures a rotation with a disc with
lines read by two sensors offset by a quarter of a line: the signals A and B are two square waves in quadrature.
Theorem. Counting all edges of A and B gives
counts per revolution, and the direction of rotation follows from the order of the edges.
Proof. In one line period each wave has one rising and one falling edge; the edges of A and B, offset by a quarter period, never coincide, and in one period there are four, equally spaced. With
periods per revolution there are
edges. Rotating one way A leads B by a quarter period, the other way it lags: at the rising edge of A, B is 0 in one direction and 1 in the other, and the counter goes up or down accordingly. ∎
Example. A 1024-line encoder gives 4096 counts per revolution, i.e. a resolution of about 0.088°. A third signal Z (index) gives one pulse per revolution, to find zero.
An incremental encoder loses its position when switched off. An absolute encoder reads on several tracks a code identifying the position. Gray code is used, in which consecutive positions differ by a single bit: with natural binary, going from 0111 to 1000 four bits change, which the sensors never read at exactly the same instant, and for a moment any value could be read. Gray code is built by reflection: the
-bit code is the
-bit one preceded by 0, followed by the same in reverse order preceded by 1. By induction, consecutive positions within each half differ by one bit (by the hypothesis on the
-bit code), and at the boundary between the halves the two words have the same tail and differ only in the added bit; the first and last also differ by a single bit, and the code is cyclic.
3Sequential control
Much of industrial automation is sequential logic: clamp the part, drill, withdraw the tool, unclamp, start again. Describing a sequence with scattered Boolean equations is a source of errors; the sequential function chart makes it readable like a recipe. In this lesson we look at GRAFCET and SFC, the evolution rules, an example of a drilling station, the translation into code with the proof that it keeps a single step active, branches and interlocks.
Steps, transitions, actions
GRAFCET (IEC 60848) and its programming equivalent, SFC (sequential function chart, one of the IEC 61131-3 languages), describe a sequence with:
- steps: the states of the machine, shown as numbered squares; the initial step has a double border. Each step is active or inactive;
- actions associated with the steps: the outputs commanded while the step is active;
- transitions between steps, shown as bars, with a receptivity: the logical condition (sensors, push buttons, timers) that allows them to be crossed.

Evolution rules
- At the start the initial steps are active.
- A transition is enabled if all the immediately preceding steps are active; it is fired if it is enabled and its receptivity is true.
- Firing a transition deactivates the preceding steps and activates the following ones.
- Transitions that can be fired at the same instant are fired simultaneously.
- If a step must be both activated and deactivated, it stays active.
Example. In the drilling station, in step 0 the machine waits for start with the part present; in step 1 cylinder Y1 clamps the part until sensor B1 confirms clamping; in step 2 motor M1 drills for 2 s (timer T1 starts when the step becomes active); in step 3 output Y2 brings the spindle back until sensor B0, and it returns to step 0. Anyone, even the maintenance technician who did not write the program, reads the sequence and understands at which step the machine stopped.
From chart to code
Many PLCs execute SFC directly; otherwise it is translated. A Boolean variable
is associated with each step
. For each transition from step
to step
with receptivity
:
![]()
and the outputs are computed from the steps: Y1 =
, M1 =
, Y2 =
.
Theorem. In a linear sequence closed in a loop, starting with only the initial step active and evaluating at each cycle all transitions on the state at the start of the cycle, exactly one step is always active.
Proof. By induction on cycles. At the start a single step is active. Suppose that at the start of a cycle only step
is active. In a linear sequence the only enabled transition is the one leaving
, because every other transition has an inactive step as its predecessor. If its receptivity is false nothing changes; if it is true,
is reset and only the next step is activated. In both cases at the end of the cycle a single step is active. ∎
The condition “on the state at the start of the cycle” is not a detail. If the program evaluated the transitions in order and each saw the changes made by the previous ones, a step just activated could be left in the same cycle, and with receptivities already true the sequence would “slide” through several steps at once, skipping actions. To avoid this, all fireable transitions are computed first and then the steps are updated; or the transitions are written in reverse order. The same sequence is written in structured text with a CASE statement on the step number (lesson on PLC programming).
Branches
- Alternative divergence (OR): several transitions leave a step, and one branch is chosen, for example according to the part type. The receptivities must be mutually exclusive, otherwise two branches would be activated.
- Simultaneous divergence (AND, double line): once the transition is fired, several steps are activated together, for example two stations working in parallel; the simultaneous convergence waits until all branches have finished. Here the previous theorem no longer holds: more than one step is active, and the count returns to one at the convergence.
Interlocks and operating modes
The sequence describes normal operation, but a real machine also has:
- interlocks: conditions preventing a dangerous or damaging action regardless of the step (do not drill if the part is not clamped, do not open two incompatible valves). They are written as additional conditions on the outputs, not only on the transitions;
- modes manual, automatic, single cycle, and the handling of stops and restart after an emergency, which often require more code than the sequence itself. The GEMMA guide organises these modes in a standard chart;
- time monitoring: if a step lasts much longer than expected (sensor B1 never arrives), an alarm is raised indicating the step and the expected sensor, which halves fault-finding times.
Safety functions for people, such as the emergency stop, are not entrusted to the standard PLC sequence: they require certified components and logic (lesson on functional safety).
4PLC programming
The software of a modern plant can have hundreds of thousands of lines and stay in service for decades, modified by different people. The IEC 61131-3 standard fixes the PLC languages, but writing a good program also requires the rules of software engineering. In this lesson we see the languages of the standard, the worst-case response time of the PLC with its derivation and an example, tasks and priorities, function blocks with an example in structured text, and good design and testing practices.
The languages
IEC 61131-3 defines five languages, which can coexist in the same project:
- LD (ladder diagram): the relay schematic, readable by electricians, suited to simple Boolean logic (lesson on PLCs in Process Control);
- FBD (function block diagram): blocks connected by wires, natural for control loops;
- ST (structured text): a text language similar to Pascal, with expressions, loops and structures; the most suitable for algorithms, calculations and state machines;
- SFC: sequences (lesson on sequences);
- IL (instruction list), similar to assembly, declared obsolete in the third edition of the standard.
The third edition (2013) added object-oriented programming: methods, interfaces, inheritance of function blocks. The fourth edition, IEC 61131-3:2025, added UTF-8 strings and gathers in an annex the list of functions added, removed or deprecated since 2013: in new projects IL should no longer be used.
Which language to choose
Within the same project it is best to use each language where it works better: LD for interlocks and simple logic that the maintenance engineer must read on the plant, FBD for control loops and signal diagrams, ST for calculations, data handling and state machines, SFC to describe the phases of a sequence, which then call actions written in the other languages.
The cycle and the response time
A PLC runs in a cycle: it reads all the inputs into a memory image, runs the program on that image, writes all the outputs. The cycle lasts
, from less than a millisecond to a few tens of milliseconds.

Theorem. The time between the change of an input and the change of the output that depends on it is at most about
, plus the delays of the input filter and of the output.
Proof. In the worst case the input changes right after the inputs are read: the program of that cycle still uses the old value, and the new one is read at the start of the next cycle, after almost
. The program processes it and the output is written at the end of that cycle, after another
. In total almost
, to which the input filter (against bounces and disturbances) and the switching time of the output are added. ∎
Example. Cycle of 10 ms, input filter of 3 ms, relay output of 10 ms: up to
ms. An input pulse shorter than one cycle may never be seen at all. For fast events one uses interrupt inputs, fast counters implemented in hardware or tasks with a shorter cycle.
When the worst case is not enough
The cycle time is not constant: it depends on the branches of the program executed, on the communications and on the diagnostics. For the calculation one uses the maximum measured cycle time (PLCs show it in the diagnostics), not the average. If the signal comes from a fieldbus, the cycle of the bus must also be added to the response time.
Tasks and priorities
The program is divided into tasks with different periods and priorities: a fast task (1-2 ms) for the critical functions, a normal one (10-20 ms) for the logic, a slow one (100 ms or more) for the service functions, plus tasks triggered by events. It is the same fixed-priority scheduling as real-time systems (lesson on real-time systems in Operating Systems): the load of the fast tasks must be kept low, and the PLC supervises the cycle time with a watchdog that brings the outputs to a safe state if it is exceeded.
Example. A fast task with period 2 ms and execution of 0.4 ms, a normal one with period 10 ms and execution of 3 ms and a slow one with period 100 ms and execution of 10 ms load the CPU for
![Rendered by QuickLaTeX.com \[ U = \sum_i \frac{C_i}{T_i} = \frac{0{,}4}{2} + \frac{3}{10} + \frac{10}{100} = 0{,}2 + 0{,}3 + 0{,}1 = 0{,}6 \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-53efd156ba2e1897b98e1054c04f9b43_l3.png)
With fixed priorities assigned by period (shorter period, higher priority) and deadlines equal to the periods, the Liu and Layland bound for three tasks is
: with
all the tasks meet their deadlines. It is a sufficient condition, not a necessary one: above the bound a finer analysis of the response times is needed.
Function blocks
A function block (FB) is a module with inputs, outputs and internal memory; as many instances are created as there are identical machines. The standard provides some standard ones, such as timers (TON, TOF, TP) and edge detectors (R_TRIG). An example in structured text: the command of a pump as a state machine, with thermal protection and reset.
FUNCTION_BLOCK FB_Pompa
VAR_INPUT
Avvio, Arresto, Termico : BOOL; (* Termico = relè termico scattato *)
END_VAR
VAR_OUTPUT
Contattore, Allarme : BOOL;
END_VAR
VAR
Stato : INT := 0; (* 0 ferma, 1 in marcia, 2 guasto *)
END_VAR
CASE Stato OF
0: Contattore := FALSE;
IF Avvio AND NOT Arresto AND NOT Termico THEN Stato := 1; END_IF;
1: Contattore := TRUE;
IF Termico THEN Stato := 2;
ELSIF Arresto THEN Stato := 0; END_IF;
2: Contattore := FALSE;
Allarme := TRUE;
IF NOT Termico AND Arresto THEN (* riarmo: guasto sparito e conferma *)
Allarme := FALSE; Stato := 0;
END_IF;
END_CASE;
END_FUNCTION_BLOCKEach state explicitly declares the outputs; the fault takes precedence over the stop; the reset requires that the cause has disappeared and an operator action, so the pump does not restart by itself. Ten pumps are ten instances of the same block, tested once.
Notes on the code
- The state is an integer for simplicity; in a real project an enumerated type is better (for example
(Ferma, InMarcia, Guasto)), so that the compiler checks the values and the code reads by itself. - The stop button is normally wired closed: if the wire breaks, the program sees a stop and the pump stops. In the block the input
Arrestomust therefore be obtained by negating the contact. - The block does not replace the safety guards wired or made with a safety PLC: it manages the command, not the emergency stop.
Good practices
- Structure: small blocks with a clear task; no global variables used everywhere; meaningful names and a shared convention.
- Separation between process logic, mode management, alarms and the operator interface.
- Libraries of tested blocks for recurring components (motors, valves, controllers), which make the code uniform and reduce errors.
- Version control of the code, with the history of changes: modern environments export the projects in text format (PLCopen XML, standardised as IEC 61131-10) precisely for this.
- Tests: tests of the blocks on a simulator, automatic regression tests, and virtual commissioning with a model of the plant (lesson on commissioning).
- Comments that explain the why, not the how.
- For motion control, the PLCopen specifications standardise the blocks (MC_MoveAbsolute and similar) across different manufacturers (lesson on drives).
In summary
- IEC 61131-3 defines LD, FBD, ST, SFC and IL; since 2013 there is object-oriented programming, the current edition is from 2025 and IL is no longer used in new projects.
- The PLC works in a cycle: the worst-case response time is about
plus the input and output delays (example: 33 ms with a 10 ms cycle). - Periodic tasks with fixed priority are verified as in real-time systems: in the example
, below the limit of 0.78. - A function block in ST with an explicit state machine, instantiated for each identical machine, makes the code tested once and reusable.
- Structure, libraries, version control and automatic tests are the same good practices of software, applied to the plant.
5Industrial networks
A modern plant has thousands of measuring and control points spread over hundreds of metres. Connecting them one by one to the PLC with a pair of wires each cost enormously in cables and wiring errors; industrial networks carry everything on a few cables. Unlike office networks they must be deterministic: a command must arrive within a guaranteed time, always. In this lesson we look at the CAN bus with the proof of its arbitration and the trade-off between speed and length, industrial Ethernet and EtherCAT with a cycle-time calculation, OPC UA and plant cybersecurity.
The CAN bus
CAN (controller area network), born in the 1980s for cars, is used in cars, agricultural machinery, medical equipment and automation (CANopen). All nodes are on the same twisted pair, and the bus has two levels: dominant (0) and recessive (1). If even a single node transmits 0, the bus is 0: it is a wired AND. Every message starts with an identifier indicating its content and priority.

Theorem. If several nodes start transmitting together, the message with the numerically lowest identifier wins, and its transmission continues without any damage or delay.
Proof. Each node transmits the identifier starting from the most significant bit and compares each transmitted bit with the one read on the bus. As long as all transmit the same bits, the bus coincides with what each transmits. At the first bit where the identifiers differ, the nodes transmitting 0 see 0, those transmitting 1 see 0 (because dominant prevails): the latter detect the difference, stop transmitting and will retry later. The nodes left are those with 0 in that position and equal in all previous ones, i.e. with a lower identifier; repeating the argument on the following bits, only one remains, the one with the minimum identifier. For the winner the bus has always carried exactly its bits: its message has suffered no alteration. ∎
Unlike the original Ethernet, where collisions destroyed packets (Telecommunication Networks lesson on Ethernet), CAN collisions waste no time, and the most important messages have a computable maximum delay, with the same fixed-priority analysis as real-time systems.
Speed and length. Arbitration works only if every node sees, within the same bit, the dominant bit of the farthest node: the bit must last longer than the round-trip time of the signal on the cable, plus the transceiver delays. With about 5 ns/m of propagation, at 1 Mbit/s (1 µs bit) the maximum length is about 40 m; at 125 kbit/s it reaches 500 m. CAN FD increases the speed only in the data part of the message, after arbitration.
Industrial Ethernet
Ethernet has won in the factory too, with protocols guaranteeing its determinism: PROFINET, EtherNet/IP, EtherCAT, POWERLINK, and the TSN (time-sensitive networking) standard, which adds to ordinary Ethernet clock synchronisation (IEEE 802.1AS) and time windows reserved for critical traffic.
EtherCAT uses an elegant idea: a single frame leaves the controller and passes through all the nodes in a line; each reads on the fly the data addressed to it and writes its own into the frame as it passes, with a delay of a few hundred nanoseconds, without storing it. The frame returns from the last node with all the responses.
Example. 100 nodes with 8 bytes of data each: 800 bytes plus about 40 of header. At 100 Mbit/s transmission takes
µs; add the node traversal delay, of the order of a microsecond per node counting both directions, and cable propagation. A complete cycle fits in about 200 µs: 800 inputs and outputs updated 5000 times a second, with a single frame.
OPC UA
At the upper levels of the pyramid (lesson on architecture) it is necessary to exchange not only values, but their meaning: units, ranges, alarms, machine structure. OPC UA (IEC 62541) offers an object-based information model, independent of manufacturer and operating system, with client-server and publish-subscribe services, and built-in security (authentication, encryption, signatures). Companion specifications define standard models for whole categories of machines (machine tools, robots, injection moulding machines), so an MES reads machines from different manufacturers in the same way.
Cybersecurity
Plants used to be isolated, and their protocols were born without authentication: anyone who reaches the network can send commands to a PLC. With plants connected to corporate networks and the Internet, attacks have become real (Stuxnet in 2010 sabotaged centrifuges by modifying PLC programs). The IEC 62443 standard organises the defence:
- division of the plant into zones with different security levels, connected by controlled conduits (firewalls, demilitarised zones between office and plant networks);
- no direct access from the Internet to field devices; remote access for maintenance only through controlled and logged points;
- authentication of users and devices, updates, an inventory of components;
- secure protocols where possible (OPC UA with encryption) and traffic monitoring, which in a factory is very regular and makes anomalies stand out.
In Europe the NIS2 directive and the Cyber Resilience Act make these requirements mandatory for many sectors and products.
6Functional safety
A press, a robot, a chemical reactor can kill. Functional safety concerns the functions of the control system that protect people: the emergency stop, light curtains, safety switches on guards, the automatic interlocking actions of a process plant. Standards require showing with numbers how reliable these functions are.
In this lesson you will learn: how to go from risk to a safety integrity level (SIL); how to calculate the average probability of failure on demand (PFD) for one channel and for two redundant channels, with the derivations; why common cause failures limit the benefit of redundancy, with a numerical example; and how the ISO 13849 standard applies to machines.
Risk and integrity levels
Risk combines the severity of a harm and its probability. The process is always the same: identify the hazards, estimate the risk, reduce it first with an inherently safe design (eliminating the hazard), then with guards, and only at the end with information (warnings, training). When the reduction is entrusted to a function of the control system, the standard IEC 61508 (and the standards derived from it, IEC 61511 for the process industry, IEC 62061 for machines) requires assigning it a safety integrity level (SIL), from 1 to 4.
Low-demand functions: the PFD
For functions that act rarely (low demand rate, at most once a year), the SIL is defined by the average probability of failure on demand (PFD):
| SIL | Average PFD | Risk reduction |
|---|---|---|
| 1 | from 10⁻² to 10⁻¹ | from 10 to 100 |
| 2 | from 10⁻³ to 10⁻² | from 100 to 1000 |
| 3 | from 10⁻⁴ to 10⁻³ | from 1000 to 10 000 |
| 4 | from 10⁻⁵ to 10⁻⁴ | from 10 000 to 100 000 |
High-demand functions: the PFH
Functions that act often or continuously (typical of machines) are measured instead by the average frequency of dangerous failures per hour, PFH: from 10⁻⁶ to 10⁻⁵ /h for SIL 1, down to 10⁻⁹–10⁻⁸ /h for SIL 4. The number alone is not enough: the standard also requires constraints on the architecture (hardware fault tolerance, safe failure fraction) and measures against systematic failures, that is specification, design and software errors, which no probabilistic formula describes.
Undetected dangerous failures
A safety function stays idle for months; one of its failures can remain hidden until it is needed. What counts are the undetected dangerous failures, with rate
: those that would prevent the intervention and that automatic diagnostics do not discover. Only a complete periodic test, every
, finds them, after which the function is considered as new.

One channel: 1oo1 architecture
Theorem. For a single channel (1oo1 architecture) with
, the average probability of failure on demand is
![]()
Proof. With a constant failure rate, the probability that the channel is failed at time
after the test is
(lesson on probability). A demand can arrive at any instant of the interval with equal probability, so we take the average:
![]()
∎
Two redundant channels: 1oo2 architecture
Theorem. For two independent channels, of which one is enough to intervene (1oo2 architecture),
![]()
Proof. The function fails only if both channels are failed; with independent failures the probability at time
is
. The average over the interval is
. ∎
The two formulas hold if the channels are tested together and if the test is perfect. The exact numerical calculation, with the exponential instead of the linear approximation, differs by less than 1 % for the values of the example that follows.
Common cause
Example: a lock-out pressure switch
Example. A lock-out pressure switch with
/h, tested once a year (
h):
, SIL 2. Doubling it in 1oo2, the formula gives
: it would seem SIL 4.
The beta factor
But the two pressure switches are identical, mounted on the same tap, calibrated by the same person: a calibration error, a clogging, an overvoltage can put them out of service together. The beta factor
is the fraction of failures that hits all the channels for a common cause, and that part behaves like a single channel:
is added. With
%, the term is
, almost nine times the independent term: the total is about
and the function is SIL 3, not 4.
The common cause term dominates, so improving the rest does little. Testing the two pressure switches every six months (
h) brings the total down to about 1.2·10⁻⁴: still SIL 3. The same happens by bringing
to 2 %: about 1.1·10⁻⁴. To reach SIL 4 one would have to act on several fronts together, and in practice SIL 4 is almost never required: if needed, the process is usually redesigned to remove the hazard.
How to fight it
- Diversity: sensors of different physical principle or from different manufacturers;
- physical separation: separate process taps, cables and power supplies;
- staggered maintenance: calibrations done at different times, perhaps by different people;
- more diagnostic coverage, which turns undetected failures into detected ones, which bring the plant to a safe state;
- a shorter test interval, useful above all as long as the independent term dominates.
Machines and ISO 13849
For machines the standard ISO 13849-1 (2023 edition) is often used. It classifies the safety functions into performance levels (PL from a to e) on the basis of the category of the architecture (from B to 4: from the simple single channel to the two channels with diagnostics that detects every single fault), the mean time to dangerous failure of the components (MTTFD), the diagnostic coverage and the measures against common cause. The required level (PLr) is derived from the risk graph: severity of the injury, frequency of exposure, possibility of avoiding the hazard.
The PL also corresponds to a frequency of dangerous failures per hour: for example PL d between 10⁻⁷ and 10⁻⁶ /h, PL e between 10⁻⁸ and 10⁻⁷ /h, the same ranges as SIL 2 and SIL 3. For this reason a design made with ISO 13849 and one made with IEC 62061 can be compared.
Practical principles
- the emergency stop is a complementary measure, it does not replace the guards; it has priority over everything and requires a manual reset;
- safety contacts with positive opening: the contact opens mechanically even if it has welded;
- safety circuits work on a resting current: a cut wire leads to the safe state, like the live zero of 4-20 mA (lesson on sensors);
- certified safety PLCs are used, with dual processors and diagnostics, and safety input and output modules; the safety program is separate from the functional one and protected from changes.
In Europe the general requirements are set by the Machinery Directive 2006/42/EC, replaced by Regulation (EU) 2023/1230, applicable from 20 January 2027.
In summary
- Functional safety requires quantifying the reliability of the protection functions: SIL 1–4 (IEC 61508, 61511, 62061) or PL a–e (ISO 13849).
- For low-demand functions the average PFD matters: about
for one channel,
for two independent channels. - Common cause failures add
and usually dominate: in the example they bring the redundant system from an apparent SIL 4 down to SIL 3. - Diversity, separation, diagnostics and periodic tests are the tools to reduce the PFD; the numbers must always be accompanied by architecture constraints and measures against systematic failures.
7Drives and motion control
Conveyor belts, robots, packaging machines, machine-tool axes: almost every movement in a factory is produced by an electric motor driven by a drive (an electronic converter with its control, lessons in Power Electronics). Designing an axis means choosing the motion profile, the motor, the gearbox and the tuning. In this lesson we see the trapezoidal profile with the timing formulas derived and an example, the optimal gear ratio with its derivation, the RMS torque for thermal sizing, and the structure of cascaded controllers.
The motion profile
To move a load over a distance
in the minimum time, with maximum speed
and maximum acceleration
, one accelerates at the maximum, continues at constant speed and brakes at the maximum: the trapezoidal profile.

Theorem. If
, the total time is
![]()
otherwise the maximum speed is not reached, the profile is triangular and
.
Proof. The acceleration lasts
, and so does the braking. The displacement is the area of the trapezoid:
(the average of the bases times the height), hence
. The constant-speed stretch exists if
, that is
, that is
. Otherwise one accelerates up to half the path and brakes: each half
lasts
. ∎
Example.
m,
m/s,
m/s²:
, so
s. For short moves the acceleration matters, for long ones the speed.
S-profiles and jerk
The trapezoidal profile has a stepwise acceleration: the jerk (the derivative of the acceleration) is infinite and makes the mechanics vibrate. S-profiles, with acceleration ramps, limit the jerk at the price of a slightly longer time, and they are the norm where precision and freedom from vibration matter.
The gear ratio
Between motor and load there is often a gearbox: the motor turns
times faster than the load and the torque reaches the load multiplied by
(neglecting losses). Which ratio makes the motion the most rapid?
Theorem. With a motor of torque
and inertia
and a load of inertia
, the acceleration of the load is maximum at the gear ratio
![]()
that is, when the load inertia reflected to the motor,
, equals that of the motor.
Proof. If the load accelerates at
, the motor accelerates at
. The motor supplies the torque
to accelerate itself and the load reflected to the motor shaft:
. Hence
![]()
The denominator, as a function of
, has derivative
, zero for
, where it is minimum (it is the sum of an increasing and a decreasing term in
, with constant product). ∎
Example.
kg m²,
kg m²:
. In practice one chooses a ratio close to the optimum compatibly with the maximum speed of the motor, and a ratio of inertias (
over
) not too far from 1 also makes the system easier to tune, because the elastic mechanics between motor and load disturbs the speed loop less.
Thermal sizing
A motor heats up through the copper losses, proportional to the square of the current and therefore of the torque. In a duty cycle with torques
for the times
, the RMS torque matters
![Rendered by QuickLaTeX.com \[ C_{rms} = \sqrt{\frac{\sum_iC_i^2t_i}{\sum_it_i}} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-d0bea1a13d6735bd22c116ddd07648e7_l3.png)
which must be below the continuous rated torque of the motor (the thermal time constant, of minutes, is much longer than the cycle). The peak torque, instead, must stay below the maximum torque. Example. A cycle of 1 s with 0.2 s at 10 N m (acceleration), 0.5 s at 2 N m, 0.2 s at 6 N m (braking, with the load helping), 0.1 s at standstill:
N m. A motor of at least 5.4 N m continuous and 10 N m peak is needed; the average value, 4.2 N m, would lead to undersizing.
Cascaded controllers
A servo drive has three nested loops (see the lesson on cascade control in Process Control):
- the current (torque) loop, the innermost and fastest, with a bandwidth of a few kilohertz, which uses the vector control of the motor (see the lesson on inverters in Power Electronics);
- the speed loop, with a bandwidth of a few hundred hertz, usually a PI;
- the position loop, the outermost, often proportional with a feedforward of speed and acceleration calculated from the profile.
Separation of bands and feedforward
Each loop must be 3 to 10 times slower than the one inside it, which can thus be seen as almost ideal. The feedforward is decisive: with the profile known in advance, the controller already applies the torque needed to accelerate the inertia, and the position loop only has to correct the errors, not chase the reference.
Several synchronised axes
When several axes must move together (electronic cams, interpolation of a trajectory, a robot), the motion controller computes the references of all the axes in step, over a deterministic network such as EtherCAT (see the lesson on industrial networks).
In summary
- Trapezoidal profile: if
the minimum time is
, otherwise the profile is triangular and
. - S-profiles limit the jerk and the vibrations, with a slightly longer positioning time.
- The gear ratio that maximises the acceleration of the load is
: the load inertia reflected to the motor equals that of the motor. - For thermal sizing the RMS torque
matters, and it must stay below the continuous torque of the motor; the peak torque must stay below the maximum torque. The average torque leads to undersizing. - A servo drive has three cascaded loops (current, speed, position), each 3 to 10 times slower than the one inside, with feedforward of speed and acceleration calculated from the profile.
8Commissioning and maintenance
A plant is not finished when the last cable is connected: it must be tested, started up, handed over and then kept efficient for years. In this lesson we look at factory and site acceptance tests, virtual commissioning with the digital twin, operator interface design and alarm management, the OEE indicator with the proof of its compact form and an example, and maintenance strategies.
Acceptance tests
- FAT (factory acceptance test): the customer checks the machine or the panel at the manufacturer’s premises, before shipment, following a written test protocol that traces back to the requirements (lesson on architecture). Fixing an error here costs much less than on site.
- SAT (site acceptance test): after installation, the tests are repeated in the real plant, with the real connections, and those that can only be done there are added.
- Commissioning: point-by-point wiring checks (every sensor, every actuator), instrument calibration, dry runs of the sequences and then runs with product, loop tuning, tests of the safety functions.
- Documentation handed over: updated electrical diagrams, programs with source code, operation and maintenance manuals, certificates, declaration of conformity.
Virtual commissioning
On-site commissioning is expensive and under pressure: the plant must start, and every day of delay is lost production. Virtual commissioning connects the real PLC program to a simulation model of the plant (machine kinematics, sensors, actuators, flow of parts), and tests the software before the hardware exists. Sequence errors, missing interlocks and collisions between axes are found this way. The same model, kept aligned with the plant and fed with its data, becomes the digital twin, useful for training operators, trying out changes and optimising production.
The operator interface
The human-machine interface (HMI) must show at a glance whether all is well, and draw attention only when needed. The ISA-101 standard recommends sober graphics, with grey backgrounds and few colours, reserving bright colours for abnormal conditions: on an all-colourful screen a red alarm goes unnoticed. Screens are organised in levels, from the plant overview to the details of a piece of equipment, with trends of the important quantities.
Alarm management (ISA-18.2, IEC 62682) starts from a principle: every alarm must require an operator action. A system generating hundreds of alarms an hour, many without consequences, teaches people to ignore them, and in a real emergency the important information is lost in the flood (this was a factor in several serious industrial accidents). Indicative targets are a few alarms per operator per hour in normal conditions, and alarm rationalisation (removing duplicates, setting priorities, hysteresis and delays) is a real design task.
Overall effectiveness
The MES (lesson on architecture) measures performance with OEE (overall equipment effectiveness), the product of three factors:
- availability
= run time / planned time (losses from breakdowns, changeovers); - performance
= (parts produced × ideal cycle time) / run time (losses from minor stops and reduced speed); - quality
= good parts / parts produced (scrap and rework).

Theorem.
.
Proof. Multiplying the three definitions, the run time cancels between
and
, and the parts produced between
and
:
![]()
where
are the parts produced and
the good ones. ∎
The compact form has a clear interpretation: OEE is the fraction of planned time that would have sufficed to produce the good parts at ideal speed. Example. A 480 min shift, 48 min of stoppages:
. Ideal cycle time 0.5 min, 734 parts produced:
. 719 good parts:
. OEE
. A value of 85 % is considered excellent for discrete manufacturing; many plants are between 40 and 60 %. The breakdown shows where to act: here the biggest loss is in performance (minor stops), not breakdowns.
Maintenance
- Corrective: repair when it breaks. Acceptable for cheap, non-critical components.
- Preventive: replace at fixed intervals, before the expected failure. It wastes useful life and does not avoid random failures, which for electronics are the majority (the flat part of the bathtub curve, Microelectronics lesson on testing).
- Predictive (condition-based): the condition of components is measured (bearing vibration with spectral analysis, temperatures, motor currents, valve stroke times) and action is taken when the trend announces a failure. The data are already in the automation system, and automatic analysis, including machine learning techniques, is one of the most concrete applications of Industry 4.0.
The common goal is to increase availability (lesson on architecture) by reducing both failures and repair times.
9Vehicle dynamics and ADAS functions
Driver assistance functions (ADAS: adaptive cruise control, lane keeping, automatic emergency braking, stability control) are automatic control systems whose “process” is the vehicle. To design them, tune them and test them in simulation a model of the vehicle is needed: simple enough to be analysed and put into an ECU, faithful enough to predict real behaviour. This lesson presents the basic models: the forces exchanged by the tyres, the bicycle model for lateral dynamics, longitudinal dynamics and the way the main ADAS functions use them. The linked in-depth study develops the complete models, with proofs and code.
Reference frames and degrees of freedom
According to ISO 8855 the vehicle-fixed frame has the
axis forwards,
to the left and
upwards, with origin at the centre of gravity. A rigid vehicle has six degrees of freedom: longitudinal, lateral and vertical translations, and roll (about
), pitch (about
) and yaw (about
) rotations. For driving on a flat road three matter most: the longitudinal velocity
, the lateral velocity
and the yaw rate
. Their ratio defines the vehicle sideslip angle
: the angle between the direction the vehicle points and the direction it moves.
The tyre: all forces pass through it
The only horizontal forces that push, brake and turn a car (apart from the air) arise in the four contact patches, each the size of a postcard. A tyre produces force only if it slips a little relative to the road:
- in the longitudinal direction the slip ratio
(in traction; in braking one divides by the wheel speed): the wheel turns a little faster or a little slower than it “should”; - in the lateral direction the slip angle
: the angle between the direction the wheel points and the direction its centre moves.
For small slips the force is proportional:
, with
the cornering stiffness (typically 50-100 kN/rad per wheel of a car). For large slips the force reaches a maximum, about
with
the friction coefficient (about 1 on dry asphalt, 0.5 on wet, 0.1-0.2 on snow and ice), and then drops slightly. Measured curves are described with Pacejka’s magic formula (in-depth study).

The bicycle model
To study cornering at constant speed the two wheels of each axle are lumped into one, at the centre: the vehicle becomes a “bicycle” with a steered front wheel (angle
) and a rear one. With
and
the distances of the centre of gravity from the axles,
the mass,
the yaw moment of inertia,
and
the axle cornering stiffnesses, and assuming small angles and constant speed
, the slip angles are
![]()
and Newton’s and the moment equations give
![]()
A linear second-order system with input
and state
: it is analysed with the tools of Control Systems (transfer function, poles, step response). The term
is the centripetal acceleration due to the rotation of the frame.

Understeer and oversteer
In steady state, on a bend of radius
driven with lateral acceleration
, the model gives the required steering angle:
![]()
with
the wheelbase.
is the “geometric” (Ackermann) angle that would be needed at very low speed;
is the understeer gradient:
, understeering vehicle: the faster it goes, the more steering is needed for the same bend. This is the behaviour wanted in all production cars, because it is stable and the driver perceives it as “the car tends to run wide”;
, neutral;
, oversteering: above a critical speed
the vehicle becomes unstable and tends to spin.
For an understeering vehicle the steady-state yaw-rate gain
has a maximum at the characteristic speed
: for an average car it is around 70-100 km/h.

Longitudinal dynamics
Along
, the traction (or braking) force
exchanged by the tyres with the road overcomes the resistances:
![Rendered by QuickLaTeX.com \[ m\,\dot v = F_x - \underbrace{f\,m\,g}_{\text{rolling}} - \underbrace{\tfrac{1}{2}\rho\,C_d\,A\,v^2}_{\text{aerodynamic}} - \underbrace{m\,g\sin\theta}_{\text{gradient}} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-6960407c496dcf484955ea45c36ae383_l3.png)
with
the rolling resistance coefficient,
kg/m³ the air density,
the drag area (about 0.6-0.7 m² for a car). Aerodynamic drag grows with the square of speed and the power needed with the cube: this is why motorway fuel consumption rises so quickly. In braking the maximum deceleration is about
, limited by grip and by load transfer towards the front axle.

How ADAS functions use them
- ACC, adaptive cruise control: uses longitudinal dynamics. A radar measures the distance and speed of the vehicle ahead; the controller adjusts the speed keeping a distance that grows with speed,
, with a time gap
of 1-2 s. - AEB, automatic emergency braking: computes the time to collision
and, below a threshold, warns and then brakes; it needs to know the maximum achievable deceleration. - LKA, lane keeping assist: uses the bicycle model written in error coordinates relative to the lane (lateral offset and relative heading angle) and applies a torque to the steering wheel.
- ESC, electronic stability control: compares the measured yaw rate with the “reference” one given by the bicycle model, limited by grip (
); if the vehicle oversteers or understeers too much, it brakes a single wheel to create a corrective moment. - Trajectory planning and autonomous driving: at low speed the kinematic model (without slip) is used, with algorithms such as pure pursuit.
The linked in-depth study derives the bicycle model step by step, Pacejka’s tyre model, load transfers and ADAS controllers, with Python simulations; the exercises are on the linked page.
Vehicle dynamics in depth: bicycle model proved, Pacejka, load transfer, ABS, ESC, ACC, LKA and pure pursuit in Python
This page takes the vehicle dynamics lesson to the level of detail needed by those who work on ADAS functions and stability control. It derives the bicycle model step by step, proves the stability conditions and the understeer formulas, describes the tyre with Pacejka’s model (the coefficients B, C, D, E and their meaning), the friction ellipse and the relaxation length, computes load transfers, and shows how these models become the ESC, ABS, ACC, LKA controllers and pure pursuit path tracking. The simulations are in Python, with verified code.
Numerical values of an average car used in the examples:
kg,
kg·m²,
m,
m (
m),
kN/rad and
kN/rad (cornering stiffness of each axle), centre of gravity height
m.
The bicycle model, derived
Kinematics. In the vehicle-fixed frame (x forwards, y to the left) the centre of gravity has velocity
and the vehicle rotates with yaw rate
. A point at distance
ahead of the centre of gravity along
has velocity
(rigid motion:
). So the centre of the front axle (
) has lateral velocity
and the rear one (
)
.
Slip angles. The angle between the wheel direction and the direction of its centre is, for the front wheel steered by
,
, and for the rear
. With small angles and constant
they linearise:
,
.
Dynamics. The frame rotates with the vehicle: the derivative of velocity in a rotating frame contains the term
, whose lateral component is
. Newton’s second law along
and the moment equation about
give, with the axle lateral forces
and
(the front force is almost perpendicular to the vehicle axis for small
):
![]()
Substituting the slip angles gives the state form
with
:
![Rendered by QuickLaTeX.com \[ A = \begin{pmatrix} -\dfrac{C_f + C_r}{mv} & -v - \dfrac{aC_f - bC_r}{mv} \\ -\dfrac{aC_f - bC_r}{I_zv} & -\dfrac{a^2C_f + b^2C_r}{I_zv} \end{pmatrix},\qquad B = \begin{pmatrix} \dfrac{C_f}{m} \\ \dfrac{aC_f}{I_z} \end{pmatrix} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-cab3df82ecf46331565d1a353a7474a8_l3.png)
The lateral acceleration measured by an accelerometer at the centre of gravity is
.
Steady state, understeer and stability, proved
Theorem (steady-state steering). In a steady turn of radius
, with
and
:
![]()
Proof. In steady state
. From the moment equation
; from Newton’s
. So
and
: each axle carries the fraction of centripetal force corresponding to the load it supports. The slip angles are
,
. Subtracting the kinematic expressions:
. Hence
. ∎
The sign of
tells which axle “slips more”: if the front slips more than the rear the vehicle understeers. With the example data
mrad/(m/s²)
° per m/s²: in a bend at 4 m/s² (0.4 g) 0.77° more road-wheel steering than geometry is needed, about 12° at the steering wheel with a steering ratio of 15.
Theorem (stability). The bicycle model is stable at every speed if
; if
it becomes unstable above
.
Proof. A
system is stable if and only if the trace of
is negative and the determinant positive. The trace is always negative. Computing the determinant and simplifying with
:
![Rendered by QuickLaTeX.com \[ \det A = \frac{C_fC_rL^2}{mI_zv^2} - \frac{aC_f - bC_r}{I_z} = \frac{C_fC_rL}{mI_z}\left(\frac{L}{v^2} + K_{us}\right) \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-5bb80fb85fa5c05d1fff3d03557ff94b_l3.png)
(using
). With
it is always positive; with
it vanishes at
and beyond becomes negative: a real pole moves into the right half-plane. ∎
The transfer function steering → yaw rate has static gain
and poles that move with speed. With the example data (computed with the code below): at 10 m/s
rad/s and
; at 20 m/s 9.1 rad/s and 0.84; at 30 m/s 7.2 rad/s and 0.70. The vehicle becomes slower and less damped as speed increases: this is what the driver feels as a “lazier, more swaying” response on the motorway.

The tyre: Pacejka’s model
Pacejka’s magic formula describes measured forces with a few constants:
![]()
with
the slip angle (for the lateral force) or the slip ratio (for the longitudinal one), and
the peak value, about
;
the shape factor, which decides how much the curve drops after the peak (about 1.3 for lateral force, 1.6-1.9 for longitudinal);
the stiffness factor: the slope at the origin is
, i.e. the cornering stiffness
;
the curvature, which shapes the curve near the peak.
In complete models (MF 5.2, MF 6.1, used in industry simulators) each coefficient in turn depends on load, camber and pressure through dozens of parameters measured on a test rig. Two effects matter even in simple models:
- load sensitivity:
and
grow less than proportionally with
. This is why two wheels with different loads give less total lateral force than two wheels with the same average load: lateral load transfer “takes away” grip from the axle where it is larger; - friction ellipse: the total force cannot exceed about
, in any direction:
. Braking in a bend takes away lateral force: this is why ABS leaves the steered wheels able to generate force.


Relaxation length. The tyre does not generate force instantly: it has to roll a distance
(of the order of 0.3-0.5 m) for the deformation to settle. The model is a first-order lag
, with time constant
: at low speed the tyre is “slow”, and this matters in stability control at 10-20 km/h.
Load transfers
Longitudinal. When braking with deceleration
, moment balance about the rear contact point, with the inertial force
applied at the centre of gravity at height
, gives
![]()
With the example data and
: at rest 8.49 kN front and 6.23 rear; when braking 10.98 and 3.74 kN. This is why front brakes are larger and brake distribution must adapt to load (electronic brake-force distribution EBD): locking the rear wheels first makes the vehicle unstable.
Lateral. In a bend, on each axle of track
, load moves from the inner to the outer wheel by
, with a split between the axles decided by the anti-roll bar stiffnesses. Because of load sensitivity, the axle with more transfer loses more cornering stiffness: stiffening the front bar makes the vehicle more understeering, stiffening the rear one more oversteering. It is the most used adjustment on the track.

From the wheel to ABS
The dynamics of a wheel is
, with
the torque (drive or brake) and
. When braking, if the brake torque exceeds what the road can return at the peak of
, the wheel decelerates faster and faster and locks (
): the tyre slides, loses lateral grip and the vehicle no longer steers. ABS estimates slip from the wheel speeds and modulates brake pressure to keep it near the peak (about 0.1-0.2), with 5-15 cycles per second. Traction control does the same when accelerating by reducing engine torque or braking the spinning wheel.
ESC: stability control
ESC compares the measured yaw rate with a reference given by the bicycle model and limited by grip:
![]()
The limit comes from
. If
exceeds the reference the vehicle oversteers: the outer front wheel is braked, creating a straightening moment. If
is too small the vehicle understeers: the inner rear wheel is braked. The controller is typically a PI on the yaw error with activation logic, and it works together with ABS on the same brakes.
The kinematic model and pure pursuit
At low speed slip is negligible: wheels move where they point. The kinematic bicycle model, referred to the rear axle, is
![]()
Theorem (pure pursuit). To reach, along a circular arc, a point
of the path at distance
and seen at an angle
from the vehicle axis, the curvature
is needed, i.e. the steering
.
Proof. The required circle is tangent to the vehicle axis at the rear axle and passes through
. Its centre lies on the perpendicular to the axis, at distance
. The triangle formed by the centre, the rear axle and
is isosceles (two sides are radii), and the angle at the centre is
(the angle between chord and tangent is half the central angle). So
,
. In the kinematic model
, giving
. ∎
is the only parameter: small gives precise but oscillating tracking, large gives smooth tracking that “cuts” corners. It is usually increased with speed,
.

ACC and LKA
ACC. With the distance
from the preceding vehicle and its speed
, the constant time-gap policy wants
. A simple controller commands an acceleration
, then limited for comfort (about −3 to +2 m/s²) and implemented by the engine and brake torque control. In a platoon of vehicles all with ACC, the time-gap policy with large enough
guarantees string stability: a disturbance of the first vehicle is not amplified along the line.

LKA. The bicycle model is written relative to the lane:
the lateral offset from the centre,
the angle between the vehicle and the lane tangent,
the road curvature. For small angles
and
: with the state
a fourth-order linear model is obtained (Rajamani) on which a state-feedback (LQR) or predictive (MPC) controller is designed, with the curvature as a measured disturbance to be compensated in advance.

Simulations in Python
The bicycle model, with gains and poles at various speeds and the step response:
import numpy as np
# parameters of an average car
m, Iz = 1500.0, 2500.0 # mass [kg], yaw moment of inertia [kg m^2]
a, b = 1.1, 1.5 # distances of the CG from the front and rear axle [m]
L = a + b # wheelbase [m]
Cf, Cr = 100e3, 120e3 # axle cornering stiffnesses [N/rad]
def matrices(v):
"""Linear bicycle model: state x = [vy, r], input delta (road-wheel steering)."""
A = np.array([[-(Cf + Cr) / (m * v), -v - (a * Cf - b * Cr) / (m * v)],
[-(a * Cf - b * Cr) / (Iz * v), -(a**2 * Cf + b**2 * Cr) / (Iz * v)]])
B = np.array([Cf / m, a * Cf / Iz])
return A, B
Kus = m / L * (b / Cf - a / Cr) # understeer gradient [rad/(m/s^2)]
vch = np.sqrt(L / Kus) # characteristic speed [m/s]
print(f"Kus = {Kus*1e3:.2f} mrad/(m/s^2) = {np.degrees(Kus):.3f} deg/(m/s^2)")
print(f"characteristic speed = {vch:.1f} m/s = {vch*3.6:.0f} km/h")
for v in (10.0, 20.0, 30.0):
A, B = matrices(v)
x_ss = -np.linalg.solve(A, B) # steady state for delta = 1 rad
lam = np.linalg.eigvals(A)
wn = np.sqrt(np.prod(lam).real); zeta = -lam.real.sum() / (2 * wn)
print(f"v = {v:4.1f} m/s: r/delta = {x_ss[1]:.3f} 1/s (formula {v/(L + Kus*v**2):.3f}), "
f"poles {np.round(lam, 2)}, wn = {wn:.2f} rad/s, zeta = {zeta:.2f}")
# response to a 2 degree steering step at 20 m/s (Euler, 1 ms step)
v, dt = 20.0, 0.001
A, B = matrices(v)
x = np.zeros(2); d = np.radians(2.0)
t_hist, r_hist, ay_hist = [], [], []
for k in range(3000):
dx = A @ x + B * d
ay = dx[0] + v * x[1] # lateral acceleration
x = x + dt * dx
t_hist.append(k * dt); r_hist.append(x[1]); ay_hist.append(ay)
r = np.array(r_hist)
print(f"2 deg step at 20 m/s: final r {np.degrees(r[-1]):.2f} deg/s, "
f"final ay {ay_hist[-1]:.2f} m/s^2, peak r {np.degrees(r.max()):.2f} deg/s")Running it prints
mrad/(m/s²), characteristic speed 27.8 m/s (100 km/h), the gains 3.405, 5.068 and 5.330 s
equal to the formula, the poles and damping ratios quoted above, and for the step
°/s,
m/s² with a peak of 10.44°/s.
Pure pursuit on a 3.5 m lane change at 10 m/s:
import numpy as np
L, v, dt = 2.6, 10.0, 0.01 # wheelbase [m], speed [m/s], integration step [s]
Ld = 8.0 # look-ahead distance [m]
delta_max = np.radians(30)
# reference path: smooth 3.5 m lane change (sinusoid)
xs = np.linspace(0, 200, 4001)
ys = np.where(xs < 50, 0.0, np.where(xs > 90, 3.5, 1.75 * (1 - np.cos(np.pi * (xs - 50) / 40))))
x, y, psi = 0.0, 0.0, 0.0 # rear-axle position and heading
err = []
for k in range(int(15 / dt)):
# path point at distance Ld ahead of the vehicle
d = np.hypot(xs - x, ys - y)
ahead = np.where((d >= Ld) & (xs > x))[0]
gx, gy = xs[ahead[0]], ys[ahead[0]]
alpha = np.arctan2(gy - y, gx - x) - psi # angle towards point G
delta = np.arctan(2 * L * np.sin(alpha) / Ld) # pure pursuit law
delta = np.clip(delta, -delta_max, delta_max)
# kinematic bicycle model (referred to the rear axle)
x += v * np.cos(psi) * dt
y += v * np.sin(psi) * dt
psi += v / L * np.tan(delta) * dt
err.append(y - np.interp(x, xs, ys))
err = np.array(err)
print(f"max lateral error {abs(err).max():.2f} m, final {abs(err[-1]):.3f} m")The maximum lateral error is 7 cm and at the end it vanishes. For more complete models industry uses commercial simulators (IPG CarMaker, VI-grade, CarSim, MATLAB’s Vehicle Dynamics Blockset); in the open world there are CARLA (autonomous driving, with a Python API) and the Modelica vehicle models, usable with OpenModelica.
The exercises on understeer, tyres, load transfer, braking and ADAS functions are on the exercise page linked at the top.
Exercises
Exercises on vehicle dynamics and ADAS functions, of the kind found in Automatic Systems Design courses and in job interviews in automotive, in three levels: basic, with the formulas of the bicycle model, load transfer and resistances; intermediate, with stability, the tyre model and pure pursuit; exam, with ACC, emergency braking, ESC and combined grip. Unless stated otherwise the vehicle is the one of the in-depth study:
kg,
kg·m²,
m,
m,
m,
kN/rad,
kN/rad,
m,
m/s². The result is given immediately; the full solution, with the graph, opens with a click.
Basic level
Exercise 1. Steering for a bend
The vehicle drives a bend of radius
m at 20 m/s (72 km/h). Compute the road-wheel and steering-wheel angle (steering ratio 15) and compare it with the one at very low speed.
Exercise 2. Characteristic speed and yaw-rate gain
Compute the characteristic speed of the vehicle, the steady-state yaw-rate gain at 20 m/s and its maximum value.
Exercise 3. Load transfer when braking
Compute the axle loads at rest and when braking at 0.8 g.
Exercise 4. Stopping distance
Compute the stopping distance from 100 km/h with
(dry) and
(wet), with a reaction time of 1 s.
Exercise 5. Resistances and power on the motorway
With
m²,
and
kg/m³, compute the resistances and the power needed at 130 km/h on the flat and compare it with that at 100 km/h.
Intermediate level
Exercise 6. The oversteering vehicle
A vehicle has its centre of gravity moved rearwards:
m,
m,
kN/rad (same
,
). Compute
, the critical speed and the poles at 25 m/s and at 40 m/s.
Exercise 7. Pacejka coefficients
A tyre with
N,
has cornering stiffness
kN/rad and shape factor
. With
, find
, the lateral force at 2°, 5° and 10°, and the peak angle.
Exercise 8. Pure pursuit
An autonomous vehicle (
m) uses pure pursuit with look-ahead distance
m and sees the target point at
°. Compute curvature, radius and steering angle; then say how steering changes if
becomes 16 m with the same
.
✎Exam exercises
9. Vehicle dynamics and ADAS functions
Exam level
Exercise 9. ACC and emergency braking
A vehicle at 30 m/s has ACC with
m and
s. (a) What distance does it keep? (b) Around a bend a vehicle at 15 m/s appears, 40 m ahead: compute the time to collision and the constant deceleration that avoids the crash. (c) If AEB intervenes only at
s, what deceleration is needed?
Exercise 10. The ESC reference
At 30 m/s on asphalt with
, the driver steers 3° and then 4° at the wheels. Compute the ESC yaw-rate reference in both cases. If with 4° the gyroscope measures
rad/s, what does ESC do?
Exercise 11. Braking in a bend
On a 100 m bend with
, compute the maximum speed without braking and the one if the driver brakes at 0.5 g (friction circle model).
✓Solutions
9. Vehicle dynamics and ADAS functions · Exercise 1. Steering for a bend
Result:
° at the wheels, 33.9° at the steering wheel; at low speed 1.49° would suffice (22.3° at the steering wheel).
1. Lateral acceleration:
m/s² (0.41 g).
2. Understeer gradient:
rad/(m/s²).
3. Steering:
rad
°. At the steering wheel
°.
4. The geometric (Ackermann) part is
rad
°: understeer asks for 52 % more. The driver does not notice because it is a gradual increase with speed, and this is exactly what makes the vehicle predictable.

9. Vehicle dynamics and ADAS functions · Exercise 2. Characteristic speed and yaw-rate gain
Result:
m/s (100 km/h);
s
at 20 m/s; maximum 5.35 s
.
1.
m/s.
2.
s
: 1° of steering gives 5.07°/s of yaw rate.
3. The maximum of
:
for
, where
s
. At the characteristic speed the vehicle is “most responsive” to steering; beyond it, understeer prevails and the response decreases.

9. Vehicle dynamics and ADAS functions · Exercise 3. Load transfer when braking
Result: at rest 8.49 kN front and 6.23 kN rear; braking 10.98 kN and 3.74 kN (transfer 2.49 kN).
1. At rest, moment balance:
N,
N.
2. Transfer:
N.
3. When braking
N (75 % of the weight),
N. With the same
, the rear axle can brake with only
N: if it received the same pressure as the front it would lock first. Hence variable brake distribution (EBD).

9. Vehicle dynamics and ADAS functions · Exercise 4. Stopping distance
Result: dry 43.7 m of braking, 71.5 m in total; wet 78.7 m of braking, 106.4 m in total.
1.
m/s. Maximum deceleration
: 8.83 m/s² on dry, 4.91 m/s² on wet.
2. Braking distance
:
m and
m.
3. During the reaction time 27.8 m are covered: totals 71.5 m and 106.4 m. Braking distance grows with the square of speed: at 130 km/h on dry it becomes 73.8 m. This is why AEB reduces accidents so much: it removes the reaction time.

9. Vehicle dynamics and ADAS functions · Exercise 5. Resistances and power on the motorway
Result:
N,
N,
kW at 130 km/h; 13.4 kW at 100 km/h.
1.
m/s. Aerodynamic:
N. Rolling:
N.
2.
kW at the wheels.
3. At 100 km/h:
N,
kW. Going 30 % faster needs 87 % more power: over long distances the consumption per kilometre rises by about 40 %. With an electric car this is the effect that reduces motorway range.

9. Vehicle dynamics and ADAS functions · Exercise 6. The oversteering vehicle
Result:
rad/(m/s²);
m/s (121 km/h); at 25 m/s poles
and
, at 40 m/s
and
.
1.
: oversteering.
2.
m/s.
3. At 25 m/s the matrix
has determinant
and negative trace: real poles
and
, stable but with a slow pole. At 40 m/s the determinant is
: poles
and
. The positive pole makes the yaw rate grow as
: it doubles every 1.1 s without the driver steering. It is the spin.
4. This is why no production car oversteers in the linear range. Rear-engined cars, with a lot of weight at the back, compensate with wider rear tyres (
).

9. Vehicle dynamics and ADAS functions · Exercise 7. Pacejka coefficients
Result:
rad
; 1.63, 3.15 and 3.90 kN (the linear model would give 1.75, 4.36 and 8.73 kN); peak of 4 kN at 15.7°.
1.
N; the slope at the origin is
, so
rad
.
2. At 2° (
rad):
,
,
N, against 1745 N of the linear model (−6 %).
3. At 5°:
N (linear 4363 N, −28 %); at 10°:
N (linear 8727 N). The linear model is acceptable up to about 2-3°, i.e. up to about 0.4 g of lateral acceleration: the range in which ACC and LKA work, not ESC.
4. The peak is where
:
,
,
rad
°. Real tyres peak at 6-10°: it is the coefficient
, negative or close to 1 in measured data, that moves and sharpens the peak.

9. Vehicle dynamics and ADAS functions · Exercise 8. Pure pursuit
Result:
m
,
m,
°; with 16 m the steering roughly halves (2.59°).
1.
m
,
m.
2.
°.
3. With
m:
,
°. A longer look-ahead is like a lower gain: softer corrections, more stable at high speed, but bends get “cut”. This is why
is increased with speed.

9. Vehicle dynamics and ADAS functions · Exercise 9. ACC and emergency braking
Result: (a) 59 m; (b)
s, 2.81 m/s²; (c) 5.0 m/s².
(a)
m.
(b) Relative speed 15 m/s:
s. To avoid the crash it is enough to cancel the relative speed before the distance vanishes: with constant deceleration
the relative distance is
, so
m/s². It is moderate braking: ACC itself (usually limited to 3-4 m/s²) can handle it.
(c) At
s the distance is
m:
m/s², still below
on dry but not on wet with worn tyres. This is why AEB warns earlier (at about 2.5 s) and brakes hard shortly after, and accounts for the 0.2-0.3 s delay with which brake pressure builds up.

9. Vehicle dynamics and ADAS functions · Exercise 10. The ESC reference
Result: gain 5.33 s
; 3°:
rad/s; 4°: the linear model would give 0.372, saturated at 0.294 rad/s. With 0.35 rad/s the vehicle oversteers: ESC brakes the outer front wheel.
1. Gain at 30 m/s:
s
. Grip limit:
rad/s.
2. 3° = 0.0524 rad:
rad/s, below the limit:
.
3. 4° = 0.0698 rad:
rad/s, which would require
m/s², more than
. The reference is saturated at 0.294 rad/s: ESC does not ask the vehicle for what the road cannot give.
4. Measured 0.35 rad/s > 0.294: the vehicle rotates more than the possible path allows, i.e. the rear is sliding (oversteer). The error is 0.056 rad/s; braking the outer front wheel creates an opposing yaw moment. Engine torque is often reduced as well.

9. Vehicle dynamics and ADAS functions · Exercise 11. Braking in a bend
Result: 29.7 m/s (107 km/h) without braking; 27.1 m/s (97.5 km/h) braking at 0.5 g.
1. Without braking all the grip goes into cornering:
,
m/s.
2. When braking, the friction circle imposes
:
m/s².
3.
m/s. Firm braking takes away 10 km/h of allowable cornering speed. ABS and ESC work together exactly here: ABS prevents locked wheels from losing all lateral force, ESC corrects yaw.

∑Formula sheet
Architecture and availability
Availability
![]()
Sensors and field connections
The 4-20 mA current loop
![]()
Sequential control
From chart to code
![]()
PLC programming
Tasks and priorities
![Rendered by QuickLaTeX.com \[ U = \sum_i \frac{C_i}{T_i} = \frac{0{,}4}{2} + \frac{3}{10} + \frac{10}{100} = 0{,}2 + 0{,}3 + 0{,}1 = 0{,}6 \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-53efd156ba2e1897b98e1054c04f9b43_l3.png)
Functional safety
One channel: 1oo1 architecture
![]()
![]()
Two redundant channels: 1oo2 architecture
![]()
Drives and motion control
The motion profile
![]()
The gear ratio
![]()
![]()
Thermal sizing
![Rendered by QuickLaTeX.com \[ C_{rms} = \sqrt{\frac{\sum_iC_i^2t_i}{\sum_it_i}} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-d0bea1a13d6735bd22c116ddd07648e7_l3.png)
Commissioning and maintenance
Overall effectiveness
![]()
Vehicle dynamics and ADAS functions
The bicycle model
![]()
![]()
Understeer and oversteer
![]()
Longitudinal dynamics
![Rendered by QuickLaTeX.com \[ m\,\dot v = F_x - \underbrace{f\,m\,g}_{\text{rolling}} - \underbrace{\tfrac{1}{2}\rho\,C_d\,A\,v^2}_{\text{aerodynamic}} - \underbrace{m\,g\sin\theta}_{\text{gradient}} \]](https://www.electronics-engineering.com/wp-content/ql-cache/quicklatex.com-6960407c496dcf484955ea45c36ae383_l3.png)