0% found this document useful (0 votes)
5 views47 pages

Lect03 MoC Differential Equation

Uploaded by

arnooshanajafi26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views47 pages

Lect03 MoC Differential Equation

Uploaded by

arnooshanajafi26
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

‫بسم اهلل الرحمن الرحیم‬

Embedded and Real-Time Systems


Spring 2025

Elham Cheshmikhani
[email protected]

Department of Computer Science & Engineering


Shahid Beheshti University
Copyright Notice

This lecture is adopted from


- Real-Time Embedded Systems Course 2019, Alireza Ejlali,
Sharif University of Technology
- Real-Time Embedded Systems Course 2020, Hossein Attarzadeh,
Beheshti University

Marwedel’s and LeeSeshia’s books, Chapter 2


Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 2
Recap

• What is an embedded system?

• Differences between embedded systems and cyber physical


systems

• Real-time embedded systems

• Requirements
– Real-time-ness, efficiency, dependability, and extra-function requirements

• Challenges of implementation in pure hardware and software


– Modeling is the best choice

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 3


Content

Let’s model an embedded system

• Capturing the requirements for modeling techniques

• Providing an overview of models of computation (MoC)


– Von Neumann languages

– Modeling continuous dynamics – differential equations


• Feedback control systems – time-domain modeling

– Modeling discrete dynamics – finite-state machines (FSM)

– Modeling hybrid systems – timed automata

– Concurrent models of computation


• Synchronous composition

• Dataflow models

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 4


Embedded Systems

• Information processing systems embedded into a


larger product
• Main reason for buying is not information processing

• Ubiquitous Computing:
– Information anytime, anywhere
• Embedded systems provide fundamental technology

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 5


Simplified Design Fellow

• Embedded system design chart

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 6


Reactive Systems

• Reactive Systems = Event-based Systems


• The traditional paradigms of programming (i.e.
model of computable functions) are inappropriate
– Model of computable functions
• Von Neumann paradigm
• Sequential computing
• Suitable model for reactive systems:
– Automata-based programming paradigm

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 7


Model

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 8


• Embedded system design chart

• The first step for design is specification for the model


of the system under design (SUD)
• The model contains exactly those characteristics and
properties of the modeled entity that are relevant for a
given task

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 9


Specification

• Models are described in languages


• Languages should be capable of representing the following
features:
• Hierarchies
- Behavioral hierarchies: containing objects necessary to describe the
system: States, events, and output signals are examples of such objects
- Structural hierarchies: how systems are composed of physical
components comprised of components: processors, memories, actuators,
and sensors
• Component-based design
• Concurrency
• Synchronization and communication
- It is necessary to express mutual exclusion
• Timing behavior
- we need to show that certain computations are completed in a given
amount of time, but the algorithm as a whole should possibly run until
power is turned off
• elapsed time, delaying of processes, timeouts, Deadlines

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 10


Specification

• Timing behavior
• we need to show that certain computations are completed in a given
amount of time, but the algorithm as a whole should possibly run
until power is turned off
- elapsed time, delaying of processes, timeouts, Deadlines

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 11


Specification (Cont.)

• Models are described in languages


• Languages should be capable of representing the following
features:
• State-oriented behavior
- State-oriented behavior provided by automata should be easy to
describe
- classical automata models are insufficient, since they cannot model
timing and since hierarchy is not supported
• Event-handling
• Exception-oriented behavior
• Presence of programming elements
• Executability
• Support for the design of large systems
• Domain-specific support
• Readability
• Portability and flexibility
• Termination
• Support for non-standard I/O devices

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 12


Specification (Cont.)

• Models are described in languages


• Languages should be capable of representing the following
features:
• Non-functional properties
• Support for the design of dependable systems
• No obstacles to the generation of efficient implementations
• Appropriate model of computation (MoC)

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 13


Model of Computation

• Here will not be any single formal language meeting all


these requirements
• In practice, we must live with compromises and possibly also with a mixture of
languages (each of which would be appropriate for describing a certain type of
problems)
• The choice of the language used for an actual design will depend on the
application domain and the environment in which the design has to be
performed

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 14


Model of Computation

• MoCs describe the mechanism assumed for performing


Computations
• Components and the organization of computations in
components: Procedures, processes, functions, and finite
state machines are possible components
• Communication protocols describe methods for
communication between components. Asynchronous message
passing and rendezvous-based communication are examples of
communication protocols

• Nodes in the graph represent components performing computations


• Their causal dependence is the most obvious relation between
computations

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 15


Model of Communication

• Models of communication:
• Shared memory
• Critical sections: include semaphores, mutexes, conditional critical
regions, monitors, and spin locks
• Shared memory-based communication can be fast but is difficult to
implement in multiprocessor systems without a common physical
memory

• Message passing
• Messages are sent and received
• It can be implemented easily even if no common memory is
available
• Asynchronous message passing, also called non-blocking communication
• Synchronous message passing or blocking communication,
rendezvousbased communication
• Extended rendezvous, remote invocation

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 16


Organization of computations within the components

• Von Neumann model: This model is based on the sequential


execution of sequences of primitive computations
• Differential equations: Differential equations are capable of
modeling analog circuits and physical systems
• Discrete event model: In this model, there are events carrying a
totally ordered time stamp, indicating the time at which the event
occurs
• A global event queue sorted by time
• Entries from this queue are processed according to this order
• Finite state machines (FSMs): This model is based on
the notion of a finite set of states, inputs, outputs, and transitions
between states. Several of these machines may need to
communicate, forming so-called communicating finite state
machines (CFSMs)
• Data flow: In the data-flow model, the availability of data triggers
the possible execution of operations
Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 17
Organization of computations within the components

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 18


Von Neumann vs Non-von Neumann
• Von Neumann model of sequential execution combined with
some communication technique is a commonly used MoC
• In this model, specifications will typically consist of tasks,
processes, or threads
• Von Neumann computing is implicitly based on accesses to
globally shared
memory → making deadlocks
• Rarely deadlocks may be acceptable for a PC, but they are
clearly unacceptable for a safety-critical system
• It makes sense to study non-von Neumann MoCs avoiding this
problem
• Non-von Neumann models are frequently called model-based
designs
• The key idea of model-based design is to have some abstract
model of the system under design (SUD)
Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 19
Organization of computations within the components

• Von Neumann model: This model is based on the sequential


execution of sequences of primitive computations
• Differential equations: Differential equations are capable of
modeling analog circuits and physical systems
• Discrete event model: In this model, there are events carrying a
totally ordered time stamp, indicating the time at which the event
occurs
• A global event queue sorted by time
• Entries from this queue are processed according to this order
• Finite state machines (FSMs): This model is based on
the notion of a finite set of states, inputs, outputs, and transitions
between states. Several of these machines may need to
communicate, forming so-called communicating finite state
machines (CFSMs)
• Data flow: In the data-flow model, the availability of data triggers
the possible execution of operations
Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 20
Modeling Continuous Dynamics- Differential Equations

• Ordinary differential equations, Laplace transforms,


feedback control models, …

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 21


An Example: Helicopter Dynamics

• Six degrees of freedom (6DoF):


• Three of these represent position in three
dimensional space: x, y, z
• Three represent orientation in space: pitch, yaw,
roll

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 22


Notation: Continuous-Time Signals

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 23


Notation: Differential Equation

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 24


Integral Equation

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 25


Integral Equation

• You can determine the acceleration, velocity, and


position of the object at any time
Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 26
Angular Version of Force: Torque
For a point mass rotating around a fixed axis:

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 27


Angular Version of Force: Torque
For a point mass rotating around a fixed axis:

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 28


Rotational Version of Newton’s Second Law

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 29


Feedback Control Problem

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 30


Plant and Controller

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 31


Simplified Model

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 32


Actor Models

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 33


Actor Models

• Actor: are waiting for input and perform their


operation once all required inputs have arrived
• Actor: A box like that above, where the inputs
are functions and the outputs are functions, is
called an actor

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 34


Actor Model of Helicopter

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 35


Cascade Composition

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 36


Actor Model with Multiple Inputs

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 37


Actor

• Closely related to the concept of function in


mathematics
• Can be used to model sensors, actuators,
computation, and plant

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 38


Key Point in Modeling a Plant

• The most important point in modelling a plant as


an actor is to correctly determine the input(s)
and output(s)

– Output is what you desire to control


– Input is what you really give (apply) to the system
from the viewpoint of the controller

Embedded and Real-Time Systems, Spring 2024, SBU, Tehran, Iran 39


Other Examples

• Actor model of the plant in the air conditioning


system

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 40


Other Examples

• Actor model of the plant in one dimensional


velocity control

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 41


Simulink Library

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 42


Simulink Library

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 43


Feedback Control

Actual behavior

Desired behavior compensate to reduce future error

• Ψ: continuous-time system specifying the desired


angular velocity
• e: represents the difference between the actual and
the desired angular velocity

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 44


Feedback Control

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 45


Feedback Control

If we assume:

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 46


• End of Differential equations
• Next Lecture
– Other types of MoC

Embedded and Real-Time Systems, Spring 2025, SBU, Tehran, Iran 47

You might also like