chapter 4 companion and outline
This page contains companion resources and an outline for chapter 4 of the book An Introduction to Real-Time Computing for Mechanical Engineers, and it therefore lacks most of chapter 4’s contents. While some sections of the book are fully available on this site, many are not. Please consider purchasing a copy from the MIT Press.
Motor control, finite-state machines, and waiting for real-time computing
We have made significant progress toward solving the design problem presented in section 1.9. Of the four functional requirements R1–R4, we have solved R1 (user input) and R2 (user display) by writing C functions for the keypad and display user interface (UI) devices in chapter 1, chapter 2, chapter 3. Along the way, we have learned a great deal about real-time computing, algorithms, digital communication, and programming in C. Solving the remaining two functional requirements, R3 and R4, will be the focus of the rest of the book:
These two requirements involve the speed and position control of the target rotational mechanical system. The target computer must control the mechanical system by doing the following tasks:
- Actuating its motion through an electrical system coupled to the mechanical system through a motor
- Measuring its motion with an encoder sensor
- Adjusting the actuation with feedback control techniques
Approaches to the first two tasks are presented in this chapter through wait-based timing and open-loop control. The third task requires greater understanding of feedback control and advanced timing, which will be explored in chapter 5, chapter 6, chapter 7, chapter 8.
Wait-based timing is the regulation of timing by waiting some more-or-less fixed duration at specific moments in our program. Open-loop control is the technique of applying an input to a system to achieve some output that is predicted by a system model. The limitations of these real-time computing and control techniques will motivate the techniques of the chapters that follow.
The first two tasks given here, actuating and measuring the motion of the target motor, will be achieved in this chapter. The dynamics of the motor must be modeled if we are to use it to control the motion of the electromechanical subsystem. A linear model is developed in section 4.1. In chapter 7, chapter 8, we will make extensive use of this model for feedback control. For now, the model is used only for open-loop control and for understanding the electrical side of the electromechanical subsystem. The electrical system is considered extensively in section 4.3, where we learn how to drive DC motors, and ours in particular. In section 4.4, we consider how to measure the position and velocity of the motor shaft with an encoder.
As you may have noticed, the complexity of our system is growing. The target computer is already handling the user interface, and in this chapter, it will control the actuation and measurements associated with the electromechanical subsystem. A useful way to organize all this is with a system model called a “finite-state machine (FSM)”, introduced in section 4.5. An FSM models the behavior of a system as a finite number of states and transitions thereamong. In lab 4, we will use an FSM model to implement a basic motor control scheme.
The chapter concludes in section 4.6 with a discussion of the simple real-time computing technique of waiting used in lab 4 to govern timing. This will give us an opportunity to better understand how a processor handles task scheduling, and to set up our further consideration thereof in chapter 5.
Modeling the Electromechanical Subsystem
Open-loop control and the step response
Driving PMDC motors
Measuring motor position and velocity
Finite state machines
Waiting for real-time computing
Summary
Problems
Finite state machine and open-loop control
Online resources for Chapter 4
No online resources.