We still have two basic op-amp circuits to talk about. The problem is these two circuits have names associated with math terms. As usual I am going to do everything backwards. Math is normally taught before a reason is given to understand the math. But no, I can’t do it that way. So…we are going to be given a reason first, and then a “good-ole” boy version of the math, followed by the circuit that can do the math. We are going to take the scenic trip — A long leisurely drive along the back roads look at the view along the way.

We are going to “rough out” a cruise control for an automobile. By “rough out” we are not going to actually design one, but we will consider the building blocks to do the job. Since I know of no way to get an actual automobile through the computer, our first step to reach common ground is to create an acceptable model for an automobile for us to use in developing this concept. And now it is time to take our first small detour.

For all of the modelling in the next few posts I will be using spreadsheets. I will be posting a link to the spreadsheet file and the file will be in Microsoft Excel format. The program I used to create the spreadsheet was LibreCalc which is part of the LibreOffice program. The reason I use the .xls format file is LibreOffice will import it, but I have not had much luck with Excel importing LibreOffice .ods files and the goal of this blog is to be as universal as possible. If your computer does not have an office spreadsheet program on it, I suggest downloading LibreOffice from their site: LibreOffice.org. I dedicated a whole post to why I am a big fan of open source software in an earlier post.

The file I have uploaded to this site associated with this post is called PID.xls. This post will be a lot more understandable if you download that file. Once you download the file, you will find two tabs. The first one is called “sheet1” and is pictured to the left. The second tab is Graph and is where the graphs are generated to create the other pictures on this and the future posts. The general layout of the spreadsheet is the top row contains the variables we can change. These variables are called coefficients because they are used to as multipliers to all of the rest of the formulas. The name of the coefficient is given first followed by a yellow square which contains the coefficient value. If you download the spreadsheet, I encourage you to “play with” those values.

The values in the 2nd row are then names of the columns. The first column is time in seconds. We are now working in the digital world and we are going to try to simulate something in the real, analog, world so our first decision is how often are we going to sample. Unless we make a very very slow car once a second is probably too long, and 100 times per second would create a very large spreadsheet so I chose 0.1 second sample rate. In real life that is pretty much the same methodology used…. or in my vernacular…. “that ought ta do it”. There are some rules, but this is good enough.

The second column is named “gas pedal”. I probably should call this “throttle” or “accelerator position”, but gas pedal is the most common term here in USA. This will have a number from 0 to 100 representing the percent the pedal is pressed. 100 is “the pedal is to the metal” or full on with the car “burning rubber” and the G forces pressing you back in your seat or in the case of most of the cars I drive, the engine is making a lot of noise, but I am not impressing anyone. (Stock worn-out Honda Civics are not much of a “babe magnet”.) As you can see in the model before 0 seconds the pedal is not depressed but at t=0 it is launch time and the pedal is depressed to the floor. The best way to think of what this number represents is “thrust” or force exerted on the car to get it moving.

Another DETOUR: There are a couple of things about this model that are not real, but the results will be very close to reality. First, in comparison to a real car, there are no gears. If you want to imagine it this way, we are about to drive a rocket car. A very slow rocket car, but a rocket car. Second non-reality is the accelerator pedal position is exactly proportional to the force generated. This is not the case in reality because the force generated depends upon engine speed. We could always add the extra complications to get a better model once we understand the basics. The final detour is I did not worry about scaling factors and units. I played with the numbers so I got values that came out reasonable with final speed in MPH. (KmPH would work too.) However, the mass and the force are just numbers. We could back calculate to give those real values…. but why?

The third column is acceleration and is calculated using the equation Force = Mass X Acceleration. The equation used was A=F/M. The equation is straight out of the physics book. The fourth column is speed. Speed is calculated for each time period as the average acceleration X the sampling time + the speed the car was going before this period. The plot to the right shows the calculations to this point. Obviously, not a very real model yet.

Now we add the final calculation to develop our car model. Air friction is proportional to the wind speed and in the case of a car “wind speed” is primarily the speed of the car going through the air. The column wind resistance in the spreadsheet is calculated by multiplying the speed of the previous sampling time period X a magic number I called Aero Coeff. The reason I used the previous sampling period in this calculation is this force is subtracted from the gas pedal force to calculate the acceleration. If I used the present time period I would have a “circular calculation” and the program would have given me an error.

I set Aero Coeff to 1 so when the car reaches 100 MPH the wind resistance equals the force generated by the gas pedal position position. At this point the car no-longer accelerates. The maximum speed for this car is 100 MPH. (or 100 KmPH if you prefer.) If we wash and wax the car it will go faster because we reduced wind resistance. If we increase the force generated by the rocket from 100 to 110 the car will go faster because we have more force available.

If you notice the graph we have exactly the same shape curve as the voltage across a capacitor while it is charging. One you understand electricity you know it all! (Well sorta.) The form of the equation is exactly the same as a capacitor in a series RC circuit. Of course the scaling factors are much different.

This has been a fairly complicated post. I hope my joking made it a little more tolerable. I did what I call the “shuck and jive” about the scaling factors but if we trying to model a real car those would be very important. I am attaching a video to show how important those can be. The story is a myth…. but still a good one.

Gary

If you enjoyed this post and learned a little please consider subscribing using one of the methods on the home page or the e-mail subscription form at the bottom of every page.

[…] the car and the cruise control, you will be lost at this point and you need to go back to “Understanding why cars reach a maximum speed” and read the posts up to this one. Tonight I introduce the inverse function to the integral, […]

[…] ← Previous […]