CS452 - Real-Time Programming - Winter 2013

Lecture 20 - Task Structure (Anthropomorphic Programming)

Pubilc Service Annoucements

  1. First train control demo: 7 March.
  2. Your routing should be able to find routes that require reversing.
  3. Exam: 16.00, 11 April to 18.30 12 April.

Calibration

1. Calibrating Stopping Distance

2. Calibrating Constant Velocity

3. Calibrating Acceleration and Deceleration: Minimal

4. Calibrating Acceleration and Deceleration: Doing Better

Back to real trains. When you drive a train there are four things you care about, all of which are functions of time. Particularly you care about the effects of discontinuities in them.

  1. Location on the track, specified by x(t), usually anchored at the previous sensor.
  2. Velocity along the track, specified by v(t) = x'(t).
  3. Acceleration, specified as a(t) = v'(t) = x''(t).
  4. Jerk, specified as j(t) = a'(t) = v''(t) = x'''(t)

Modelling Velocity

When we model there are two distinct, but easy to confuse, things we care about:

  1. where the train is on the track, and
  2. where the train is in your model.

Ideally these two quantities would be exactly equal. So our goal is to minimize something like the absolute value of the difference, or the squared difference between them.

Lemma. Whoever programmed the micro controller in the train knows a lot about trains, not much about computer science, and is lazy.

How does the location change over time if the velocity is constant.

Allow there to be an infinite acceleration (= force)

Then at the right time, whenever that is, change the velocity in your model of the train

  1. From the initial velocity to the final velocity.
  2. From the initial velocity to an intermediate velocity to the final velocity.

Allow there to be an infinite jerk


Servers and Attendant Tasks

Why do servers need attendant tasks?

1. Proprietor with a Notifier

Proprietor `owns' a service, which usually means a resource.

Kernel is handling hardware in this example

Notifier Code for a UART

Proprietor/Notifier Code for a UART

Notes

  1. Notifier is usually of higher priority than server
  2. When, and how, do interrupts get turned on and/or cleared?
  3. Who coordinates hardware ownership?
  4. We have made the code

2. Using a Courier

Simplest is best

Transmit Notifier Code

Transmit Courier Code

Transmit Proprietor Code

Notes

This gets you through a bottleneck where no more than two events come too fast.

Remember that all the calls provide error returns. You can/should use them for error recovery

Another possible arrangement for task creation

Another possible arrangement for initialization

Distributed gating

I am showing you collections of tasks implemented together because sets of related tasks is a level of organization above the individual task.

E.g., the decision to add a courier requires revision of code within the group, but not outside it.


Return to: