Skip to main content

Analyze and Simulate Control Systems in Wolfram|Alpha

Wolfram|Alpha Blog

What do your alarm clock, thermostat, coffeemaker, car radio, anti-lock brakes—and almost every other electrical and mechanical device you encounter in your daily life—all have in common? They are all examples of "control systems," one of the most ubiquitous yet unseen modern technologies. A control system is any system or device that controls or regulates the behavior of another system. Using various kinds of sensors and actuators, these systems automatically control most common appliances, industrial processes, and even your body's own biological processes!

Take your home's humble thermostat. The temperature of your home depends on many factors, especially how long and how recently the home's furnace was on. With a thermostat installed, the reverse is also true: the state of the furnace depends on the temperature of the house (it comes on if the temperature is too low, and turns off if the temperature is too high). There is a closed loop of causation formed between the home's temperature and the state of the furnace. By design, the thermostat creates a kind of closed loop called a "negative feedback loop," which tends to stabilize the temperature around a desired value. Most control systems are like this: sensors feed information back into the system, which is then used to decide on an action.

In Version 8 of Mathematica, we added lots of functions that analyze, design, and simulate a variety of systems, including control systems. We have now incorporated these capabilities into Wolfram|Alpha with the ability to understand some common systems by name.

A simple example is the integrator. An integrator is a system that accumulates the values of some input over time. For example, the amount of gas your car has used since you last filled up is basically an integral of the position of the gas pedal over that time. Put another way, gas is consumed at a rate proportional to how far the gas pedal is depressed. Typing "control system: integrator" into Wolfram|Alpha gives a list of properties, graphs, and an interactive response plot where you can see what happens to the output for several common inputs:

control system: integrator

Another standard type of control system Wolfram|Alpha knows about is the PID controller. Usually in the form of a programmable microchip, a PID controller can electronically control something based on the value (or a proportion of the value), the total accumulation (integral), and the rate of change (derivative) of some quantity. Type "PID controller," and Wolfram|Alpha gives you a custom "calculator" that allows you to vary the strength of the proportional, integral, and derivative "gains" and shows how these variations affect the properties of the controller:

PID controller

In addition to this repertoire of standard control systems, which we will be expanding in the near future, Wolfram|Alpha can also understand and analyze custom systems, specified using either state space or transfer function models. These models provide a general framework to mathematically describe the input-output behavior of systems and are commonly used to model a complex process, whether a natural phenomenon, a control system, or something else. Wolfram|Alpha is equipped to handle both continuous- and discrete-time systems modeled using this framework.

In a state space model representation, variables are related to each other using ordinary differential equations. Some of these variables are the "input," others are the "output," and some are just internal to the system, called "state" variables. Wolfram|Alpha uses the standard convention, in which input variables are denoted by u, output variables by y, and state variables by x. As of this writing, Wolfram|Alpha can only analyze linear state space models, which are expressible as a system of vector differential equations:

x′(t) = Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)

…where A, B, C, and D are matrices of complex numbers. For example, "A: {{1,0},{1,-1}} B: {{0.2},{1}} C: {{-1.3,1}} : response to the input u[t] = sin(8t)" shows what the state vector x does when this system is fed the input sin(8t):

A: {{1,0},{1,-1}} B: {{0.2},{1}} C: {{-1.3,1}} : response to the input u[t] = sin(8t)

The other way to represent a control system is with a transfer function. A transfer function is a ratio of U(s), the Laplace transform of the input u(t), over Y(s), the Laplace transform of the output y(t). In general, a transfer function is an n-by-m matrix of functions, where n is the number of outputs and m is the number of inputs.

Using either transfer function or state space inputs, you can specify a discrete model by entering a nonzero sampling period, such as 0.2:

transfer function : (s-3)/(-s^2-s+1) sampling=.2

You can also ask about specific properties or groups of properties. For example:

Bode plot of the transfer function {1/s, (s-3)/(-s^3-s+1)}

observability of the control system given by state: {{0,1,0},{0,-2,1},{1,-1,0}} input: {{0},{0},{1}} output: {{0,1,0}}

Experiment by creating your own control systems or just play around with a standard system like the PID controller. You now have all the tools you need to analyze and test them. Whether you are a engineering student or someone trying to solve the world's pressing problems, we hope this new feature will make controlling things a little easier.

Sent with Reeder

Comments

Popular posts from this blog

Rumor Mill: New mac Mini Coming?

There are reports all over the Internet about a new Mac Mini to be possibly released at MacWorld.  TUAW is reporting that a new version of the Mini will include an optical drive that can be swapped for a second hard drive.  The housing will look much like the Time Capsule with a "lip" for consealing the optical dive slot and cooling. Whether true or not, I would like to see a few features in a new Mac Mini. More RAM (Of course.) NVIDIA chipset. FW port for external HD My main use for a Mini would be for media.  A Mini on my network using Front Row would be great for movies and TV.  (Sorry, Apple TV.)

Calculate Age or Years Elapsed in an Apple Numbers Sheet

Often it is useful to show a person's age or years elapsed since a start date.  For example: Hire Date: 4/1/2012 - Years of service: 1.5 Here's a formula for Numbers that will do the trick: =IF(ISBLANK(cellReference),"",DATEDIF( cellReference ,TODAY(),"D")/365.2425) Replace the cellReference with the actual cell reference. i.e.: (A1)  So here's the breakdown: =IF(ISBLANK(cellReference),""  --- this checks to see if there is a start date in your referenced cell.  For example say your spreadsheet has a cell (A1) that holds a date of birth, but it is not yet referenced, this will result in an empty string. (Blank cell) Otherwise, it calculates the years:  DATEDIF( cellReference ,TODAY(),"D")/365.2425) DATEDIF compares two dates. The first date is your cell reference i.e.: (A1) The second is the current date according to your computer, iOS device: TODAY()  returning the Day -  "D" Then the difference is divi...

Acid3 Test

I did an Acid3 test with a few browsers and these are the results I got.  For those unfamiliar, as I understand it, Acid3 is a test to see how compliant a browser is with current standards with the W3C . Browser # 1: Chrome by Google.  Running under Windows Vista Home on my Mac in VMWare. 79/100 Not bad for a new browser.  I'll be curious to see what the Mac version will do when it comes out. Browser #2: Firefox v.3.0.1 Mac OS X 10.5.4 71/100 Not as good as Chrome, but I have a PILE of extensions on Firefox. Browser #3: Safari 3.1.2 Mac OS X 10.5.4 75/100 Better than Firefox but still lower than Chrome. My take is overall they seem to perform about the same but I'll stick with Safari for now.  I use Firefox for much of my web browsing, but Safari is fast becoming a close second. Someday, maybe I'll test Opera too. Cheers!