SlideShare a Scribd company logo
Module 2 -Session 4
Components of CPS Physical Space Sensors &
Actuators Embedded Processors, Input and Output
Interface
Components of Cyber-Physical System
Components of CPS
• A cyber-physical system consists of a set of computing devices that
communicate with each other and interact with the physical world
through sensors and actuators in feedback loops.
• It integrates physical and computer components to monitor and
control physical processes seamlessly.
• CPS includes self-driving cars, and the STARMAC is a small quadrotor
aircraft.
Overall Architecture of CPS
Physical Space Sensors
• A sensor is a device that detects and responds to some type of input
from the physical environment.
• The input can be light, heat, motion, moisture, pressure or any
number of other environmental phenomena.
• The output is generally a signal that is converted to a human-readable
display at the sensor location or transmitted electronically over a
network for reading or further processing.
Sensors
• Sensors play a pivotal role in the Internet of things (IoT).
• They make it possible to create an ecosystem for collecting and
processing data about a specific environment so it can be monitored,
managed and controlled more easily and efficiently.
• IoT sensors are used in homes, out in the field, in automobiles, on
airplanes, in industrial settings and in other environments.
• Sensors bridge the gap between the physical world and logical world,
acting as the eyes and ears for a computing infrastructure that
analyzes and acts upon the data collected from the sensors.
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Types of Sensors
• Sensors can be categorized in multiple ways. One common approach
is to classify them as either active or passive.
• An active sensor is one that requires an external power source to be
able to respond to environmental input and generate output.
• For example, sensors used in weather satellites often require some
source of energy to provide meteorological data about the Earth's
atmosphere.
Types of Sensors
• A passive sensor, on the other hand, doesn't require an external
power source to detect environmental input. It relies on the
environment itself for its power, using sources such as light or
thermal energy.
• A good example is the mercury-based glass thermometer.
• The mercury expands and contracts in response to fluctuating
temperatures, causing the level to be higher or lower in the glass
tube. External markings provide a human-readable gauge for viewing
the temperature.
• Some types of sensors, such as seismic and infrared light sensors, are
available in both active and passive forms.
Analog Sensors
• The environment in which the sensor is deployed typically determines
which type is best suited for the application.
• Analog sensors convert the environmental input into output analog
signals, which are continuous and varying.
• Thermocouples that are used in gas hot water heaters offer a good
example of analog sensors. The water heater's pilot light continuously
heats the thermocouple.
Digital Sensors
• In contrast to analog sensors, digital sensors convert the
environmental input into discrete digital signals that are transmitted
in a binary format (1s and 0s).
• Digital sensors have become quite common across all industries,
replacing analog sensors in many situations.
• For example, digital sensors are now used to measure humidity,
temperature, atmospheric pressure, air quality and many other types
of environmental phenomena.
Examples of types of sensors
• Accelerometer.
• Chemical
• Humidity
• Level
• Motion
• Optical
• Pressure
• Proximity
• Temperature
• Touch
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Actuators
• An actuator is a device that produces a motion by converting energy
and signals going into the system.
• The motion it produces can be either rotary or linear. An actuator is a
device that produces a motion by converting energy and signals going
into the system.
• The motion it produces can be either rotary or linear.
• Essentially mechanical or electro-mechanical devices that allow
controlled movements or positioning, actuators are a key
component in several devices today
Actuators
• Actuators use energy from a source upon the receipt of a signal to
bring about a mechanical motion used in lifting load, pulleys, etc
hydraulic used in fluid motions, fluid leakages, opening valves, piston.
Actuators
• Actuators basically need a control signal and a source of energy. Upon
receiving a control signal, the actuator uses energy from the source to
bring about a mechanical motion.
• The control system can be a human, a fixed mechanical or electronic
system, or even software-based, say a printer driver, or a robot
control system.
• Examples of actuators include electric motors, stepper motors,
electroactive polymers, screw jacks, servomechanism, solenoids and
hydraulic cylinders.
Actuators
• Pneumatic actuators used in Robo Arms, Electric Rotators are used in
rotating knob or wheels
Embedded Processors
• An embedded system is a computer system integrated into a physical
device or product to perform a dedicated function.
• It is designed to perform specific tasks and functions and is often part
of a larger system.
• Embedded systems are typically built around a microcontroller or
microprocessor and may include other components such as sensors,
actuators, and input/output interfaces
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Embedded Computing System
• An embedded computing system is any device that includes a
processing system but is not a general-purpose computer.
• Embedded system Use application capabilities to optimize the design
have real-time requirements.
Input and Output Interfaces
• It is used as an method which helps in transferring of information
between the internal storage devices i.e. memory and the external
peripheral device.
• A peripheral device is that which provide input and output for the
computer, it is also called Input-Output devices.
• In micro-computer base system, the only purpose of peripheral
devices is just to provide special communication links for the
interfacing them with the CPU
Input & Output Interfaces
Input & Output Interfaces
• It is used to synchronize the operating speed of CPU with respect to
input-output devices.
• It selects the input-output device which is appropriate for the
interpretation of the input-output signal.
• It is capable of providing signals like control and timing signals.
• In this data buffering can be possible through data bus.
• There are various error detectors.
• It converts serial data into parallel data and vice-versa.
• It also convert digital data into analog signal and vice-versa.
Input & Output Interfaces
• The nature of peripheral devices is electromagnetic and electro-
mechanical. The nature of the CPU is electronic. There is a lot of
difference in the mode of operation of both peripheral devices and
CPU.
• There is also a synchronization mechanism because the data transfer
rate of peripheral devices are slow than CPU.
• In peripheral devices, data code and formats are differ from the
format in the CPU and memory.
• The operating mode of peripheral devices are different and each may
be controlled so as not to disturb the operation of other peripheral
devices connected to CPU.
Syllabus
Open and Closed loop control system,
Identification of key elements of mechatronics systems and
represent into block diagram (Electro-Mechanical Systems),
Concept of transfer function,
Block diagram reduction principles,
Applications of mechatronics systems:- Household,
Automotive, Shop floor, Industrial.
Objectives
1. Understand key elements of Mechatronics system, representation
into block diagram
2. Understand concept of transfer function, reduction and analysis
3. Understand principles of sensors, its characteristics, interfacing
with DAQ microcontroller
4. Understand the concept of PLC system and its ladder programming,
and significance of PLC systems in industrial application
5. Understand the system modeling and analysis in time domain and
frequency domain.
6. Understand control actions such as Proportional, derivative and
integral and study its significance in industrial applications.
Outcomes
1. Identification of key elements of mechatronics system and its
representation in terms of block diagram
2. Understanding the concept of signal processing and use of interfacing
systems such as ADC, DAC, digital I/O
3. Interfacing of Sensors, Actuators using appropriate DAQ micro-
controller
4. Time and Frequency domain analysis of system model (for control
application)
5. PID control implementation on real time systems
6. Development of PLC ladder programming and implementation of
real life system
What is a Control ??
Control means to make
an out put ON or OFF by
help of Controlling
Devices like simple toggle
switch to a complex
system with components
such as relays, timers,
and switches.
Types of control
1) On-Off control,
2) Sequential control,
3) Feedback control, and
4) Motion control.
Example of an uncontrolled circuit.
Example of manual control
Manual Control circuits use components that require
human interaction in order to operate.
AC
source
Toggle switch
Control circuits may require manual control, Automatic
control or Combination of both.
A controlled circuit
Example of manual control
AC
source
Toggle switch
Example of Automatic control
✓Automatic control circuits can operate themselves without
the need for human interaction.
✓Float Switch has been operated by a floating arrangement
Automatically.
AC
source
Float switch
Example of Automatic control
✓Automatic control circuits can operate themselves without
the need for human interaction.
✓Float Switch has been operated by a floating arrangement
Automatically.
AC
source
Float switch
Example of Automatic control
✓Automatic control circuits can operate themselves without
the need for human interaction.
✓Float Switch has been operated by a floating arrangement
Automatically.
AC
source
Float switch
Example of Automatic control
✓Automatic control circuits can operate themselves
without the need for human interaction.
✓Float Switch has been operated by a floating
arrangement Automatically.
AC
source
Float switch
Control
A Control system performs following functions-
1. For particular input the system output can be controlled to a
desired particular value.
2. To minimize the error between actual and desired output
Actual Response
Desired Response
Open Loop Control
 Output is dependent on input but controlling action is
totally independent of the changes in output, is an Open
Loop Control System.
 No feedback is used, so the controller must independently
determine what signal to send to the actuator.
Input
Control
Law
Plant Output
u
Plant = Mathematical model of Input Amplifier + Actuator + Physical
System
Input = Reference / Desired Input or Set Point Input
Output = Measured Output
Examples of Open Loop Control
Advantages and Dis-advantages of Open Loop Control
Advantages:
Simple in construction
Low cost
Convenient to implement when output is difficult to
measure
Disadvantages:
It is inaccurate
Unable to sense the environmental changes or
disturbances
Closed Loop Control
e = Error = Input – Output
u = Control Input
Input
Control
Law
Plant Output
∑
+
_
e u
 Controlling action is dependent on the changes in
output
Examples of Closed Loop Control
Examples of Automatic Closed Loop Control
Advantages:
✓Accurate, since the controller modifies and manipulates the
actuating signal such that the error in the system will be zero.
✓Self-correcting
✓Senses the environmental changes, and disturbances in the
system.
Disadvantages:
✓Complicated to design
✓Costly
✓Instable, since due to feedback , system tries to correct the
error.
Advantages and Dis-advantages of Closed Loop Control
Eg:-Various elements for controlling the Room temperature.
Controlled variable - the room temperature
Reference value - the required room temperature
Comparison element- the person comparing the measured value with required temp.
Error signal - difference between measured and required temperatures
Correction unit - the switch on the fire
Process unit - the heating by the fire
Measuring device- a thermometer
Automobile
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Open Loop System
❑ Example - for Antenna pointing system
Open Loop System
❑ Antenna will rotate clockwise and anticlockwise depending on
the output signal, negative or positive.
❑ Antenna will stationary if the input signal is 0v.
❑When the antenna is approaching the desired angle or position,
the input signal must approach 0v.
❑It can be conclude that the control action is independent of
the output.
Close Loop System
❑ Example for antenna pointing system
Close Loop System
❑From diagram, if θ0= θi then V0 = Vi so the error signal
Ve = Vi – V0
= 0V ( the antenna will be stationary )
❑ If the V0 not equal Vi ,Ve greater or less than 0V, the antenna will rotate
clockwise, anticlockwise depending on a polarity of Ve.
This means that the antenna will continue rotating until V0 = Vi .
❑In this example, the system automatically corrects the output when the
system is disturbed. This system is known as ‘automatic control system’.
Difference between Open loop and Closed loop system
Sr.No. Open loop system Closed loop system
1 Not using feedback Feedback using
2 Less accurate More accurate
3 Simple in construction Complicated in construction
4 Optimisation in control is not
possible
Optimisation in control is possible
5 Easy maintenance & cost is less Difficult to maintain & cost is more
6 System cannot compensate for
disturbance.
system can compensate for
disturbance.
7 Eg. CD deck, Digital thermometer,
toaster, fan.
Eg. Automatic water level, air
conditioning system, robot (arm).
Feedback and its effect
❑ Feedback system is a system that maintains a
relationship between the output and some reference
input by comparing them and using the difference as a
means of control.
❑ Feedback is used to reduce the error between reference
and the system output .
❑ Feedback effect on performance characteristic:
➢ Stability
➢ Overall gain
➢ Sensitivity
➢ External disturbances
Transfer Function Models
❑Transfer function: is a mathematical representation, in terms of
spatial or temporal frequency, of the relation between the input and
output of a linear time invariant system.
❑Why TF?
Because it is easier / better to assess some things using classical
techniques, such as gain and phase margin.
❑How to determine TF?
❑Derive the Governing Differential Equation
✓Take Laplace transform of output
✓Take Laplace transform of input
❑Transfer function = L (output) / L (input)
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Advantages and features of TF-
1. Gives mathematical model of system components
2. LT converts time domain equation into simple
algebraic equation
3. TF obtained for a pair of i/p and o/p
4. Once TF is known o/p response for any type of
reference i/p can be calculated
5. TF helps in analyzing stability of system
Disadvantages of TF-
1. Does not provide any information about physical
structuring of system
2. Applicable to linear time invariant system
Block diagram components
Block Diagram: Feedback
( )
( )
( )
( ) ( )
( )
( )
( )
( ) ( )
s
H
s
G
s
G
s
R
s
Y
s
H
s
G
s
G
s
R
s
Y
−
=
=
+
=
=
1
TF
loop
Closed
1
TF
loop
Closed
Block Diagram Simplifications
1.Cascade (Series) Connection
2. Parallel Connection
3. Eliminating a feedback loop
4. Moving a pickoff/takeoff point behind a block/
right
5. Moving a pickoff point ahead of a block/left
6. Moving a summing point ahead of a block
7. Moving a summing point behind of a block
G G
G
8.Replacing summing points
9. Combining summing points
Applications of Mechatronic System
1. Household
i. Refrigerator
ii. Washing m/c
iii. Microwave
2. Automotive
i. Fuel injection system
ii. Power steering
iii. Air conditioner
3. Shop floor
i. Tool monitoring system
ii. Automated guided vehicle
iii. Conveyor system
iv. Bottle filing plant.
Sequential Control
1. Event based
2. Time based
Event based- Washing m/c
Washing m/c
PWD - Pulse width modulation- Control speed of motor in diff phases
Time based -Water heating system
✓ Control function is Inexact
✓ No fail safe features
Fuel Injection
Electric Power Steering
Automatic Camera
MODULE II
Concurrent Control Loops and Synchronization of Nodes in
Cyber Physical System
1
1. DISTRIBUTED SYSTEM TYPES
Fully
Distributed
Processors
Control
Fully replicated
Not fully replicated
master directory
Local data,
local directory
Master-slave
Autonomous
transaction based
Autonomous
fully cooperative
Homog.
special
purpose
Heterog.
special
purpose
Homog.
general
purpose
Heterog.
general
purpose
2
WHAT IS A DISTRIBUTED SYSTEM?
Definition: A distributed system is one in which components
located at networked computers communicate and
coordinate their actions only by passing messages. This
definition leads to the following characteristics of distributed
systems:
 Concurrency of components
 Lack of a global ‘clock’
 Independent failures of components
3
CENTRALIZED SYSTEM CHARACTERISTICS
 One component with non-autonomous parts
 Component shared by users all the time
 All resources accessible
 Software runs in a single process
 Single point of control
 Single point of failure
4
DISTRIBUTED SYSTEM CHARACTERISTICS
 Multiple autonomous components
 Components are not shared by all users
 Resources may not be accessible
 Software runs in concurrent processes on different
processors
 Multiple points of control
 Multiple points of failure
5
EXAMPLES OF DISTRIBUTED SYSTEMS
 Local Area Network and Intranet
 Database Management System
 Automatic Teller Machine Network
 Internet/World-Wide Web
 Mobile and Ubiquitous Computing
6
LOCAL AREA NETWORK
the rest of
email server
Web server
Desktop
computers
File server
router/firewall
print and other servers
other servers
print
Local area
network
email server
the Internet
7
DATABASE MANAGEMENT SYSTEM
8
AUTOMATIC TELLER MACHINE NETWORK
9
INTERNET
intranet
ISP
desktop computer:
backbone
satellite link
server:
%
network link:
%
%
%
10
WEB SERVERS AND WEB BROWSERS
Internet
Browsers
Web servers
www.google.com
www.uu.se
www.w3c.org
Protocols
Activity.html
http://www.w3c.org/Protocols/Activity.html
http://www.google.comlsearch?q=lyu
http://www.uu.se/
File system of
www.w3c.org
11
MOBILE AND UBIQUITOUS COMPUTING
Laptop
Mobile
Printer
Camera
Internet
Host intranet Home intranet
GSM/GPRS
Wireless LAN
phone
gateway
Host site
12
COMMON CHARACTERISTICS
 What are we trying to achieve when we construct a distributed
system?
 Certain common characteristics can be used to assess
distributed systems
 Heterogeneity
 Openness
 Security
 Scalability
 Failure Handling
 Concurrency
 Transparency
13
HOW CONTROLLER WORKS IN CPS
14
NEED OF CONCURRENCY IN THE SYSTEM
 Implementation of CPS based on multitasking
architecture
15
CONCURRENCY IN CONTROL SYSTEM FOR CPS
16
OPENNESS
 Cyber-physical systems (CPS) introduce a new
quality of interweaving the virtual and the real world
within emerging smart spaces.
 Besides software components, CPS consist of a
multitude of sensors and actuators that create
intelligent environments of connected smart objects.
 With software applications influencing the virtual
world and various kinds of actuators affecting the real
world–and vice.
17
ESTABLISHING A PROPER WORKFLOW FOR
SYNCHRONIZATION
 A synchronization between the process instances and
models of the virtual and the real world has to be
established to provide a consistent view of CPS
workflow execution.
 In addition, CPS require scalable and distributed
process infrastructures to cope with the trend towards
decentralization.
 The goal is the introduction of workflows to CPS to
enable the modelling and execution of consistent and
distributed processes with the help of sensors,
actuators, things and software.
18
CONCURRENCY
 Components in distributed systems are executed in
concurrent processes.
 Components access and update shared resources (e.g.
variables, databases, device drivers).
 Integrity of the system may be violated if concurrent
updates are not coordinated.
 Lost updates
 Inconsistent analysis
19
CPS – CONCURRENCY AND SYNCHRONIZATION
 Concurrency and synchronization are crucial concepts
in the context of Cyber-Physical Systems (CPS).
 CPS integrates computational algorithms and
physical processes to create systems that interact
with the physical world.
 Ensuring proper concurrency and synchronization is
essential to manage the complexity and real-time
nature of CPS applications.
20
CONCURRENCY IN CPS:
 Parallel Processing:
 CPS often involves multiple sensors, actuators, and
components working simultaneously. Parallel processing
allows these components to operate concurrently,
improving overall system efficiency. Parallelism helps in
handling diverse tasks such as data acquisition, control
computations, and communication concurrently.
 Real-Time Constraints:
 Many CPS applications have real-time requirements,
where tasks must be executed within specific time bounds.
Concurrency is employed to meet these constraints,
ensuring timely responses to events.
 Distributed Systems:
 CPS may consist of distributed components across
networks. Concurrency is essential for managing
communication and coordination among these distributed
elements.
21
CONCURRENCY IN CPS
 Sensor Fusion:
 Concurrency is crucial in sensor fusion applications where
data from multiple sensors need to be processed
concurrently to obtain a unified and accurate
representation of the system's state.
22
TRANSPARENCY
 Distributed systems should be perceived by users and
application programmers as a whole rather than as a
collection of cooperating components.
 Transparency has different aspects.
 These represent various properties that distributed
systems should have.
23
 Deterministic Execution:
 Achieving deterministic execution is challenging in CPS,
as variations in execution times can impact system
behavior. Synchronization mechanisms help in
maintaining determinism.
 Fault Tolerance:
 CPS often operates in dynamic and uncertain
environments. Synchronization strategies need to account
for faults and unexpected events, ensuring the system can
gracefully handle such situations.
 Scalability:
 As CPS scale in size and complexity, managing
concurrency and synchronization becomes more
challenging. Scalable synchronization mechanisms are
essential to handle large-scale CPS deployments. 25
SYNCHRONIZATION IN DISTRIBUTED
SYSTEMS
 Synchronization in CPS:
 Data Consistency:
 In CPS, different components often share data.
Synchronization mechanisms like locks, semaphores,
or atomic operations are used to ensure data
consistency and prevent race conditions.
 Event Synchronization:
 Events in CPS need to be synchronized to maintain a
consistent and accurate representation of the physical
world. Timestamping and synchronization protocols
are used to order and coordinate events.
32
 In a centralized system: all processes reside on the
same system utilize the same clock.
 In a distributed system: like synchronize everyone’s
watch in the classroom.
GLOBAL TIME
 Global Time is utilized to provide timestamps for
processes and data.
  Physical clock: concerned with “People” time
  Logical clock: concerned with relative time
and maintain logical consistency
 Synchronization in CPS:
 Data Consistency:
 In CPS, different components often share data.
Synchronization mechanisms like locks, semaphores, or
atomic operations are used to ensure data consistency and
prevent race conditions.
 Event Synchronization:
 Events in CPS need to be synchronized to maintain a
consistent and accurate representation of the physical
world. Timestamping and synchronization protocols are
used to order and coordinate events.
 Communication Synchronization:
 In a distributed CPS, communication between components
needs to be synchronized to ensure messages are received
and processed in the correct order. Protocols like time-
triggered communication or synchronized clocks may be
employed. 35
SYNCHRONIZATION
 Resource Access:
 Shared resources, such as communication channels or
processing units, require synchronization to avoid
conflicts. This ensures that multiple components do not
attempt to access a resource simultaneously.
36
SYNCHRONIZATION OF DISTRIBUTED
CONTROLLERS IN CYBER-PHYSICAL SYSTEMS
37
SYNC SLOUTION FOR DISTRIBUTED CPS
38
SYNCHRONIZATION PROTOCOL
 A synchronization protocol can be setup on top of
hardware offering fine-grained tuning of the oscillator
circuitry to provide clock-source frequency
synchronization
 Challenges for Cyber-Synchronization: Essentially,
clock-source synchronization provides synchronous-
rate execution of all functionalities on the distributed
platforms. Consequently, synchronization is
inherently propagated to IPO invocations and thus,
cyber-synchronization is guaranteed (down to the
maximum synchronization error).
39
SYNCHRONIZED CLOCKS
 In the case of synchronized clock sources, the
actuation pulse train frequencies across controllers
are also synchronized; therefore, providing
synchronized clock sources ensures desired temporal
properties of actuation signals. However, recall inter-
timer phase synchronization e
40
TIMER CONTROL
41
CHALLENGES:
 Deterministic Execution:
 Achieving deterministic execution is challenging in
CPS, as variations in execution times can impact
system behavior. Synchronization mechanisms help
in maintaining determinism
 Fault Tolerance:
 CPS often operates in dynamic and uncertain
environments. Synchronization strategies need to
account for faults and unexpected events, ensuring
the system can gracefully handle such situations.
42
CPS DEPLOYMENTS CHALLENGES
 As CPS scales in size and complexity, managing
concurrency and synchronization becomes more
challenging. Scalable synchronization mechanisms
are essential to handle large-scale CPS deployments.
 In summary, proper concurrency and synchronization
are vital for the reliable and efficient operation of
Cyber-Physical Systems, especially considering their
real-time and distributed nature.
 Applying appropriate synchronization mechanisms
helps manage shared resources, maintain data
consistency, and ensure timely and coordinated
responses in CPS applications. 43
CONCURRENCY IN REST API
 Concurrency is a common challenge in web
development, especially when designing and
implementing RESTful APIs.
 Concurrency occurs when multiple clients or
processes access or modify the same resource at the
same time, potentially causing conflicts, errors, or
inconsistencies.
44
OPTIMISTIC CONCURRENCY LOCKING
45
OPTIMISTIC CONCURRENCY LOCKING
 With optimistic locking, records are freely given out
to whoever wants them.
 Every record has a version field that can be
represented with a unique number, timestamp, or
some sort of a hash.
 Upon a successful save of the record, the version is
incremented or updated.
46
CONCURRENCY LOCKING
 Two users are editing the same record. Initially, they
have the same state of the record.
 One of the users clicks the Save button earlier. It will
persist the user’s changes to the database.
 Later, the second user clicks the Save button. It will
persist the user’s changes to the database, silently
overwriting the data persisted by the previous user.
47
SOLUTION
 Solution for Locking
48
SOLUTION FOR LOCKING
 When two users are retrieving the same record, they
have initially the same value of its version attribute

After a user’s change, when a database transaction
tries to commit the record, it will increase its version
with 1. Now we know that the second user is updating
the same record.
 Before the second user’s save operation, we need to
check if the version we originally got matches what’s
currently in the database.
49
SOLUTION FOR LOCKING
 If they don’t match, we know that during the time
we’ve had the record, someone else(the first user in
this case) has already requested and saved that same
record before we could save, and therefore we must
take action to ensure that our update will be
consistent.
 The first concurrent transaction will succeed, while
the second will throw an optimistic locking exception
therefore

50
CONCURRENCY SUCCESS EXAMPLE
51
SOLUTION
 In an optimistic locking scheme, an update request is
only successful if the resource has not been
modified since the client last checked. HTTP provides
some built-in mechanisms for implementing an
optimistic locking strategy using the If-
Match conditional header and ETags (ETags can also
be used with GET and HEAD requests to improve
caching efficiency.)
52
HTIL-Control System
Human in Loop Control System
HIL
• Human-in-the-loop systems allow humans to change the output of
the learning systems.
• Human-in-the-loop simulators always have human input as part of
the simulation, and humans influence the outcomes of the simulation
exercise such that the outcomes may not be exactly reproducible.
• The human-in-the-loop particularly refers to a situa- tion where a
system or a machine is controlled, fully.
HIL
• Human-in-the-Loop aims to achieve what neither a human being nor a
machine can achieve on their own.
• When a machine isn't able to solve a problem, humans need to step in and
intervene.
• This process results in the creation of a continuous feedback loop.
• Human-in-the-loop allows the user to change the outcome of an event or
process.
• The immersion effectively contributes to a positive transfer of acquired
skills into the real world.
• This can be demonstrated by trainees utilizing flight simulators in
preparation to become pilots.
Human in the Loop Control System
HITL
• The importance of humans in the AI loop is regulatory, ethical, and
reputational.
• Having people within the AI system will help safeguard against
inaccurate data that may lead to poor decisions and other adverse
outcomes.5 Jul 2022
• Human-in-the-loop or HITL is used in multiple contexts. It can be
defined as a model requiring human interaction. HITL is associated
with modeling and simulation (M&S) in the live, virtual, and
constructive taxonomy
HITL
• In machine learning, HITL is used in the sense of humans aiding the
computer in making the correct decisions in building a model
• HITL also allows for the acquisition of knowledge regarding how a new
process may affect a particular event.
• Utilizing HITL allows participants to interact with realistic models and
attempt to perform as they would in an actual scenario.
• HITL simulations bring to the surface issues that would not otherwise be
apparent until after a new process has been deployed.
• A real-world example of HITL simulation as an evaluation tool is its usage
by the Federal Aviation Administration (FAA) to allow air traffic controllers
to test new automation procedures by directing the activities of simulated
air traffic while monitoring the effect of the newly implemented
procedures.
HITL
• Tabletop simulation may be useful in the very early stages of project
development for the purpose of collecting data to set broad
parameters, but the important decisions require human-in-the-loop
simulation
• Intelligent systems can only go so far in certain circumstances to
automate a process; only humans in the simulation can accurately
judge the final design.
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
• The aim of human in the loop is optimizing models and algorithms
through human intervention and contribution, to create better and
more accurate AI.
• As we mentioned, human-in-the-loop can be applied at various stages
of the AI lifecycle:
Phases in HITL
• Training and testing: Humans in the loop can be involved during
model training, validation and testing in order to accelerate the
learning process. Humans can first demonstrate how tasks should be
performed and afterwards provide feedback on model performance.
This can be done by correcting the model’s outputs or evaluating
them, which creates a reward function that can be used for
reinforcement learning.
• Learning from a combination of human demonstrations and
evaluations has been demonstrated to be faster and more sample-
efficient when compared to traditional supervised learning
algorithms.
• Deployment: Human in the Loop workflows are especially important when
the availability of training data is very limited or the data is imbalanced or
uncomprehensive – so we are unsure whether the model is prepared to
handle all potential edge cases.
• In addition, even if the model usually achieves high accuracy, human
monitoring and double-checking might be needed if model mistakes might
end up being very costly: for example, in cases such as content moderation
of user-generated content where false negatives may result in irreparable
damage.
• In both cases, the model can be connected to a labeling interface where
outputs below a given threshold of certainty are routed so that they are
checked and verified by a human, either in real-time or in batches for
future re-training.
HITL
• 3. Hiring: human in the loop
Here at Humans in the Loop, we have taken this technical term and we
have given it an additional meaning: integrating humans into the
workforce and into the digital labor market. As a social enterprise, we
use the plural of “humans in the loop” so that the name does not refer
to a single person but rather a collective working together to power
some of the most exciting applications of AI.
Human in the Loop
• Our workers are not just annotators or labelers, they are professional
humans in the loop who have worked on a variety of AI projects and
have developed an expertise on how AI model training works, what is
considered an edge case, what data might confuse the model, and
what data might cause harmful biases.
• After collecting and/or annotating the training datasets for the model
image by image, these humans in the loop have a deep understanding
of what the data looks like and why the model might be exhibiting
certain errors when deployed in real-life scenarios.
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
Module –II ADC-DAC
ADC-Analogue to Digital Converter
• Analogue to Digital Converter, or ADC, is a data converter which
allows digital circuits to interface with the real world by encoding an
analogue signal into a binary code.
• The Analogue-to-Digital Converter, (ADCs) allow micro-processor
controlled circuits, Arduinos, Raspberry Pi, and other such digital logic
circuits to communicate with the real world.
• In the real world, analogue signals have continuously changing values
which come from various sources and sensors which can measure
sound, light, temperature or movement, and many digital systems
interact with their environment by measuring the analogue signals
from such transducers.
ADC
• While analogue signals can be continuous and provide an infinite number
different voltage values, digital circuits on the other hand work with binary signal
which have only two discrete states, a logic “1” (HIGH) or a logic “0” (LOW).
• So it is necessary to have an electronic circuit which can convert between the two
different domains of continuously changing analogue signals and discrete digital
signals, and this is where Analogue-to-Digital Converters (A/D) come in.
• Basically an analogue to digital converter takes a snapshot of an analogue voltage
at one instant in time and produces a digital output code which represents this
analogue voltage. The number of binary digits, or bits used to represent this
analogue voltage value depends on the resolution of an A/D converter.
• For example a 4-bit ADC will have a resolution of one part in 15, (24 – 1) whereas
an 8-bit ADC will have a resolution of one part in 255, (28 – 1). Thus an analogue
to digital converter takes an unknown continuous analogue signal and converts it
into an “n”- bit binary number of 2n bits.
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
ADC
• Here we can see that as the wiper terminal of the potentiometer is
rotated between between 0 volts and VMAX, it produces a continuous
output signal (or voltage) which has an infinite number of output
values relative to the wiper position.
• As the potentiometers wiper is adjusted from one position to the
next, there is no sudden or step change between the two voltage
levels thereby producing a continuously variable output voltage.
Examples of analogue signals include temperature, pressure, liquid
levels and light intensity.
ADC
• For a digital circuit the potentiometer wiper has been replaced by a single rotary switch
which is connected in turn to each junction of the series resistor chain, forming a basic
potential divider network. As the switch is rotated from one position (or node) to the
next the output voltage, VOUT changes quickly in discrete and distinctive voltage steps
representing multiples of 1.0 volts on each switching action or step as shown.
• So for example, the output voltage will be 2 volts, 3 volts, 5 volts, etc. but NOT 2.5V, 3.1V
or 4.6V. Finer output voltage levels could easily be produced by using a multi-positional
switch and increasing the number of resistive elements within the potential divider
network, therefore increasing the number of discrete switching steps.
• Then we can see that the major differences between an analogue signal and a digital
signal is that an “Analogue” quantity is continuously changing over time while a “Digital”
quantity has discrete (step by step) values. “LOW” to “HIGH” or “HIGH” to “LOW”.
• So how can we convert a continously changing signal with an infinite number of values to
one which has distinct values or steps for use by a digital circuit.
Analogue-to-Digital Converter
• The process of taking an analogue voltage signal and converting it into an equivalent
digital signal can be done in many different ways, and while there are many analogue-to-
digital converter chips such as the ADC08xx series available from various manufacturers,
it is possible to build a simple ADC using discrete components.
• One simple and easy way is by using parallel encoding, also known
as flash, simultaneous, or multiple comparator converters in which comparators are used
to detect different voltage levels and output their switching state to an encoder.
• Parallel of “Flash” A/D converters use a series of interconnected but equally spaced
comparators and voltage references generated by a series network of precision resistors
for generating an equivalent output code for a particular n-bit resolution.
• The advantage of parallel or flash converters is that they are simple to construct and do
not require any timing clocks as the instant an analogue voltage is applied to the
comparator inputs, it is compared against a reference voltage. Consider the comparator
circuit below.
ADC - Comparator
• An analogue comparator such as the LM339N which has two
analogue inputs, one positive and one negative, and which can be
used to compare the magnitudes of two different voltage levels.
ADC
• A voltage input, (VIN) signal is applied to one input of the comparator, while a reference voltage, (VREF) to the other. A comparison
of the two voltage levels at the comparator’s input is made to determine the comparators digital logic output state, either a “1” or
a “0”.
• The reference voltage, VREF is compared against the input voltage, VIN applied to the other input. For an LM339 comparator, if the
input voltage is less than the reference voltage, (VIN < VREF) the output is “OFF”, and if it is greater than the reference voltage,
(VIN > VREF) the output will be “ON”. Thus a comparator compares two voltage levels and determines which one of the two is
higher.
• In our simple example above, VREF is obtained from the voltage divider network setup by R1 and R2. If the two resisors are of equal
values, that is R1 = R2, then clearly the reference voltage level will be equal to half the supply voltage, or V/2. So for a comparator
with an open-collector output, if VIN is less than V/2, the output is HIGH, and if VIN is greater than V/2, the output is LOW acting as
a 1-bit ADC.
• But by adding more resistors to the voltage divider network we can effectively “divide” the supply voltage by an amount
determined by the resistances of the resistors. However, the more resistors we use in the voltage divider network the more
comparators will be required.
• In general, 2n– 1 comparators would be required for conversion of an “n”-bit binary output, where “n” is typically in the range from
8 to 16. In our example above, the single bit ADC used 21– 1, which equals “1” comparator to determine if VIN was greater or
smaller than the V/2 reference voltage.
• If we now create a 2-bit ADC, then we will need 22– 1 which is “3” comparators as we need four different voltage levels
corresponding to the 4 digital values required for a 4-to-2 bit encoder circuit as shown.
ADC
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
• Where: “X” is a “don’t care”, that is either a logic “0” or a logic “1” condition.
• So how does this analogue-to-digital converter work. For an A/D converters to be useful it has to produce a
meaningful digital representation of the analogue input signal. Here in this simple 2-bit ADC example we have
assumed for simplicity that the input voltage VIN is between 0 and 4 volts, so have set VREF and the resistive
voltage-divider network to drop 1 volt across each resistor.
• When VIN is between 0 and 1 volt, (<1V) the input on all three comparators will be less than the reference
voltage, so their outputs will be LOW and the encoder will output a binary zero (00) condition on pins Q0 and Q1.
When VIN increases and exceeds 1 volt but is less than 2 volts, (1V<VIN<2V) comparator U1 which has a reference
voltage input set at 1 volt, will detect this voltage difference and produce a HIGH output. The priority encoder
which is used as the 4-to-2 bit encoding detects the change of input at D1 and produces a binary output of “1”
(01).
• Note that a Priority Encoder such as the TTL 74LS148 allocates a priority level to each individual input. The
priority encoders output corresponds to the currently active input which has the highest priority. So when an
input with a higher priority (D1 compared to D0) is present, all other inputs with a lower priority will be ignored.
So if there are two or more inputs at logic level “1” at the same time, the actual output code on D0 and D1 would
only correspond to the input with the highest designated priority.
• So now as VIN increases above 2 volts, the next reference voltage level, comparator U2 detects the change and
produces a HIGH output. But because input D2 has a higher priority than inputs D0 or D1, the priority encoder
outputs a binary “2” (10) code, and so on when VIN exceeds 3 volts producing a binary code output of “3” (11).
Clearly as VIN reduces or changes between each reference voltage level, each comparator will output either a
HIGH or a LOW condition to the encoder which inturn produces a 2-bit binary code between 00 and 11 relative to
VIN.
• This is all well and good, but priority encoders are not available as 4-to-2 bit devices, and if we use a
commercially available one such as the TTL 74LS148 or its CMOS 4532 equivalent which are both 8-bit devices,
then six of the binary bits would not be used. But a simple encoder circuit can be made using digital Ex-OR gates
and a matrix of signal diodes as shown.
D to A
DAC
• A Digital to Analog Converter (DAC) consists of a number of binary
inputs and a single output. In general, the number of binary inputs of
a DAC will be a power of two.
• There are two types of DACs
• Weighted Resistor DAC
• R-2R Ladder DAC
Types of DAC
• Weighted Resistor DAC
• A weighted resistor DAC produces an analog output, which is almost
equal to the digital (binary) input by using binary weighted
resistors in the inverting adder circuit. In short, a binary weighted
resistor DAC is called as weighted resistor DAC.
• The circuit diagram of a 3-bit binary weighted resistor DAC is shown
in the following figure −
DAC
• Recall that the bits of a binary number can have only one of the two
values. i.e., either 0 or 1. Let the 3-bit binary input is b2b1b0
• . Here, the bits b2
• and b0
• denote the Most Significant Bit (MSB) and Least Significant Bit (LSB)
respectively.
DAC
• https://www.tutorialspoint.com/linear_integrated_circuits_applicatio
ns/linear_integrated_circuits_applications_digital_to_analog_convert
ers.htm
R-2R Ladder DAC
• The R-2R Ladder DAC overcomes the disadvantages of a binary
weighted resistor DAC. As the name suggests, R-2R Ladder DAC
produces an analog output, which is almost equal to the digital
(binary) input by using a R-2R ladder network in the inverting adder
circuit.
WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf
• Recall that the bits of a binary number can have only one of the two values. i.e., either 0 or 1. Let the 3-bit binary input is b2b1b0
• . Here, the bits b2
• and b0
• denote the Most Significant Bit (MSB) and Least Significant Bit (LSB) respectively.
• The digital switches shown in the above figure will be connected to ground, when the corresponding input bits are equal to ‘0’. Similarly,
the digital switches shown in above figure will be connected to the negative reference voltage, −VR
• when the corresponding input bits are equal to ‘1’.
• It is difficult to get the generalized output voltage equation of a R-2R Ladder DAC. But, we can find the analog output voltage values of R-
2R Ladder DAC for individual binary input combinations easily.
• The advantages of a R-2R Ladder DAC are as follows −
• R-2R Ladder DAC contains only two values of resistor: R and 2R. So, it is easy to select and design more accurate resistors.
• If more number of bits are present in the digital input, then we have to include required number of R-2R sections additionally.
DAC
• Due to the above advantages, R-2R Ladder DAC is preferable over
binary weighted resistor DAC.
• https://www.tutorialspoint.com/digital_communication/digital_com
munication_analog_to_digital.htm

More Related Content

PPTX
Basic of IoT System design -Introduction
PDF
Mechatronics Systems.pdf
PPTX
Presentation on Industrial Automation by Vivek Atalkar
PPTX
Mechatronics – Unit 1.pptx it can be used
PPTX
transmitters and signal conditioning element
PPT
14348999(1).ppt, transducer ,,,,,,,,,,,,
PPTX
L4 integration
PPTX
Fundamentals of plc 1
Basic of IoT System design -Introduction
Mechatronics Systems.pdf
Presentation on Industrial Automation by Vivek Atalkar
Mechatronics – Unit 1.pptx it can be used
transmitters and signal conditioning element
14348999(1).ppt, transducer ,,,,,,,,,,,,
L4 integration
Fundamentals of plc 1

Similar to WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf (20)

PPTX
Introduction to Mechatronics, Sensors and Transducers
PDF
Embedded System, Definition, Characteristics
PPTX
Industrial Control Systems and basic SCADA system.pptx
PPTX
introduction to embedded system presentation
PPTX
Ioe prerequisites
PPTX
introduction slide OF MECHATRONICS ENGINERING 1.pptx
PPTX
Mtr 323 plc
PDF
Unit 1.pdf
PPTX
ELN_3modul.pptx
PPTX
Introduction to Mechatronics Systems- An Overview
PPTX
FA PRESENTATION.pptx
PPTX
222116610_2 Assiment.pptx
PPT
Elements of mechatronics
PDF
53_36765_ME591_2012_1__1_1_Mechatronics System Design.pdf
PPTX
Power System Automation.pptx , ELECTRICAL ENGINEERING
PPTX
INTRODUCTION TO MECHATRONICS
PPTX
MECHANICAL ENGINEERING AND AUTOMATION.pptx
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
PPT
20ME702-MECHATRONICS.ppt, ACADEMIC YEAR: 2024-25
PPTX
Applications of Mechatronics in various fields.
Introduction to Mechatronics, Sensors and Transducers
Embedded System, Definition, Characteristics
Industrial Control Systems and basic SCADA system.pptx
introduction to embedded system presentation
Ioe prerequisites
introduction slide OF MECHATRONICS ENGINERING 1.pptx
Mtr 323 plc
Unit 1.pdf
ELN_3modul.pptx
Introduction to Mechatronics Systems- An Overview
FA PRESENTATION.pptx
222116610_2 Assiment.pptx
Elements of mechatronics
53_36765_ME591_2012_1__1_1_Mechatronics System Design.pdf
Power System Automation.pptx , ELECTRICAL ENGINEERING
INTRODUCTION TO MECHATRONICS
MECHANICAL ENGINEERING AND AUTOMATION.pptx
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
20ME702-MECHATRONICS.ppt, ACADEMIC YEAR: 2024-25
Applications of Mechatronics in various fields.
Ad

Recently uploaded (20)

PDF
CAB UNIT 1 with computer details details
PDF
SAHIL PROdhdjejss yo yo pdf TOCOL PPT.pdf
PDF
PakistanCoinageAct-906.pdfdbnsshsjjsbsbb
PPTX
New professional education PROF-ED-7_103359.pptx
PPTX
Subordinate_Clauses_BlueGradient_Optimized.pptx
PPTX
RTS MASTER DECK_Household Convergence Scorecards. Use this file copy.pptx
PPTX
dDifference Beetween Saving slides And Investment Slides.pptx
PPTX
Growth Capital Investment - Espresso Capital.pptx
PDF
Printing Presentation to show beginners.
PPTX
AI_ML_Internship_WReport_Template_v2.pptx
PDF
GENERATOR AND IMPROVED COIL THEREFOR HAVINGELECTRODYNAMIC PROPERTIES
PPT
System Unit Components and its Functions
PDF
Dozuki_Solution-hardware minimalization.
PPTX
unit1d-communitypharmacy-240815170017-d032dce8.pptx
PDF
Topic-1-Main-Features-of-Data-Processing.pdf
PDF
20A LG INR18650HJ2 3.6V 2900mAh Battery cells for Power Tools Vacuum Cleaner
PPTX
Group 4 [BSIT-1C] Computer Network (1).pptx
PDF
Maxon CINEMA 4D 2025 Crack Free Download Latest Version
PDF
Tcl Scripting for EDA.pdf
PPTX
Unit-1.pptxgeyeuueueu7r7r7r77r7r7r7uriruru
CAB UNIT 1 with computer details details
SAHIL PROdhdjejss yo yo pdf TOCOL PPT.pdf
PakistanCoinageAct-906.pdfdbnsshsjjsbsbb
New professional education PROF-ED-7_103359.pptx
Subordinate_Clauses_BlueGradient_Optimized.pptx
RTS MASTER DECK_Household Convergence Scorecards. Use this file copy.pptx
dDifference Beetween Saving slides And Investment Slides.pptx
Growth Capital Investment - Espresso Capital.pptx
Printing Presentation to show beginners.
AI_ML_Internship_WReport_Template_v2.pptx
GENERATOR AND IMPROVED COIL THEREFOR HAVINGELECTRODYNAMIC PROPERTIES
System Unit Components and its Functions
Dozuki_Solution-hardware minimalization.
unit1d-communitypharmacy-240815170017-d032dce8.pptx
Topic-1-Main-Features-of-Data-Processing.pdf
20A LG INR18650HJ2 3.6V 2900mAh Battery cells for Power Tools Vacuum Cleaner
Group 4 [BSIT-1C] Computer Network (1).pptx
Maxon CINEMA 4D 2025 Crack Free Download Latest Version
Tcl Scripting for EDA.pdf
Unit-1.pptxgeyeuueueu7r7r7r77r7r7r7uriruru
Ad

WINSEM2023-24_BCSE429L_TH_CH2023240501524_Reference_Material_II_Module_2-CPS_Design.pdf

  • 1. Module 2 -Session 4 Components of CPS Physical Space Sensors & Actuators Embedded Processors, Input and Output Interface
  • 3. Components of CPS • A cyber-physical system consists of a set of computing devices that communicate with each other and interact with the physical world through sensors and actuators in feedback loops. • It integrates physical and computer components to monitor and control physical processes seamlessly. • CPS includes self-driving cars, and the STARMAC is a small quadrotor aircraft.
  • 5. Physical Space Sensors • A sensor is a device that detects and responds to some type of input from the physical environment. • The input can be light, heat, motion, moisture, pressure or any number of other environmental phenomena. • The output is generally a signal that is converted to a human-readable display at the sensor location or transmitted electronically over a network for reading or further processing.
  • 6. Sensors • Sensors play a pivotal role in the Internet of things (IoT). • They make it possible to create an ecosystem for collecting and processing data about a specific environment so it can be monitored, managed and controlled more easily and efficiently. • IoT sensors are used in homes, out in the field, in automobiles, on airplanes, in industrial settings and in other environments. • Sensors bridge the gap between the physical world and logical world, acting as the eyes and ears for a computing infrastructure that analyzes and acts upon the data collected from the sensors.
  • 8. Types of Sensors • Sensors can be categorized in multiple ways. One common approach is to classify them as either active or passive. • An active sensor is one that requires an external power source to be able to respond to environmental input and generate output. • For example, sensors used in weather satellites often require some source of energy to provide meteorological data about the Earth's atmosphere.
  • 9. Types of Sensors • A passive sensor, on the other hand, doesn't require an external power source to detect environmental input. It relies on the environment itself for its power, using sources such as light or thermal energy. • A good example is the mercury-based glass thermometer. • The mercury expands and contracts in response to fluctuating temperatures, causing the level to be higher or lower in the glass tube. External markings provide a human-readable gauge for viewing the temperature. • Some types of sensors, such as seismic and infrared light sensors, are available in both active and passive forms.
  • 10. Analog Sensors • The environment in which the sensor is deployed typically determines which type is best suited for the application. • Analog sensors convert the environmental input into output analog signals, which are continuous and varying. • Thermocouples that are used in gas hot water heaters offer a good example of analog sensors. The water heater's pilot light continuously heats the thermocouple.
  • 11. Digital Sensors • In contrast to analog sensors, digital sensors convert the environmental input into discrete digital signals that are transmitted in a binary format (1s and 0s). • Digital sensors have become quite common across all industries, replacing analog sensors in many situations. • For example, digital sensors are now used to measure humidity, temperature, atmospheric pressure, air quality and many other types of environmental phenomena.
  • 12. Examples of types of sensors • Accelerometer. • Chemical • Humidity • Level • Motion • Optical • Pressure • Proximity • Temperature • Touch
  • 14. Actuators • An actuator is a device that produces a motion by converting energy and signals going into the system. • The motion it produces can be either rotary or linear. An actuator is a device that produces a motion by converting energy and signals going into the system. • The motion it produces can be either rotary or linear. • Essentially mechanical or electro-mechanical devices that allow controlled movements or positioning, actuators are a key component in several devices today
  • 15. Actuators • Actuators use energy from a source upon the receipt of a signal to bring about a mechanical motion used in lifting load, pulleys, etc hydraulic used in fluid motions, fluid leakages, opening valves, piston.
  • 16. Actuators • Actuators basically need a control signal and a source of energy. Upon receiving a control signal, the actuator uses energy from the source to bring about a mechanical motion. • The control system can be a human, a fixed mechanical or electronic system, or even software-based, say a printer driver, or a robot control system. • Examples of actuators include electric motors, stepper motors, electroactive polymers, screw jacks, servomechanism, solenoids and hydraulic cylinders.
  • 17. Actuators • Pneumatic actuators used in Robo Arms, Electric Rotators are used in rotating knob or wheels
  • 18. Embedded Processors • An embedded system is a computer system integrated into a physical device or product to perform a dedicated function. • It is designed to perform specific tasks and functions and is often part of a larger system. • Embedded systems are typically built around a microcontroller or microprocessor and may include other components such as sensors, actuators, and input/output interfaces
  • 20. Embedded Computing System • An embedded computing system is any device that includes a processing system but is not a general-purpose computer. • Embedded system Use application capabilities to optimize the design have real-time requirements.
  • 21. Input and Output Interfaces • It is used as an method which helps in transferring of information between the internal storage devices i.e. memory and the external peripheral device. • A peripheral device is that which provide input and output for the computer, it is also called Input-Output devices. • In micro-computer base system, the only purpose of peripheral devices is just to provide special communication links for the interfacing them with the CPU
  • 22. Input & Output Interfaces
  • 23. Input & Output Interfaces • It is used to synchronize the operating speed of CPU with respect to input-output devices. • It selects the input-output device which is appropriate for the interpretation of the input-output signal. • It is capable of providing signals like control and timing signals. • In this data buffering can be possible through data bus. • There are various error detectors. • It converts serial data into parallel data and vice-versa. • It also convert digital data into analog signal and vice-versa.
  • 24. Input & Output Interfaces • The nature of peripheral devices is electromagnetic and electro- mechanical. The nature of the CPU is electronic. There is a lot of difference in the mode of operation of both peripheral devices and CPU. • There is also a synchronization mechanism because the data transfer rate of peripheral devices are slow than CPU. • In peripheral devices, data code and formats are differ from the format in the CPU and memory. • The operating mode of peripheral devices are different and each may be controlled so as not to disturb the operation of other peripheral devices connected to CPU.
  • 25. Syllabus Open and Closed loop control system, Identification of key elements of mechatronics systems and represent into block diagram (Electro-Mechanical Systems), Concept of transfer function, Block diagram reduction principles, Applications of mechatronics systems:- Household, Automotive, Shop floor, Industrial.
  • 26. Objectives 1. Understand key elements of Mechatronics system, representation into block diagram 2. Understand concept of transfer function, reduction and analysis 3. Understand principles of sensors, its characteristics, interfacing with DAQ microcontroller 4. Understand the concept of PLC system and its ladder programming, and significance of PLC systems in industrial application 5. Understand the system modeling and analysis in time domain and frequency domain. 6. Understand control actions such as Proportional, derivative and integral and study its significance in industrial applications.
  • 27. Outcomes 1. Identification of key elements of mechatronics system and its representation in terms of block diagram 2. Understanding the concept of signal processing and use of interfacing systems such as ADC, DAC, digital I/O 3. Interfacing of Sensors, Actuators using appropriate DAQ micro- controller 4. Time and Frequency domain analysis of system model (for control application) 5. PID control implementation on real time systems 6. Development of PLC ladder programming and implementation of real life system
  • 28. What is a Control ?? Control means to make an out put ON or OFF by help of Controlling Devices like simple toggle switch to a complex system with components such as relays, timers, and switches.
  • 29. Types of control 1) On-Off control, 2) Sequential control, 3) Feedback control, and 4) Motion control.
  • 30. Example of an uncontrolled circuit.
  • 31. Example of manual control Manual Control circuits use components that require human interaction in order to operate. AC source Toggle switch Control circuits may require manual control, Automatic control or Combination of both. A controlled circuit
  • 32. Example of manual control AC source Toggle switch
  • 33. Example of Automatic control ✓Automatic control circuits can operate themselves without the need for human interaction. ✓Float Switch has been operated by a floating arrangement Automatically. AC source Float switch
  • 34. Example of Automatic control ✓Automatic control circuits can operate themselves without the need for human interaction. ✓Float Switch has been operated by a floating arrangement Automatically. AC source Float switch
  • 35. Example of Automatic control ✓Automatic control circuits can operate themselves without the need for human interaction. ✓Float Switch has been operated by a floating arrangement Automatically. AC source Float switch
  • 36. Example of Automatic control ✓Automatic control circuits can operate themselves without the need for human interaction. ✓Float Switch has been operated by a floating arrangement Automatically. AC source Float switch
  • 37. Control A Control system performs following functions- 1. For particular input the system output can be controlled to a desired particular value. 2. To minimize the error between actual and desired output Actual Response Desired Response
  • 38. Open Loop Control  Output is dependent on input but controlling action is totally independent of the changes in output, is an Open Loop Control System.  No feedback is used, so the controller must independently determine what signal to send to the actuator. Input Control Law Plant Output u Plant = Mathematical model of Input Amplifier + Actuator + Physical System Input = Reference / Desired Input or Set Point Input Output = Measured Output
  • 39. Examples of Open Loop Control
  • 40. Advantages and Dis-advantages of Open Loop Control Advantages: Simple in construction Low cost Convenient to implement when output is difficult to measure Disadvantages: It is inaccurate Unable to sense the environmental changes or disturbances
  • 41. Closed Loop Control e = Error = Input – Output u = Control Input Input Control Law Plant Output ∑ + _ e u  Controlling action is dependent on the changes in output
  • 42. Examples of Closed Loop Control
  • 43. Examples of Automatic Closed Loop Control
  • 44. Advantages: ✓Accurate, since the controller modifies and manipulates the actuating signal such that the error in the system will be zero. ✓Self-correcting ✓Senses the environmental changes, and disturbances in the system. Disadvantages: ✓Complicated to design ✓Costly ✓Instable, since due to feedback , system tries to correct the error. Advantages and Dis-advantages of Closed Loop Control
  • 45. Eg:-Various elements for controlling the Room temperature. Controlled variable - the room temperature Reference value - the required room temperature Comparison element- the person comparing the measured value with required temp. Error signal - difference between measured and required temperatures Correction unit - the switch on the fire Process unit - the heating by the fire Measuring device- a thermometer
  • 48. Open Loop System ❑ Example - for Antenna pointing system
  • 49. Open Loop System ❑ Antenna will rotate clockwise and anticlockwise depending on the output signal, negative or positive. ❑ Antenna will stationary if the input signal is 0v. ❑When the antenna is approaching the desired angle or position, the input signal must approach 0v. ❑It can be conclude that the control action is independent of the output.
  • 50. Close Loop System ❑ Example for antenna pointing system
  • 51. Close Loop System ❑From diagram, if θ0= θi then V0 = Vi so the error signal Ve = Vi – V0 = 0V ( the antenna will be stationary ) ❑ If the V0 not equal Vi ,Ve greater or less than 0V, the antenna will rotate clockwise, anticlockwise depending on a polarity of Ve. This means that the antenna will continue rotating until V0 = Vi . ❑In this example, the system automatically corrects the output when the system is disturbed. This system is known as ‘automatic control system’.
  • 52. Difference between Open loop and Closed loop system Sr.No. Open loop system Closed loop system 1 Not using feedback Feedback using 2 Less accurate More accurate 3 Simple in construction Complicated in construction 4 Optimisation in control is not possible Optimisation in control is possible 5 Easy maintenance & cost is less Difficult to maintain & cost is more 6 System cannot compensate for disturbance. system can compensate for disturbance. 7 Eg. CD deck, Digital thermometer, toaster, fan. Eg. Automatic water level, air conditioning system, robot (arm).
  • 53. Feedback and its effect ❑ Feedback system is a system that maintains a relationship between the output and some reference input by comparing them and using the difference as a means of control. ❑ Feedback is used to reduce the error between reference and the system output . ❑ Feedback effect on performance characteristic: ➢ Stability ➢ Overall gain ➢ Sensitivity ➢ External disturbances
  • 54. Transfer Function Models ❑Transfer function: is a mathematical representation, in terms of spatial or temporal frequency, of the relation between the input and output of a linear time invariant system. ❑Why TF? Because it is easier / better to assess some things using classical techniques, such as gain and phase margin. ❑How to determine TF? ❑Derive the Governing Differential Equation ✓Take Laplace transform of output ✓Take Laplace transform of input ❑Transfer function = L (output) / L (input)
  • 56. Advantages and features of TF- 1. Gives mathematical model of system components 2. LT converts time domain equation into simple algebraic equation 3. TF obtained for a pair of i/p and o/p 4. Once TF is known o/p response for any type of reference i/p can be calculated 5. TF helps in analyzing stability of system
  • 57. Disadvantages of TF- 1. Does not provide any information about physical structuring of system 2. Applicable to linear time invariant system
  • 59. Block Diagram: Feedback ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) s H s G s G s R s Y s H s G s G s R s Y − = = + = = 1 TF loop Closed 1 TF loop Closed
  • 62. 3. Eliminating a feedback loop
  • 63. 4. Moving a pickoff/takeoff point behind a block/ right
  • 64. 5. Moving a pickoff point ahead of a block/left
  • 65. 6. Moving a summing point ahead of a block
  • 66. 7. Moving a summing point behind of a block G G G
  • 69. Applications of Mechatronic System 1. Household i. Refrigerator ii. Washing m/c iii. Microwave 2. Automotive i. Fuel injection system ii. Power steering iii. Air conditioner 3. Shop floor i. Tool monitoring system ii. Automated guided vehicle iii. Conveyor system iv. Bottle filing plant.
  • 70. Sequential Control 1. Event based 2. Time based
  • 72. Washing m/c PWD - Pulse width modulation- Control speed of motor in diff phases
  • 73. Time based -Water heating system ✓ Control function is Inexact ✓ No fail safe features
  • 77. MODULE II Concurrent Control Loops and Synchronization of Nodes in Cyber Physical System 1
  • 78. 1. DISTRIBUTED SYSTEM TYPES Fully Distributed Processors Control Fully replicated Not fully replicated master directory Local data, local directory Master-slave Autonomous transaction based Autonomous fully cooperative Homog. special purpose Heterog. special purpose Homog. general purpose Heterog. general purpose 2
  • 79. WHAT IS A DISTRIBUTED SYSTEM? Definition: A distributed system is one in which components located at networked computers communicate and coordinate their actions only by passing messages. This definition leads to the following characteristics of distributed systems:  Concurrency of components  Lack of a global ‘clock’  Independent failures of components 3
  • 80. CENTRALIZED SYSTEM CHARACTERISTICS  One component with non-autonomous parts  Component shared by users all the time  All resources accessible  Software runs in a single process  Single point of control  Single point of failure 4
  • 81. DISTRIBUTED SYSTEM CHARACTERISTICS  Multiple autonomous components  Components are not shared by all users  Resources may not be accessible  Software runs in concurrent processes on different processors  Multiple points of control  Multiple points of failure 5
  • 82. EXAMPLES OF DISTRIBUTED SYSTEMS  Local Area Network and Intranet  Database Management System  Automatic Teller Machine Network  Internet/World-Wide Web  Mobile and Ubiquitous Computing 6
  • 83. LOCAL AREA NETWORK the rest of email server Web server Desktop computers File server router/firewall print and other servers other servers print Local area network email server the Internet 7
  • 87. WEB SERVERS AND WEB BROWSERS Internet Browsers Web servers www.google.com www.uu.se www.w3c.org Protocols Activity.html http://www.w3c.org/Protocols/Activity.html http://www.google.comlsearch?q=lyu http://www.uu.se/ File system of www.w3c.org 11
  • 88. MOBILE AND UBIQUITOUS COMPUTING Laptop Mobile Printer Camera Internet Host intranet Home intranet GSM/GPRS Wireless LAN phone gateway Host site 12
  • 89. COMMON CHARACTERISTICS  What are we trying to achieve when we construct a distributed system?  Certain common characteristics can be used to assess distributed systems  Heterogeneity  Openness  Security  Scalability  Failure Handling  Concurrency  Transparency 13
  • 90. HOW CONTROLLER WORKS IN CPS 14
  • 91. NEED OF CONCURRENCY IN THE SYSTEM  Implementation of CPS based on multitasking architecture 15
  • 92. CONCURRENCY IN CONTROL SYSTEM FOR CPS 16
  • 93. OPENNESS  Cyber-physical systems (CPS) introduce a new quality of interweaving the virtual and the real world within emerging smart spaces.  Besides software components, CPS consist of a multitude of sensors and actuators that create intelligent environments of connected smart objects.  With software applications influencing the virtual world and various kinds of actuators affecting the real world–and vice. 17
  • 94. ESTABLISHING A PROPER WORKFLOW FOR SYNCHRONIZATION  A synchronization between the process instances and models of the virtual and the real world has to be established to provide a consistent view of CPS workflow execution.  In addition, CPS require scalable and distributed process infrastructures to cope with the trend towards decentralization.  The goal is the introduction of workflows to CPS to enable the modelling and execution of consistent and distributed processes with the help of sensors, actuators, things and software. 18
  • 95. CONCURRENCY  Components in distributed systems are executed in concurrent processes.  Components access and update shared resources (e.g. variables, databases, device drivers).  Integrity of the system may be violated if concurrent updates are not coordinated.  Lost updates  Inconsistent analysis 19
  • 96. CPS – CONCURRENCY AND SYNCHRONIZATION  Concurrency and synchronization are crucial concepts in the context of Cyber-Physical Systems (CPS).  CPS integrates computational algorithms and physical processes to create systems that interact with the physical world.  Ensuring proper concurrency and synchronization is essential to manage the complexity and real-time nature of CPS applications. 20
  • 97. CONCURRENCY IN CPS:  Parallel Processing:  CPS often involves multiple sensors, actuators, and components working simultaneously. Parallel processing allows these components to operate concurrently, improving overall system efficiency. Parallelism helps in handling diverse tasks such as data acquisition, control computations, and communication concurrently.  Real-Time Constraints:  Many CPS applications have real-time requirements, where tasks must be executed within specific time bounds. Concurrency is employed to meet these constraints, ensuring timely responses to events.  Distributed Systems:  CPS may consist of distributed components across networks. Concurrency is essential for managing communication and coordination among these distributed elements. 21
  • 98. CONCURRENCY IN CPS  Sensor Fusion:  Concurrency is crucial in sensor fusion applications where data from multiple sensors need to be processed concurrently to obtain a unified and accurate representation of the system's state. 22
  • 99. TRANSPARENCY  Distributed systems should be perceived by users and application programmers as a whole rather than as a collection of cooperating components.  Transparency has different aspects.  These represent various properties that distributed systems should have. 23
  • 100.  Deterministic Execution:  Achieving deterministic execution is challenging in CPS, as variations in execution times can impact system behavior. Synchronization mechanisms help in maintaining determinism.  Fault Tolerance:  CPS often operates in dynamic and uncertain environments. Synchronization strategies need to account for faults and unexpected events, ensuring the system can gracefully handle such situations.  Scalability:  As CPS scale in size and complexity, managing concurrency and synchronization becomes more challenging. Scalable synchronization mechanisms are essential to handle large-scale CPS deployments. 25
  • 102.  Synchronization in CPS:  Data Consistency:  In CPS, different components often share data. Synchronization mechanisms like locks, semaphores, or atomic operations are used to ensure data consistency and prevent race conditions.  Event Synchronization:  Events in CPS need to be synchronized to maintain a consistent and accurate representation of the physical world. Timestamping and synchronization protocols are used to order and coordinate events. 32
  • 103.  In a centralized system: all processes reside on the same system utilize the same clock.  In a distributed system: like synchronize everyone’s watch in the classroom.
  • 104. GLOBAL TIME  Global Time is utilized to provide timestamps for processes and data.   Physical clock: concerned with “People” time   Logical clock: concerned with relative time and maintain logical consistency
  • 105.  Synchronization in CPS:  Data Consistency:  In CPS, different components often share data. Synchronization mechanisms like locks, semaphores, or atomic operations are used to ensure data consistency and prevent race conditions.  Event Synchronization:  Events in CPS need to be synchronized to maintain a consistent and accurate representation of the physical world. Timestamping and synchronization protocols are used to order and coordinate events.  Communication Synchronization:  In a distributed CPS, communication between components needs to be synchronized to ensure messages are received and processed in the correct order. Protocols like time- triggered communication or synchronized clocks may be employed. 35
  • 106. SYNCHRONIZATION  Resource Access:  Shared resources, such as communication channels or processing units, require synchronization to avoid conflicts. This ensures that multiple components do not attempt to access a resource simultaneously. 36
  • 107. SYNCHRONIZATION OF DISTRIBUTED CONTROLLERS IN CYBER-PHYSICAL SYSTEMS 37
  • 108. SYNC SLOUTION FOR DISTRIBUTED CPS 38
  • 109. SYNCHRONIZATION PROTOCOL  A synchronization protocol can be setup on top of hardware offering fine-grained tuning of the oscillator circuitry to provide clock-source frequency synchronization  Challenges for Cyber-Synchronization: Essentially, clock-source synchronization provides synchronous- rate execution of all functionalities on the distributed platforms. Consequently, synchronization is inherently propagated to IPO invocations and thus, cyber-synchronization is guaranteed (down to the maximum synchronization error). 39
  • 110. SYNCHRONIZED CLOCKS  In the case of synchronized clock sources, the actuation pulse train frequencies across controllers are also synchronized; therefore, providing synchronized clock sources ensures desired temporal properties of actuation signals. However, recall inter- timer phase synchronization e 40
  • 112. CHALLENGES:  Deterministic Execution:  Achieving deterministic execution is challenging in CPS, as variations in execution times can impact system behavior. Synchronization mechanisms help in maintaining determinism  Fault Tolerance:  CPS often operates in dynamic and uncertain environments. Synchronization strategies need to account for faults and unexpected events, ensuring the system can gracefully handle such situations. 42
  • 113. CPS DEPLOYMENTS CHALLENGES  As CPS scales in size and complexity, managing concurrency and synchronization becomes more challenging. Scalable synchronization mechanisms are essential to handle large-scale CPS deployments.  In summary, proper concurrency and synchronization are vital for the reliable and efficient operation of Cyber-Physical Systems, especially considering their real-time and distributed nature.  Applying appropriate synchronization mechanisms helps manage shared resources, maintain data consistency, and ensure timely and coordinated responses in CPS applications. 43
  • 114. CONCURRENCY IN REST API  Concurrency is a common challenge in web development, especially when designing and implementing RESTful APIs.  Concurrency occurs when multiple clients or processes access or modify the same resource at the same time, potentially causing conflicts, errors, or inconsistencies. 44
  • 116. OPTIMISTIC CONCURRENCY LOCKING  With optimistic locking, records are freely given out to whoever wants them.  Every record has a version field that can be represented with a unique number, timestamp, or some sort of a hash.  Upon a successful save of the record, the version is incremented or updated. 46
  • 117. CONCURRENCY LOCKING  Two users are editing the same record. Initially, they have the same state of the record.  One of the users clicks the Save button earlier. It will persist the user’s changes to the database.  Later, the second user clicks the Save button. It will persist the user’s changes to the database, silently overwriting the data persisted by the previous user. 47
  • 119. SOLUTION FOR LOCKING  When two users are retrieving the same record, they have initially the same value of its version attribute  After a user’s change, when a database transaction tries to commit the record, it will increase its version with 1. Now we know that the second user is updating the same record.  Before the second user’s save operation, we need to check if the version we originally got matches what’s currently in the database. 49
  • 120. SOLUTION FOR LOCKING  If they don’t match, we know that during the time we’ve had the record, someone else(the first user in this case) has already requested and saved that same record before we could save, and therefore we must take action to ensure that our update will be consistent.  The first concurrent transaction will succeed, while the second will throw an optimistic locking exception therefore  50
  • 122. SOLUTION  In an optimistic locking scheme, an update request is only successful if the resource has not been modified since the client last checked. HTTP provides some built-in mechanisms for implementing an optimistic locking strategy using the If- Match conditional header and ETags (ETags can also be used with GET and HEAD requests to improve caching efficiency.) 52
  • 124. Human in Loop Control System
  • 125. HIL • Human-in-the-loop systems allow humans to change the output of the learning systems. • Human-in-the-loop simulators always have human input as part of the simulation, and humans influence the outcomes of the simulation exercise such that the outcomes may not be exactly reproducible. • The human-in-the-loop particularly refers to a situa- tion where a system or a machine is controlled, fully.
  • 126. HIL • Human-in-the-Loop aims to achieve what neither a human being nor a machine can achieve on their own. • When a machine isn't able to solve a problem, humans need to step in and intervene. • This process results in the creation of a continuous feedback loop. • Human-in-the-loop allows the user to change the outcome of an event or process. • The immersion effectively contributes to a positive transfer of acquired skills into the real world. • This can be demonstrated by trainees utilizing flight simulators in preparation to become pilots.
  • 127. Human in the Loop Control System
  • 128. HITL • The importance of humans in the AI loop is regulatory, ethical, and reputational. • Having people within the AI system will help safeguard against inaccurate data that may lead to poor decisions and other adverse outcomes.5 Jul 2022 • Human-in-the-loop or HITL is used in multiple contexts. It can be defined as a model requiring human interaction. HITL is associated with modeling and simulation (M&S) in the live, virtual, and constructive taxonomy
  • 129. HITL • In machine learning, HITL is used in the sense of humans aiding the computer in making the correct decisions in building a model • HITL also allows for the acquisition of knowledge regarding how a new process may affect a particular event. • Utilizing HITL allows participants to interact with realistic models and attempt to perform as they would in an actual scenario. • HITL simulations bring to the surface issues that would not otherwise be apparent until after a new process has been deployed. • A real-world example of HITL simulation as an evaluation tool is its usage by the Federal Aviation Administration (FAA) to allow air traffic controllers to test new automation procedures by directing the activities of simulated air traffic while monitoring the effect of the newly implemented procedures.
  • 130. HITL • Tabletop simulation may be useful in the very early stages of project development for the purpose of collecting data to set broad parameters, but the important decisions require human-in-the-loop simulation • Intelligent systems can only go so far in certain circumstances to automate a process; only humans in the simulation can accurately judge the final design.
  • 132. • The aim of human in the loop is optimizing models and algorithms through human intervention and contribution, to create better and more accurate AI. • As we mentioned, human-in-the-loop can be applied at various stages of the AI lifecycle:
  • 133. Phases in HITL • Training and testing: Humans in the loop can be involved during model training, validation and testing in order to accelerate the learning process. Humans can first demonstrate how tasks should be performed and afterwards provide feedback on model performance. This can be done by correcting the model’s outputs or evaluating them, which creates a reward function that can be used for reinforcement learning. • Learning from a combination of human demonstrations and evaluations has been demonstrated to be faster and more sample- efficient when compared to traditional supervised learning algorithms.
  • 134. • Deployment: Human in the Loop workflows are especially important when the availability of training data is very limited or the data is imbalanced or uncomprehensive – so we are unsure whether the model is prepared to handle all potential edge cases. • In addition, even if the model usually achieves high accuracy, human monitoring and double-checking might be needed if model mistakes might end up being very costly: for example, in cases such as content moderation of user-generated content where false negatives may result in irreparable damage. • In both cases, the model can be connected to a labeling interface where outputs below a given threshold of certainty are routed so that they are checked and verified by a human, either in real-time or in batches for future re-training.
  • 135. HITL • 3. Hiring: human in the loop Here at Humans in the Loop, we have taken this technical term and we have given it an additional meaning: integrating humans into the workforce and into the digital labor market. As a social enterprise, we use the plural of “humans in the loop” so that the name does not refer to a single person but rather a collective working together to power some of the most exciting applications of AI.
  • 136. Human in the Loop • Our workers are not just annotators or labelers, they are professional humans in the loop who have worked on a variety of AI projects and have developed an expertise on how AI model training works, what is considered an edge case, what data might confuse the model, and what data might cause harmful biases. • After collecting and/or annotating the training datasets for the model image by image, these humans in the loop have a deep understanding of what the data looks like and why the model might be exhibiting certain errors when deployed in real-life scenarios.
  • 141. ADC-Analogue to Digital Converter • Analogue to Digital Converter, or ADC, is a data converter which allows digital circuits to interface with the real world by encoding an analogue signal into a binary code. • The Analogue-to-Digital Converter, (ADCs) allow micro-processor controlled circuits, Arduinos, Raspberry Pi, and other such digital logic circuits to communicate with the real world. • In the real world, analogue signals have continuously changing values which come from various sources and sensors which can measure sound, light, temperature or movement, and many digital systems interact with their environment by measuring the analogue signals from such transducers.
  • 142. ADC • While analogue signals can be continuous and provide an infinite number different voltage values, digital circuits on the other hand work with binary signal which have only two discrete states, a logic “1” (HIGH) or a logic “0” (LOW). • So it is necessary to have an electronic circuit which can convert between the two different domains of continuously changing analogue signals and discrete digital signals, and this is where Analogue-to-Digital Converters (A/D) come in. • Basically an analogue to digital converter takes a snapshot of an analogue voltage at one instant in time and produces a digital output code which represents this analogue voltage. The number of binary digits, or bits used to represent this analogue voltage value depends on the resolution of an A/D converter. • For example a 4-bit ADC will have a resolution of one part in 15, (24 – 1) whereas an 8-bit ADC will have a resolution of one part in 255, (28 – 1). Thus an analogue to digital converter takes an unknown continuous analogue signal and converts it into an “n”- bit binary number of 2n bits.
  • 144. ADC • Here we can see that as the wiper terminal of the potentiometer is rotated between between 0 volts and VMAX, it produces a continuous output signal (or voltage) which has an infinite number of output values relative to the wiper position. • As the potentiometers wiper is adjusted from one position to the next, there is no sudden or step change between the two voltage levels thereby producing a continuously variable output voltage. Examples of analogue signals include temperature, pressure, liquid levels and light intensity.
  • 145. ADC • For a digital circuit the potentiometer wiper has been replaced by a single rotary switch which is connected in turn to each junction of the series resistor chain, forming a basic potential divider network. As the switch is rotated from one position (or node) to the next the output voltage, VOUT changes quickly in discrete and distinctive voltage steps representing multiples of 1.0 volts on each switching action or step as shown. • So for example, the output voltage will be 2 volts, 3 volts, 5 volts, etc. but NOT 2.5V, 3.1V or 4.6V. Finer output voltage levels could easily be produced by using a multi-positional switch and increasing the number of resistive elements within the potential divider network, therefore increasing the number of discrete switching steps. • Then we can see that the major differences between an analogue signal and a digital signal is that an “Analogue” quantity is continuously changing over time while a “Digital” quantity has discrete (step by step) values. “LOW” to “HIGH” or “HIGH” to “LOW”. • So how can we convert a continously changing signal with an infinite number of values to one which has distinct values or steps for use by a digital circuit.
  • 146. Analogue-to-Digital Converter • The process of taking an analogue voltage signal and converting it into an equivalent digital signal can be done in many different ways, and while there are many analogue-to- digital converter chips such as the ADC08xx series available from various manufacturers, it is possible to build a simple ADC using discrete components. • One simple and easy way is by using parallel encoding, also known as flash, simultaneous, or multiple comparator converters in which comparators are used to detect different voltage levels and output their switching state to an encoder. • Parallel of “Flash” A/D converters use a series of interconnected but equally spaced comparators and voltage references generated by a series network of precision resistors for generating an equivalent output code for a particular n-bit resolution. • The advantage of parallel or flash converters is that they are simple to construct and do not require any timing clocks as the instant an analogue voltage is applied to the comparator inputs, it is compared against a reference voltage. Consider the comparator circuit below.
  • 147. ADC - Comparator • An analogue comparator such as the LM339N which has two analogue inputs, one positive and one negative, and which can be used to compare the magnitudes of two different voltage levels.
  • 148. ADC • A voltage input, (VIN) signal is applied to one input of the comparator, while a reference voltage, (VREF) to the other. A comparison of the two voltage levels at the comparator’s input is made to determine the comparators digital logic output state, either a “1” or a “0”. • The reference voltage, VREF is compared against the input voltage, VIN applied to the other input. For an LM339 comparator, if the input voltage is less than the reference voltage, (VIN < VREF) the output is “OFF”, and if it is greater than the reference voltage, (VIN > VREF) the output will be “ON”. Thus a comparator compares two voltage levels and determines which one of the two is higher. • In our simple example above, VREF is obtained from the voltage divider network setup by R1 and R2. If the two resisors are of equal values, that is R1 = R2, then clearly the reference voltage level will be equal to half the supply voltage, or V/2. So for a comparator with an open-collector output, if VIN is less than V/2, the output is HIGH, and if VIN is greater than V/2, the output is LOW acting as a 1-bit ADC. • But by adding more resistors to the voltage divider network we can effectively “divide” the supply voltage by an amount determined by the resistances of the resistors. However, the more resistors we use in the voltage divider network the more comparators will be required. • In general, 2n– 1 comparators would be required for conversion of an “n”-bit binary output, where “n” is typically in the range from 8 to 16. In our example above, the single bit ADC used 21– 1, which equals “1” comparator to determine if VIN was greater or smaller than the V/2 reference voltage. • If we now create a 2-bit ADC, then we will need 22– 1 which is “3” comparators as we need four different voltage levels corresponding to the 4 digital values required for a 4-to-2 bit encoder circuit as shown.
  • 149. ADC
  • 151. • Where: “X” is a “don’t care”, that is either a logic “0” or a logic “1” condition. • So how does this analogue-to-digital converter work. For an A/D converters to be useful it has to produce a meaningful digital representation of the analogue input signal. Here in this simple 2-bit ADC example we have assumed for simplicity that the input voltage VIN is between 0 and 4 volts, so have set VREF and the resistive voltage-divider network to drop 1 volt across each resistor. • When VIN is between 0 and 1 volt, (<1V) the input on all three comparators will be less than the reference voltage, so their outputs will be LOW and the encoder will output a binary zero (00) condition on pins Q0 and Q1. When VIN increases and exceeds 1 volt but is less than 2 volts, (1V<VIN<2V) comparator U1 which has a reference voltage input set at 1 volt, will detect this voltage difference and produce a HIGH output. The priority encoder which is used as the 4-to-2 bit encoding detects the change of input at D1 and produces a binary output of “1” (01). • Note that a Priority Encoder such as the TTL 74LS148 allocates a priority level to each individual input. The priority encoders output corresponds to the currently active input which has the highest priority. So when an input with a higher priority (D1 compared to D0) is present, all other inputs with a lower priority will be ignored. So if there are two or more inputs at logic level “1” at the same time, the actual output code on D0 and D1 would only correspond to the input with the highest designated priority. • So now as VIN increases above 2 volts, the next reference voltage level, comparator U2 detects the change and produces a HIGH output. But because input D2 has a higher priority than inputs D0 or D1, the priority encoder outputs a binary “2” (10) code, and so on when VIN exceeds 3 volts producing a binary code output of “3” (11). Clearly as VIN reduces or changes between each reference voltage level, each comparator will output either a HIGH or a LOW condition to the encoder which inturn produces a 2-bit binary code between 00 and 11 relative to VIN. • This is all well and good, but priority encoders are not available as 4-to-2 bit devices, and if we use a commercially available one such as the TTL 74LS148 or its CMOS 4532 equivalent which are both 8-bit devices, then six of the binary bits would not be used. But a simple encoder circuit can be made using digital Ex-OR gates and a matrix of signal diodes as shown.
  • 152. D to A
  • 153. DAC • A Digital to Analog Converter (DAC) consists of a number of binary inputs and a single output. In general, the number of binary inputs of a DAC will be a power of two. • There are two types of DACs • Weighted Resistor DAC • R-2R Ladder DAC
  • 154. Types of DAC • Weighted Resistor DAC • A weighted resistor DAC produces an analog output, which is almost equal to the digital (binary) input by using binary weighted resistors in the inverting adder circuit. In short, a binary weighted resistor DAC is called as weighted resistor DAC. • The circuit diagram of a 3-bit binary weighted resistor DAC is shown in the following figure −
  • 155. DAC
  • 156. • Recall that the bits of a binary number can have only one of the two values. i.e., either 0 or 1. Let the 3-bit binary input is b2b1b0 • . Here, the bits b2 • and b0 • denote the Most Significant Bit (MSB) and Least Significant Bit (LSB) respectively.
  • 158. R-2R Ladder DAC • The R-2R Ladder DAC overcomes the disadvantages of a binary weighted resistor DAC. As the name suggests, R-2R Ladder DAC produces an analog output, which is almost equal to the digital (binary) input by using a R-2R ladder network in the inverting adder circuit.
  • 160. • Recall that the bits of a binary number can have only one of the two values. i.e., either 0 or 1. Let the 3-bit binary input is b2b1b0 • . Here, the bits b2 • and b0 • denote the Most Significant Bit (MSB) and Least Significant Bit (LSB) respectively. • The digital switches shown in the above figure will be connected to ground, when the corresponding input bits are equal to ‘0’. Similarly, the digital switches shown in above figure will be connected to the negative reference voltage, −VR • when the corresponding input bits are equal to ‘1’. • It is difficult to get the generalized output voltage equation of a R-2R Ladder DAC. But, we can find the analog output voltage values of R- 2R Ladder DAC for individual binary input combinations easily. • The advantages of a R-2R Ladder DAC are as follows − • R-2R Ladder DAC contains only two values of resistor: R and 2R. So, it is easy to select and design more accurate resistors. • If more number of bits are present in the digital input, then we have to include required number of R-2R sections additionally.
  • 161. DAC • Due to the above advantages, R-2R Ladder DAC is preferable over binary weighted resistor DAC. • https://www.tutorialspoint.com/digital_communication/digital_com munication_analog_to_digital.htm