Week 1: System Identification

Post Reply
goodwine
Site Admin
Posts: 1596
Joined: Tue Aug 24, 2004 4:54 pm
Location: 376 Fitzpatrick
Contact:

Week 1: System Identification

Post by goodwine »

The main purpose of this week is to use the pendulum apparatus to determine the transfer function from the duty cycle to the pendulum position. Secondary purposes are to become familiar with the coding environment, downloading and running code, modifying the code and using the digital logic analyzer.

Each group should have their own account on the computer that is connected to the experimental apparatus. There are three main programs you will use: the ImageCraft compiler, the Technological Arts bootloader and the logic analyzer. There should be a shortcut for each of these on the desktop. If there aren't, then create them.

This week, all of the experiments are on the pendulum when it is not inverted, i.e., it is pointing down. The first experiment involves only using the logic analyzer. Without any program running in the microcontroller, move the pendulumt to various starting angles and capture the response of the system, which will be decaying oscillations. If you relate this to the linearized pendulum equation, you should be able to determine some of the physical parameters of the system -- probably the natural frequency, the damped natural frequency and the damping ratio. Capture data for several different starting angles and use one or some of them to determine the parameters and then compare the theoretical model to the other ones. There is a chapter in the course notes called "System Identification" that contains an description of the process that you should use.

The second task is to command a step input to the system and record the response from which you should be able to determine the transfer function from the input to the position of the pendulum. To do this you will need to copy some code that I've made available. Copy from the Shared Documents folder on the computer to your own directory everything in the directory called System Identification. Do not simply open it using the compiler since it will modify the original code as opposed to your own copy. You will need to create a "new project" in the compiler and add the programs and header files to it. Once you can successfully compile it, you need to download it to the microprocessor using the Technological Arts bootloader. If you do not modify the code at all, when you run it it will ask you to hit the OK button, and when you do, the pendulum should swing slightly to the right (counter-clockwise).

The code is organized into three files: pwm.c, lcd.c and main.c as well as one header file. I plan to further streamline and organize the code this week, but the way it is currently organized will suffice for this week. The last function in main.c is main(), most of which should be self-explanatory. Near the end of it is a function call that is CW(600) or CCW(600). This is the command to the motor, and they stand for clockwise and counterclockwise, respectively. The 600 is the duty cycle, which I believe has a maximum value of 2048. You should capture data for a couple different duty cycles and for both directions for your system identification and validation experiments. If you change the 600, be sure to do so incrementally and carefully. If you put in a value that is too large, it may be possible to break the pendulum. Someone should always be ready to physically grab the pendulum too, if the system looks like it's going berserk.

As the code is currently written, the only way to stop it is to hit the reset button on the microprocessor. Modify the code so that a user can hit one of the buttons on the LCD box to stop it. If you want to work ahead, you can also modify the code so that the current angle is displayed on the screen, but that is not necessary for this week. Such modifications will require you to study the code that is provided to figure out how to appropriately modify it.

Each week you will submit a draft section of what will be the final report. This week's draft should include, at a minimum,
  1. a theoretical derivation of the equations of motion and the linear approximation to that equation for small motions;
  2. the computations for the identification of the system parameters, both for the free swinging case as well as the response for the step inputs;
  3. a comparison of the theoretical response using the parameters identified with the actual response for both the linear and nonlinear cases; and,
  4. the transfer function for the inverted pendulum, determined from the experiments carried out this week.
Bill Goodwine, 376 Fitzpatrick
Post Reply

Return to “Pendulum Project”