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

Do You Need to Defragment a Mac’s Hard Drive?

--> Do You Need to Defragment a Mac's Hard Drive? About Focus on Macs In my mailbag this week, I found a couple of questions about defragmenting a Mac's hard drive. This question usually comes from new Mac users, or individuals who switch to the Mac from the Windows environment, where disk defragmentation utilities abound. Some individuals want to know which third-party disk defragmentation app they should use, or wonder why there is no defrag tool in OS X. Courtesy of Apple OS X does have disk defragmentation capabilities, but they're built into the system rather than a separate tool. Since OS X 10.2, Apple has included automatic defragmentation in the Mac OS. In essence, the Mac OS has built-in safeguards that attempt to prevent file fragmentation from occurring; it's also able to repair fragmentation, should it occur. This means that for the average Mac user, there really is no reason to worry about disk defragmentation, at least not as ...

Learn To Code

Even if just to get a better understanding of how computers work or learning how to customize your browsing experience, knowing the basics of coding opens ones eyes to possibilities once only known by a few.  Learn To Code Planet Cocoa If learning to program is even a minor goal for you,  Code Year (via  Brent Simmons ) might be just the encouragement you need. They promise to email you on a weekly basis with coding lessons to help you achieve your goal. I'm one of those computer programmers who downplays the difficulty of the profession, because "if I can do it, anybody can do it!" On the other hand, I have faced challenges that made me question whether I'm vaguely qualified for the job. What it boils down to is that programming is both incredibly simple and impossibly hard, like so many important things in life. There was a time when nobody knew how to write literary prose. The geniuses who invented it shared their special tool with a ...

Tips: Delete duplicate entries in "Open With..." dialog in Finder

Duplicates!!! When you control+click (or right click if you have enabled that option) on Mountain Lion, and there seems to be several duplicate applications listed and/or apps you no longer use, here is a Terminal shell script that will fix that.  Just copy and paste the code below in a Terminal window. /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user (Terminal can be found using Launchpad or Spotlight) After pasting, hit the Return key and allow time to run, then type "killAll Finder" without the quotes, and Return.  This will rebuild the "Open With..." menu.   If you do not see an immediate effect on the lists, restart your Mac.   Should be no need to restart. (Thanks, JK) Duplicates and old apps gone! If you wish, you can make a Service that will do it using Automator as well: Open Automator (Launch Pad or Applications folder) Create...