5. Consider a rotating robot where you can control the angular velocity around a fixed axis.
(a) Model this as a system where the input is angular velocity θ˙ and the output is angle θ. Give your
model as an equation r
...
5. Consider a rotating robot where you can control the angular velocity around a fixed axis.
(a) Model this as a system where the input is angular velocity θ˙ and the output is angle θ. Give your
model as an equation relating the input and output as functions of time.
Solution:
∀ t ∈ R, θ(t) = θ(0) +Zt
0
θ˙(τ)dτ,
where θ(0) is the initial position.
(b) Is this model BIBO stable?
Solution: The model is not BIBO stable. For example, the input
θ˙(t) = u(t)
is bounded but yields an unbounded output.
(c) Design a proportional controller to set the robot onto a desired angle. That is, assume that the initial
angle is θ(0) = 0, and let the desired angle be ψ(t) = au(t), where u is the unit step function. Find
the actual angle as a function of time and the proportional controller feedback gain K. What is your
output at t = 0? What does it approach as t gets large?
Solution: A proportional controller has the same structure as the helicopter controller:
Just as with the helicopter controller, we can solve the integral equation to get
θ(t) = au(t)(1−e
−Kt).
The output at zero is θ(0) = 0, as expected. As t gets large, the output approaches a.
Lee & Seshia, Introduction to Embedded Systems, Solutions 11
3
Discrete Dynamics
— Exercises
1. Consider an event counter that is a simplified version of the counter in Section 3.1. It has an icon like this:
This actor starts with state i and upon arrival of an event at the input, increments the state and sends the
new value to the output. Thus, e is a pure signal, and c has the form c : R → {absent} ∪ N, assuming
i ∈ N. Suppose you are to use such an event counter in a weather station to count the number of times that
a temperature rises above some threshold. Your task in this exercise is to generate a reasonable input signal
e for the event counter. You will create several versions. For all versions, you will design a state machine
whose input is a signal τ : R → {absent} ∪Z that gives the current temperature (in degrees centigrade)
once per hour. The output e : R → {absent,present} will be a pure signal that goes to an event counter.
(a) For the first version, your state machine should simply produce a present output whenever the input
is present and greater than 38 degrees. Otherwise, the output should be absent.
Solution: This state machine does not require more than one state:
/output
(b) For the second version, your state machine should have hysteresis. Specifically, it should produce a
present output the first time the input is greater than 38 degrees, and subsequently, it should produce
a present output anytime the input is greater than 38 degrees but has dropped below 36 degrees since
the last time a present output was produced.
17
SOLUTIONS
Solution:
(c) For the third version, your state machine should implement the same hysteresis as in part (b), but
also produce a present output at most once per day.
Solution: Note that this problem statement is ambiguous. What is meant by “at most once per
day?” Is it OK to produce a present output at 11 PM and again at 1 AM? Or does it mean that at
least 24 hours should elapse between present outputs? Either would be correct, given the problem
statement. Here is a solution under the second interpretation:
Note that with this solution, if the temperature stays high for several days, there will nonetheless
be no present output for those several days. Is this likely to be what we intended? The problem
appears to ask for this behavior, but it is probably not the behavior we want.
18 Lee & Seshia, Introduction to Embedded Systems, Solutions
SOLUTIONS
3. Consider the following state machine:
Determine whether the following statement is true or false, and give a supporting argument:
The output will eventually be a constant 0, or it will eventually be a constant 1. That is, for
some n ∈ N, after the n-th reaction, either the output will be 0 in every subsequent reaction, or
it will be 1 in every subsequent reaction.
Note that Chapter 13 gives mechanisms for making such statements precise and for reasoning about them.
Solution: TRUE. In an infinite execution, if the transition from A to B is ever taken, then after that
point, the output will always be 0. If that transition is never taken, then the output will be a constant 1
for the entire execution. This too is allowed behavior for the state machine.
20 Lee & Seshia, Introduction to Embedded Systems, Solutions
3. DISCRETE DYNAMICS
7. Consider the state machine in Figure 3.2. State whether each of the following is a behavior for this
machine. In each of the following, the ellipsis “··· ” means that the last symbol is repeated forever. Also,
for readability, absent is denoted by the shorthand a and present by the shorthand p.
(a) x = (p, p, p, p, p,···), y = (0,1,1,0,0,···)
(b) x = (p, p, p, p, p,···), y = (0,1,1,0,a,···)
(c) x = (a, p,a, p,a,···), y = (a,1,a,0,a,···)
(d) x = (p, p, p, p, p,···), y = (0,0,a,a,a,···)
(e) x = (p, p, p, p, p,···), y = (0,a,0,a,a,···)
Solution:
(a) no
(b) yes
(c) no
(d) yes
(e) no
[Show More]