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.

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.

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

MATLAB’s Parallel Computing Toolbox First Impression

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.

Next Post:  What finally appears to have worked

05th November 2008

I’m sorry for not posting this week.  I’ve been buried at work and I’ve picked up so many little web projects lately that I’ve spread myself too thin.

With any luck I’ll get back to posting 2 or 3 times a week next week.

I could use some help so I’d welcome any guest posters out there who know their stuff in controls or engineering in general.  I welcome any industry or academic experience.  I’d like the site to reflect more than just my own experiences.

Thanks for your patience.

Post tags:

23rd October 2008

Electro-Optical Sensors

Electro-Optical (EO) sensors are used in a wide variety of satellite applications.  EO sensors take light energy and turn it into electrical energy.  There are a variety of sensors that do this.  Some image while other provide the centroid of a spot of light.

Scientific imaging is largely done with CCDs.  FPAs can fill the same role as CCDs with many advantages (such as less noise and therefore sensitivity to lower signal levels).  However, fewer people have experience with FPAs the engineering community than CCDs.  Also (I believe) FPAs are more expensive.

LECs and Quad Cells are typically used as position sensors.  LECs use a single photodiode with 4 electrical pickoffs to return the centroid of a spot.  Quad cells use 4 photodiodes each with 1 electical pickoff for centering applications and centroiding applications.  Each sensor returns 4 voltages/currents which are used to calculate the centroid.

Note that for a Quad cell to provide fine resolution centroid information the light spot must be “large” compared to the sensor itself.  A tight light beam (like a laser) creates a small spot and the only information returned is the quadrant where the light is.  A broad light beam where the spot occupies 50% of the sensor face, for example, will create signals from all 4 quadrants for a centroid calculation.

For more information see the Electro-Optical Sensors article on the wiki.

19th October 2008

The argument among space enthusiasts…

Space exploration funds are very limited and have been for decades.  I haven’t worked onsite at NASA for years but the last number I remember is something like $15B for NASA’s annual budget.  This sounds like a lot but with the better part of $1B devoted to each Shuttle launch $15B doesn’t last long.

So the classic argument among space enthusiasts is should we bother with human space flight?  It’s far more expensive than robotic space exploration.  Can humans bring enough extra to the mission that it is worth the extra expense and risk?

The risks of human space flight

The most obvious risk to manned space flight is a fiery and most spectacular death.  It is most likely to happen on launch or re-entry.  If we start landing on the surface of other planets then that landing will be risky as will any surface exploration.

When we lose a space vehicle meant for manned space flight we lose people and an extremely expensive vehicle.  The people, at least to date, are very well trained, very intelligent people.  Often they have PhDs in engineering and years if not decades of training.  The vehicle is extraordinarily expensive because of its ability to support human life in space for any significant time duration.  Additionally, there are redundant systems and user interfaces.

Robotics, the cheap and (largely) risk free way to explore space

Robots are cheap.  Robots that are lost in exploration don’t have crying widows; there is no lost human potential.  And robots like Spirit and Opportunity offer glimpses into greatness.  Robots designed to survive months have run around the planet for years despite “injuries” and degraded solar panel performance.

I don’t think proper space exploration can be done without robots.  They allow us to explore without risk to human life.  They provide us with information beyond our own senses.  We spend billions of dollars to send people without spending an extra couple of hundred million on support robots?

Robots are essential but exploration with robots alone misses the point

If I had my druthers I’d work on rovers like Spirit and Opportunity.  I’d work on adding lots and lots of artificial intelligence to them.  How much more area would Spirit and Opportunity cover with smart fault detection and robust automatic use of remaining resources?  How much more area if we could say go here and leave the obstacle avoidance to the rover rather than having to move it a little at a time and wait for the time lag of signals coming back from Mars?

The purpose of exploration is the expansion of the human spirit.  Economically we make exploit the resources of the lands we explore.  From a survival standpoint the farther we spread the less likely we are to be wiped out by war, an asteroid or plague.  Exploring with robots alone doesn’t accomplish any of this.

Newer Posts »

Powered by Yahoo! Answers

SEO Powered by Platinum SEO from Techblissonline