代写代考 Embedded Computer Systems

Embedded Computer Systems
Dr. Sanghyuk Lee
Email: Dept. Mechatronics and Robotics

Copyright By PowCoder代写 加微信 powcoder

Modelling summary
• The dynamics of a system is its evolution in time: how its state changes. A model of a physical system is a description of certain aspects of the system that is intended to yield insight into properties of the system. It has models have mathematical properties that enable systematic analysis.
• A model is itself a system. It is important to avoid confusing a model and the system that it models. These are two distinct artifacts. A model of a system is said to have high fidelity if it accurately describes properties of the system. It is said to abstract the system if it omits details. A major goal is to develop an understanding of how to use models, of how to leverage their strengths and respect their weaknesses.
• Model of CPS normally include all three parts; models need to represent both dynamics and static properties, model of a CPS need not have both discrete and continuous parts, purely discrete (or purely continuous) model to have high fidelity for the properties of interest.

Continuous Dynamics
• Motion of mechanical parts can often be modeled using differential equations, or equivalently, integral equations.
• It only work well for “smooth” motion. For motions that are not smooth, such as those modeling collisions of mechanical parts, we can use modal models that represent distinct modes of operation with abrupt.
• Model of a system in the form of ordinary differential equations (ODEs).
It can be shown how these ODEs can be represented in actor models, which include the class of models in popular modeling languages such as LabVIEW and Simulink . We then consider properties of such models such as linearity, time invariance, and stability, and consider consequences of these properties when manipulating models.

Newtonian Mechanics
Modeling position with six degrees of freedom: pitch, roll, and yaw, in addition to position.

Newtonian Mechanics; continue
position information comes from 𝐅𝐅 𝑡𝑡 = 𝑀𝑀𝑥𝑥̈(𝑡𝑡), by integration and initial conditions;
𝑥𝑥 𝑡𝑡 = 𝑥𝑥 0 + 𝑡𝑡𝑥𝑥̇ 0 + 𝑀𝑀 � � 𝐅𝐅 𝛼𝛼 𝑑𝑑𝛼𝛼𝑑𝑑𝑑𝑑 00
The versions of these equations of motion that affect orientation use torque, the rotational version of force. It is again a three-element vector as a function of time, representing the net rotational force on an object.
𝐓𝐓𝑡𝑡 =𝑑𝑑𝑡𝑡 𝐼𝐼𝑡𝑡𝜃𝜃𝑡𝑡 ,𝐓𝐓𝑡𝑡 =𝐼𝐼𝜃𝜃(𝑡𝑡)

Newtonian Mechanics; continue
𝑇𝑇(𝑡𝑡) 𝐼𝐼 (𝑡𝑡) 𝐼𝐼 (𝑡𝑡) 𝐼𝐼 (𝑡𝑡) 𝜃𝜃̇(𝑡𝑡) 𝑥𝑥 𝑑𝑑 𝑥𝑥𝑥𝑥 𝑥𝑥𝑦𝑦 𝑥𝑥𝑧𝑧 𝑥𝑥
𝐓𝐓 𝑡𝑡 = 𝑇𝑇𝑦𝑦(𝑡𝑡) = 𝑇𝑇𝑧𝑧(𝑡𝑡)
As the same way,
𝜃𝜃 𝑡𝑡 = 𝜃𝜃 0 + 𝑡𝑡𝜃𝜃 0 + 𝐼𝐼 � � 𝐓𝐓 𝛼𝛼 𝑑𝑑𝛼𝛼𝑑𝑑𝑑𝑑
Using these equations, if you know the initial orientation and initial rotational velocity of an object and the torques on the object in all three axes as a function of time, you can determine the rotational acceleration, velocity, and orientation of the object at any time.
𝐼𝐼𝑦𝑦𝑥𝑥(𝑡𝑡) 𝐼𝐼𝑦𝑦𝑦𝑦(𝑡𝑡) 𝐼𝐼𝑦𝑦𝑧𝑧(𝑡𝑡) 𝜃𝜃̇ (𝑡𝑡)
𝐼𝐼𝑧𝑧𝑥𝑥(𝑡𝑡) 𝐼𝐼𝑧𝑧𝑦𝑦(𝑡𝑡) 𝐼𝐼𝑧𝑧𝑧𝑧(𝑡𝑡) 𝜃𝜃̇ (𝑡𝑡) 𝑧𝑧

(a) Helicopter model with separately controlled torques for the top and tail rotors.
(b) Transformation to an equivalent model (assuming K > 0).
(c) Further transformation to an equivalent model that we can use to understand the behavior of the controller.

• For the helicopter model (a), it has two inputs, 𝑇𝑇𝑡𝑡 and 𝑇𝑇𝑟𝑟, the torque due to the top rotor and tail rotor respectively. The feedback control system is now controlling only 𝑇𝑇𝑡𝑡 and 𝑇𝑇𝑟𝑟 is treated as an external (uncontrolled) input signal.
• Equivalent structure are given in (b) and (c)

Discrete Model
• The state y(t) of the Integrator at time t is a real number. Hence, we say that the state space of the Integrator is States = R. For the Counter in below, the state s(t) at time t is an integer, so States ⊂ Z. Hence non-negative number M of spaces, so the state space for the Counter actor used in this way will be States = {0, 1, 2, · · · , M}

Discrete Model
• A state machine is a model of a system with discrete dynamics that at each reaction maps valuations of the inputs to valuations of the outputs, where the map may depend on its current state. A finite-state machine (FSM) is a state machine where the set States of possible states is finite.
• If the number of states is reasonably small, then FSMs can be conveniently drawn using a graphical notation in Figure. Here, each state is represented by a bubble, so for this diagram, the set of states is given by States = {State1, State2, State3}.
At the beginning of each sequence of reactions, there is an initial state, State1, indicated in the diagram by a dangling arrow into it.

Discrete Model; transition
• Transitions between states govern the discrete dynamics of the state machine and the mapping of input valuations to output valuations. A transition is represented as a curved arrow, going from one state to another. A transition may also start and end at the same state, as illustrated with State3 in the figure. In this case, the transition is called a self transition.
• Transition from State1 to State2 is labeled with “guard/action.” The guard determines whether the transition may be taken on a reaction. The action specifies what outputs are produced on each reaction.
• A guard is a predicate (a boolean-valued expression) that evaluates to true when the transition should be taken, changing the state from that at the beginning of the transition to that at the end. When a guard evaluates to true we say that the transition is enabled. An action is an assignment of values (or absent) to the output ports. Any output port not mentioned in a transition that is taken is implicitly absent. If no action at all is given, then all outputs are implicitly absent.

Discrete Model; example

Discrete Model; example
• Air conditioning (HVAC) systems. Accurate models of temperature dynamics and temperature control systems can significantly improve energy conservation. Such modeling begins with a modest thermostat, which regulates temperature to maintain a setpoint, or target temperature. The word “thermostat” comes from Greek words for “hot” and “to make stand.”
• Consider a thermostat modeled by an FSM with States = {heating, cooling} as shown in Figure. Suppose the setpoint is 20 degrees Celsius. If the heater is on, then the thermostat allows the temperature to rise past the setpoint to 22 degrees. If the heater is off, then it allows the temperature to drop past the setpoint to 18 degrees. This strategy is called hysteresis. It avoids chattering, where the heater would turn on and off rapidly when the temperature is close to the setpoint temperature.
• There is a single input temperature with type R and two pure outputs heatOn and heatOff. These outputs will be present only when a change in the status of the heater is needed

Hybrid Model
• each state refinement has a clock, which is a continuous-time signal 𝑠𝑠̇ 𝑡𝑡 = 1.
• initial state, written as 𝑠𝑠 𝑡𝑡 = 𝑇𝑇𝑐𝑐 . • Temperature 𝑑𝑑(𝑡𝑡)
• 𝑠𝑠 𝑡𝑡 ≥ 𝑇𝑇h ensures that the heater will always be on for at least time 𝑇𝑇h
• 𝑠𝑠 𝑡𝑡 ≥ 𝑇𝑇𝑐𝑐 specifies that once the heater goes off, it will remain off for at least time

Hybrid Model
• assume initial setpoint is over 20 degrees, so the FSM remains in the cooling state until the temperature drops to 20 degrees.
• At that time 𝑡𝑡1, turns on the heater. The heater will remain on until time 𝑡𝑡1 + 𝑇𝑇h, assuming that the temperature only rises when the heater is on.
• At time 𝑡𝑡1 + 𝑇𝑇h, it will transition back to the cooling state and turn the heater off.

Supervisory Control
• A control system four components: a plant; operating environment; the sensors; and the controller.
• The controller has two levels: supervisory control; low- level control.
• the supervisory controller determines which of several strategies should be followed, and the low-level controller implements the selected strategy.
• Hybrid systems are ideal for modeling such two-level controllers.
• automated guided vehicle (AGV) that moves along a closed track painted on a warehouse or factory floor. We will design a controller so that the vehicle closely follows the track.
• The vehicle has two degrees of freedom. At any time t, it can move forward along its body axis with speed u(t) with the restriction that 0 ≤ u(t) ≤ 10 mph. It can also rotate about its center of gravity with an angular speed ω(t) restricted to −π ≤ ω(t) ≤ π radians/second. We ignore the inertia of the vehicle, so we assume that we can instantaneously change the velocity or angular speed.

Supervisory Control
• Let(x(t),y(t))∈𝑅𝑅2bethepositionrelativetosomefixedcoordinateframeandθ(t)∈(−π,π] be the angle (in radians) of the vehicle at time t. In terms of this coordinate frame, the motion of the vehicle is given by
• 𝑥𝑥̇ 𝑡𝑡 = 𝑢𝑢(𝑡𝑡) cos 𝜃𝜃(𝑡𝑡), 𝑦𝑦̇ 𝑡𝑡 = 𝑢𝑢(𝑡𝑡) sin 𝜃𝜃(𝑡𝑡), 𝜃𝜃̇ 𝑡𝑡 = 𝜔𝜔(𝑡𝑡) describe the plant.
• Theenvironmentistheclosedpaintedtrack.Itcouldbedescribedbyanequation.Wewill
describe it indirectly below by means of a sensor.
– The vehicle always moves at its maximum speed of 10 mph.
– If the vehicle strays too far to the left of the track, the controller steers it towards the right
– If it strays too far to the right of the track, the controller steers it towards the left.
– If the vehicle is close to the track, the controller maintains the vehicle in a straight
direction.
– Thus the controller guides the vehicle in four modes, left, right, straight, and stop.

Supervisory Control
• ThefollowingdifferentialequationsgoverntheAGV’smotionintherefinementsofthefour modes. They describe the low-level controller, i.e., the selection of the time-based plant inputs in each mode.
𝑥𝑥̇ 𝑡𝑡 =10cos𝜃𝜃(𝑡𝑡) 𝑦𝑦̇𝑡𝑡 =10sin𝜃𝜃𝑡𝑡
𝜃𝜃̇ 𝑡𝑡 = 𝜋𝜋
• Straight
𝑥𝑥̇ 𝑡𝑡 =10cos𝜃𝜃(𝑡𝑡)
𝑦𝑦̇𝑡𝑡 =10sin𝜃𝜃𝑡𝑡 𝜃𝜃̇ 𝑡𝑡 = 0
𝑥𝑥̇ 𝑡𝑡 =10cos𝜃𝜃(𝑡𝑡)
𝑦𝑦̇𝑡𝑡 =10sin𝜃𝜃𝑡𝑡 𝜃𝜃̇ 𝑡𝑡 = −𝜋𝜋
𝑥𝑥̇ 𝑡𝑡 = 0 𝑦𝑦̇ 𝑡𝑡 = 0 𝜃𝜃̇ 𝑡𝑡 = 0

Supervisory Control
• Designing the supervisory control governing transitions between modes in such a way that the vehicle closely follows the track, using a sensor; it determines how far the vehicle is to the left or right of the track.
• With photodiodes, track is painted with a light-reflecting color, whereas the floor is relatively dark. The array is perpendicular to the AGV body axis. As the AGV passes over the track, the diode directly above the track generates more current than the other diodes. By comparing the magnitudes of the currents through the different diodes, the sensor estimates the displacement e(t) of the center of the array from the track. We adopt the convention that e(t) < 0 means that the AGV is to the right of the track and e(t) > 0 means it is to the left. We model the sensor output as a function f of the AGV’s position,
∀t, e(t) = f(x(t), y(t)).

Supervisory Control
• The function f of course depends on the environment—the track. We now specify the supervisory controller precisely. We select two thresholds, 0 < 𝜀𝜀1 < 𝜀𝜀2. • If the magnitude of the displacement is small, 𝑒𝑒(𝑡𝑡) < 𝜀𝜀1, the AGV is close enough to the track, and the AGV can move straight ahead, in straight mode. • If 𝑒𝑒 𝑡𝑡 > 𝜀𝜀2 (e(t) is large and positive), the AGV has strayed too far to the left
and must be steered to the right, by switching to right mode.
• If 𝑒𝑒 𝑡𝑡 < −𝜀𝜀2 (e(t) is large and negative), the AGV has strayed too far to the right and must be steered to the left, by switching to left mode. • The inputs are pure signals stop and start. These model an operator that can stop or start the AGV. There is no continuous-time input. The outputs represent the position of the vehicle, x(t) and y(t). The initial mode is stop, and the initial values of its refinement are (𝑥𝑥0, 𝑦𝑦0, 𝜃𝜃0). Supervisory Control Initially the vehicle is within distance 𝜀𝜀1 of the track, so it moves straight. At some later time, the vehicle goes too far to the left, ¬𝑠𝑠𝑡𝑡𝑠𝑠𝑠𝑠∧𝑒𝑒𝑡𝑡 >𝜀𝜀2
is satisfied(switch to right). When the vehicle will again be close enough to the track, so the guard
¬𝑠𝑠𝑡𝑡𝑠𝑠𝑠𝑠∧𝑒𝑒𝑡𝑡 <𝜀𝜀1 is satisfied(switch to straight). Some time later, the vehicle is too far to the right, so the guard ¬𝑠𝑠𝑡𝑡𝑠𝑠𝑠𝑠∧𝑒𝑒 𝑡𝑡 <−𝜀𝜀2 is satisfied(switch to left). See you in the next class (Feb 28th) 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com