Google Search
Login & Blog Feeds
Blogroll
Recent Comments
- Engineering, Control Systems and Statistics | Blog at ControlTheoryPro.com on Observations on Control System Modeling
- spradlig on MATLAB Pricing (Final Part in the Mathworks is behaving like Microsoft series)
- spradlig on MATLAB Pricing (Final Part in the Mathworks is behaving like Microsoft series)
- PointOnePA on MATLAB Pricing (Final Part in the Mathworks is behaving like Microsoft series)
- spradlig on Observations on Control System Modeling
Archives
- April 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
Categories
16th April 2009
When modeling real-world systems for control it is often necessary to deal with a realistic approximation of the noise and disturbances the system is likely to experience. For satellites with pointing systems this often means that a disturbance PSD is created or measured. This disturbance is modeled as a random process whose energy is described by the PSD. The PSD is applied to a State-Space model which represents the structural characteristics of the system - specifcally the characteristics of the transmission this disturbance energy to various portions of your system.
All of this starts with a PSD so we define a PSD class
classdef psdData
….
end
From here we define our properties, methods and events. Since this will be a stand-alone class for holding and manipulating data, there are no events. So what properties do we need?
- Bare Essentials
- Name: Name the PSD data
- Freq: Vector of Frequencies at which Magnitude data is captured
- Mag: Vector of Magnitudes measured
- RootPSD: Is this a a root PSD - in other words the units are something like rad/rt(Hz) instead of rad^2/Hz?
- Plotting Essentials
- UnitBaseMag: Base unit for magnitude measurements
- UnitBaseFreq: Base unit for frequencies at which magnitude measurements are captured
- PlotFreqUnit: Frequency Units desired on PSD Plot
- TimeUnit: The UnitBaseMag just holds a value like radians or degrees or m or ft. If the measured magnitude is a rate - rad/sec or m/sec then this holds that the TimeUnit is 1/sec
The reason the units are broken up into base and time portion is because we will be including methods to integrate and differentiate the PSD. In my industry rate PSDs are often the easiest to measure. As a result we often get rate PSDs (in rad/sec) but need an angular (position) disturbance PSD so we end up integrating the measured rate PSD. So it only makes sense to incorporate integration and differentiation into our class. I’ll deal with the methods in a later posting
Now that we have a list of properties we need to decide access priviledges. See a full list of Class Property Attributes here.
10th April 2009
I hardly used MATLAB 2008a and never installed 2008b because of the shear amount of time it required to solve all of the stupid little issues with Mathworks new installation procedure. I hate it and they should get rid of it. However, in MATLAB 2008a Mathworks introduced a huge change to their classes.
In some of my work creating classes makes a lot of sense. However, in previous versions building a class was an excrutiatingly slow and painful process requiring the developer to create a multitude of m-files for setting and getting properties, for displaying the data, and other basic infrastructure. In 2008a MATLAB came out with a new way of programming classes which - at least for small, simple classes - greatly reduces development time.
In MATLAB 2008a, many of the infrastructure m-files you used to have to build for classes disappeared. The entire class can be held in a single file if desired. This one file can contain properties, events and methods. For my purposes I usually end up with a few m-files containing helper functions for certain pieces of codes that are required in several places.
Over the course of the next several blog posts I’ll be going through an example of a class I built in about a day. I’ve also found that making tweaks is very easy since there are far fewer files to deal with and many changes made to methods take effect immediate without the need to destroy and recreate the instance of class you are testing.
The example class will be a class for holding and plotting PSD Data. Something very useful for Stochastic controls.
17th February 2009
I’ve had a hard time identifying good industry rules of thumb for conservative controls design. So I’ve started a category on the wiki named “Rules of Thumb”.
These rules of thumb should provide inexperienced controls engineers with guidelines to a good design. For experienced engineers, I hope we will find these rules of thumbs to be informative about how other industries design their systems. We may even find that another industry’s common practices make sense for our own.
Please add whatever rules of thumb your industry uses.
14th February 2009
Respect the Unstable
Back in August of 2003 I read an article in IEEE Control Systems Magazine titled “Respect the Unstable”, pp. 13-25, by Gunter Stein. The article made an immediate impression on me. The thrust of the article falls into what I call the “Controllers are Not Magic” category.
Most of the engineers I’ve worked with do not fully appreciate what controllers actually are. Nor do they fully understand what a controller can and cannot accomplish. So every so often I get requests for “Magic” in the form of “Don’t worry about Problem A, we can fix that with the controller.” Let me restate the obvious for anyone new to the controls field - Controllers are NOT Magic they manipulate physical systems and as such acquire the limitations of those systems.
The article by Dr. Stein provides an interpretation of the Bode Integrals as well as several examples of unstable systems.
The Bode Integrals
I’d put the equations here but I haven’t figured out how to do that in WordPress yet. So I’ve included a link the Bode Integrals on the wiki site here:
Bode Integrals in the Wiki
Here are my highlights from the article:
Basic Facts of Unstable Plants
Unstable systems are fundamentally, and quantifiably, more difficult to control than stable ones.
Controllers for unstable systems are operationally critical.
Closed-loop systems with unstable components are only locally stable.
and
The first integral applies to stable plants and the second to unstable plants. They are valid for every stablizing controller, assuming only that both plant and controller have finite bandwidths. In words, the integrals state that the log of the magnitude of sensitivity functionof a SISO feedback system, integrated over frequency, is constant. The constant is zero for stable plants, and it is positive for unstable ones. It becomes larger as the number of unstable poles increases and/or as the poles move farther into the right-half plane. (Technically, we must count all unstable poles here, including those in the compensator, if any.)
This is the equivalent of a conservation of energy for systems under control. The result being that to make a system less sensitive to disturbances in one frequency range the controlled system must become more sensitive in another frequency range (or all other frequency ranges).
In my current position we are often designing controllers to have good disturbance rejection at low frequencies while shooting for a minimum of peaking. The Bode Integrals make it obvious that low frequency disturbance rejection means more peaking in the higher frequencies. Sometimes the largest magnitude of the peaking can be reduced but that just means the peaking gets spread out in frequency. This observation of the Bode Integrals informs us of the limitations of controllers - we can’t have it all. So we now realize that our controller design is largely a matter of choosing the shape of our frequency response very carefully.
06th January 2009
Dec. was a rough month. I was working a lot of hours while juggling the various family obligations of the holiday season. Work has slowed down a lot - too much really - so I should have some time to post this week.
Now I just have to get my brain back on line so I can think of a topic. Feel free to suggest one in the comments area.
09th December 2008
Sorry to say this but my “real” job is going to take up most of my time for the rest of December. I’ve worked a lot of extra hours over the last couple of months. I will probably continue to work extra hours for the rest of December. (Right up to the end of my current program; most likely resulting in being laid off in Jan.)
As a result of the extra hours, I have to choose between time with my kids and time with my website. Sorry again but I’m choosing the kids. I’ll do my best to post as often as I can in the next couple of weeks.
03rd December 2008
Sensor Models
Given that sensors are vital to feedback systems I’ve included a bunch of sensor models. You can see the New Sensor Models by clicking the link.
I’ll be adding more in the future as i get the time.
29th November 2008
Source: http://cr4.globalspec.com/thread/29317#newcomments
Hello Members,
Please go through this BBC story of the Chinese built/launched communications satallite for the Nigerian government. Here http://newsvote.bbc.co.uk/2/hi/africa/7726951.stm
The satellite was launched about two years ago and it is confirmed packed up.
Apart from the indicated power problem, what could be other causes of the satellite failure?
Cheers,
ethobil
Observations
The BBC article stated that the Nigerian satellite
- … was limited because the type of frequency it used was disturbed by clouds in the atmosphere, and did not work properly in Nigeria’s rainy season or during the Harmattan, when clouds of dust blow down from the Sahara, he said.
- … also operated on frequencies already allocated to other companies and interfered with other providers’ equipment.
- … controllers shut the satellite down because it was having problems with its power supply, the government announced.
The observations in #1 and #2 are items that I learned to look out for before I graduated with my Bachelors.
Background for Observation #2: Operating a satellite on another satellite’s frequency is both extraordinarily rude and stupid. Interference from the satellite assigned that frequency will make both satellites useless for significant portions of their design life. Obviously this is to be avoided and there are agencies to regulate these frequencies.
Background for Observation #1: This is amatuer hour stuff. Anyone with satellite TV or satellite radio knows that weather interferes with transmissions. The thing is, the impact of weather can be minimized if not eliminated if you pick the correct frequency.
You may be asking why I addressed #2 first and then #1. The answer is this, Observaton #2 shows that the Nigerians didn’t do even the most basic homework and contact the proper authorities. Observation #1 reinforces this notion through an ignorance of basic satellite operations and limitations.
Observations #1 & #2 demonstrate that on the Nigerian customer (at least those in charge) didn’t know the first thing about what they were buying. Questions about operations, lifetime, and weather are pretty basic and I learned to ask those questions before graduating with my Bachelors.
The final Observation
Observation #3 is that the satellite was shut down for power problems. This could be something like a battery failure, power subsystem failure, solar array failure, or ADCS failure (which could point the arrays or the whole satellite the wrong way).
Given that the Nigerians didn’t do their homework - to know which frequency to use for their communications satellite, nor did they do enough homework to contact the correct regulatory agencies - before buying an expensive piece of hardware it only makes sense that they didn’t do their homework regarding system testing.
My guess is that the Chinese bid cheap re-using a satellite they designed for someone else. This is common practice to reduce cost and risk. But there are always custom changes when requirements change or new, updated hardware is added to the design. If you don’t test the integrated system properly the chances of failure are high. The Nigerian satellite was probably a recycled telecom satellite from another customer and some component of power system (like bateries) or the ADCS system (like attitude sensors or thrusters) was replaced.
An example of what I’m thinking…
An ADCS sensor, lets use a gyro for now, is replaced. The new sensor comes from the same manufactuerer with the same power, size, and mounting requirements. However, this new sensor provides its output in a different coordinate system such that 2 of the 3 axes (X & Y) are identical to the previous sensor but the 3rd axis (Z) is -1 of the original. Without thorough design effort and proper integrated system testing, this -1 is easy to miss. Then the whole satellite ends up pointed away from the sun and runs out of power.
The Nigerians missed the easy stuff, why would we assume they got the hard stuff, like proper testing, correct?
23rd November 2008
What finally worked
I have a quad core machine at my desk so I run multiple MATLAB windows. These multiple windows allowed me to test some distributed computing processes. As a result I set up a script for allowing the multiple windows to run. I was using Stateflow in the model which requires a compile before each run. As a result the model had to be run from a temporary directory.
This temporary directory was the first sign that the function, when distributed, is working. The second sign was when the output file is saved.
Long story short, the batch command worked. The batch command works but only with the PathDependencies and FileDependencies properties set. The function is something like this
jj = batch(’monte_sim_loop’, ‘matlabpool’, 0, ‘PathDependencies’, {…}, ‘FileDependencies’, {…});
The matlabpool set to 0 is important. I tried to using a matlabpool of 3 for my initial runs. It tied up 4 nodes but only run 1 instance of the sim. Then I created a loop
for ii = 1:15
jj = batch(…
end
The reason that a matlabpool of 3 tied up 4 nodes was that the matlabpool property is for how many additional nodes you want running. It originally appeared to be an overhead function that was created. A coworker discovered the matlabpool command already assumes 1 node and so anything higher than 0 ties up that many extra PCs for the 1 job task. Since I just want my jobs distributed (not parallel) I set the property to 0. When I ran the loop above, 15 computers were tied up and 15 nodes worth of results were produced.
If you know more, please share
I invite anyone and everyone who knows more about how to use the Parallel Computing Toolbox to share. Use the comments to share. Or if you like I welcome guest bloggers.
Thanks
Previous, related, posting
20th November 2008
Monte Carlo Runs
For work I’ve been asked to run a Monte Carlo analysis. The analysis is one where I vary a large set of parameters in a large Simulink simulation. Any given simulation will take between 40 minutes and a few hours. So obivously generating thousands of runs with a single computer would take months.
In the lead up to this analysis I asked a few questions. First, I found a bank of parallel computing resources at work. I asked them if it was possible and the answer was “Yes” with my take away being that it was doable and easy. It may be doable, it is not easy. Second, I went to Mathworks training (on modeling for aerospace system which had a session on parallel computing) and asked some questions about how to run parallel operations. I also left this session thinking it would be easy.
The online help is worthless
When you are running a model of any complexity there are a lot of parameters to set. If you are building models correctly you will be setting these parameters via variables not hard coding. This means that the simulation workspace must have all those variables.
The Mathworks help with regard to the Parallel Toolbox and Simulink simulations is pretty meager. One of the easiest means of distributing the simulation is through the use of the parfor keyword instead of the for keyword. The meager help suggests that simulation must be run from within a function because parfor requires a static workspace and Simulink creates variables in whatever workspace it runs from. So the help suggests using a dummy function as a wrapper for the sim command.
The help forgets to mention that running a simulation from a function’s workspace is simple - once you find that help but finding that help was a little buried. (If you want to know how look up the simset function and the SrcWorkspace and DstWorkspace properties.) I have run several simulations from within a function’s workspace on a single PC. However, doing so from within a dummy function called from a parfor loop doesn’t work like it does from a single PC. And the error messages are obtuse.
Obtuse Error Messages
I spent days attempting to get the simulations distributed to the various nodes. The error messages provided at this stage were reasonably straight forward. However, once the simulation was distributed to the nodes the error became far less useful. The first couple of times there was no obvious error. After digging through a long log file a cowroker found the errors and helped me fix them. That said, I think they were listed as warnings in the log file not errors.