Harry Seldon's blog

Fractals, Chaos, and Control Systems on Rails


Control Systems 102: GNC, Conclusion

Posted by Harry Seldon on May 25, 2009

It’s time to get the conclusion of this Guidance, Navigation and Control post series.


To sum up:

And finally, “do not put the cart before the horse”. The cart is the guidance system, the horse is the control system. A good guidance without a good control is totally useless. A good plan is nothing without a good pilot. I’d rather fly in an aircraft with a good Stability and Control System and a poor Guidance System than the opposite. In the first case you might not reach your wanted destination, in the second case you will crash!
We live in an economic world with a lot of guidance and very little control. That is why the finance world totally collapsed, leading us to the current global crisis. More details in a future post…

Posted in | no comments | Tags , , , , , , , , , , , , | atom

Control Systems 102: GNC and Human Pilot

Posted by Harry Seldon on May 19, 2009

This post is part of a series about Guidance, Navigation and Control. See the table of contents here.
3 parts are in this post because they are shorter:

  • About the human pilot (with fresh news: man in an Unmanned Aerial Vehicle is for “soon”)
  • About GNC wordings
  • About the various control loops

About the human pilot

At the beginning of aeronautics, the human pilot was actually a pilot. That is the person had to stabilize the airplane. He was permanently using the flight stick. This was a full time job and a navigator was required to keep track of the aircraft position. Then thanks to a better Navigation System and thanks to the autopilot, the human pilot became more a navigator and a flight manager giving high level orders (altitude, etc.) to the plane in accordance with the flight plan and the Air Traffic Control (ATC).
The next steps are:

  • Fully automatized flight. The commercial airplane flies autonomously, it receives its orders from the ATC through a radio data link. The captain is responsible for the flight safety and can fly the aircraft in case of emergency. This can be forecast for within 20 years. A passenger will be aboard a small UAV (unmanned air vehicle) in probably less than 10 years.
  • Fully automatized ATC. This can be forecast for within 30 years. Unless videoconference kills aviation before that!

To prove that what I am speaking about is not utopia. Here is a news I learned a few days after writing this article. Boeing has filed a patent for an aircraft that could fly autonomously, with one pilot or two pilots. It seems to be for a helicopter. For the moment, the autonomous mode is meant to work when there is nobody inside the aircraft but the step to an autonomous flight with people on-board is then very small (even if it would be a giant step for mankind). So I tell you it is for sooner than you may expect.

By the way, the world will need more and more Control Systems Engineer. Even today, at this time of crisis, the world (France, UK and US at least) is lacking of such engineers so you can study it safely, you won’t be unemployed.

About GNC written GN&C or GCN written GC&N

The acronym GNC can appear in several variations according to what you want to emphasize. GN&C means you separate the low level stabilization (C) from the higher level orders (G&N). GC&N means you associate G and C which are technically similar and you separate them from the Navigation which uses more advanced tools such as the Kalman filter. Both wordings are then completely justified.

About the control loops

Notice we have a lot of Control Systems working on top of each other in an airplane:

This is something to keep in mind that in order to control a system you need several loops from the low level to the high level. The most important system being the pilot (the Stability and Control System). Once you can safely achieve your basic moves (once you have a stable system), then you can think about making long trips and accomplishing a complete plan.

I am anticipating on the conclusion but never forget that the low level control loops are the most important even in “company control”, else you are going straight to a crash. Our (financial but not only) world has completely forgotten that.

Next part will be the conclusion.

Stability and Control
About GNC written GN&C or GCN written GC&N
About the human pilot
About control loops

Posted in | no comments | Tags , , , , , , , , , , , , | atom

Control Systems 102: GNC, Guidance

Posted by Harry Seldon on May 12, 2009

This post is part of a series about Guidance, Navigation and Control. See the table of contents here.


Guidance refers to the questions ”where am I going to?”, ”How can the vehicle follow a trajectory?”. The trajectory itself is prepared by the Flight Planning System (FPS) (or Mission Planning System, MPS). During the flight, the Flight Management System (FMS) knows the trajectory and gives the current portion to the Guidance System (GS) . The Guidance System is in charge of converting the high level parameters (trajectory, waypoint positions) into a set of lower level orders that can be understood by the control, typically altitude, heading or directly a load factor, that is an acceleration. In some cases the guidance can have the role to compute a trajectory between 2 points.
It is also in charge of maintaining the trajectory and the other high level parameters. That means the guidance is itself a control loop. Typically the guidance is the Position Control System (PCS).
This is where things become tricky. Piloting and Guidance are essentially similar. The difference to keep in mind is that the pilot is a low level control loop whereas the guidance is a high level control loop. A nice world would be a world where guidance and pilot loops are two independent loops. Unfortunately both are coupled, and designing one, you need to keep the other one in mind.


Next chapter will be about GNC and human pilot.

Stability and Control
About GNC written GN&C or GCN written GC&N
About the human pilot
About control loops

Posted in | no comments | Tags , , , , , , , , , , , , | atom

Control Systems 102: GNC, Control

Posted by Harry Seldon on May 04, 2009

This post is part of a series about Guidance, Navigation and Control. See the table of contents here.

Stability and Control

Control answers the question ”How can the vehicle be stable?”. For an aircraft, it means “how can the aircraft accomplish basic moves such as flying straight, climbing, descending?”. A more technical definition of stability would be “the tendency of the vehicle to maintain or deviate from an established flight condition”. Control is the ability of the vehicle to be manoeuvred or steered from one flight condition to another.
It is very important to notice that questions regarding the stability (as opposed to a crash) are mainly addressed by the control and not the guidance nor the navigation. That is why one often speaks about Stability and Control System (SCS) and not only Control System.
The SCS is made of two parts: Stability Augmentation System (SAS) that stabilizes the aircraft (if it is naturally unstable) and improves its handling qualities. Then, the Control Augmentation System (CAS) typically allows the vehicle to maintain its altitude or heading. These functions are called altitude hold and heading hold modes in the AutoPilot (AP). The SCS creates the low level orders directly sent to the actuators (ailerons, rudder, elevator, engines, etc.). It is also sometimes called the Piloting System, meaning piloting is associated to low level, stabilization work.
Thus, how to fly is known by the control. Once it is done, higher level objectives can be achieved such as following a trajectory, that is going from a point A to a point B. High level orders will be sent by the guidance system.


Next chapter will be about Guidance.

Stability and Control
About GNC written GN&C or GCN written GC&N
About the human pilot
About control loops

Posted in | no comments | Tags , , , , , , , , , , , , | atom

Control Systems 102: GNC, Navigation

Posted by Harry Seldon on April 27, 2009

This post is part of a series about Guidance, Navigation and Control. See the table of contents here.


Navigation (Nav) refers to the question ”where is currently the vehicle?”. A Navigation System (NS) aims at giving you your position. Nowadays the main sensor associated to navigation is definitely a GPS (Global Positioning System) sensor. More generally the Nav collects all the data from the sensors and processes them to make a precise, smooth and high frequency information about position and speed.
The main control theory tool for navigation is probably the Kalman filter. Typically, embedded on board an aircraft, the navigation will combine GPS data, air data, inertial data and the aircraft dynamical model into a Kalman filter.


Next chapter will be about Stability and Control.

Stability and Control
About GNC written GN&C or GCN written GC&N
About the human pilot
About control loops

Posted in | no comments | Tags , , , , , , , , , , , , | atom

Control Systems 102: GNC, Guidance, Navigation and Control, Introduction

Posted by Harry Seldon on April 27, 2009

Guidance, Navigation and Control are often together. It makes perfect sense because all three of them depend on control theory and because they are the components of the software part of a Control System. But do you clearly know the differences between Guidance, Navigation and Control? I am going to explain them taking the example of an aircraft. In future posts I will take other examples such as a company, a country government or the go game. This series of posts is a follow up of Control Systems 101.


This post was quite long so I decided to cut it in several parts. Even cut in several parts, the point remains to consider GNC as a whole, it is not to make extensive explanations on each topic. Wikipedia would be fine for this, whereas it is not so good as far as the GNC topic is concerned. According to your comments, I may update Wikipedia with the little work made here.

The first chapter presents the Navigation System.

Here is the Table of Contents (TOC):

Stability and Control
About GNC written GN&C or GCN written GC&N
About the human pilot
About control loops

Posted in | 2 comments | Tags , , , , , , , , , , , , , | atom

How to draw Mandelbrot's fractal with Rails and Open Flash Chart?

Posted by Harry Seldon on April 18, 2009

Mandelbrot set

Let us draw the Mandelbrot set with OFC. The point is to make a new example of use of OFC and it is also to have some fun with the so interesting fractal theory. To see how fashionable it is, read this post: Good news from the combat against the crisis. This post is highly inspired from this nice French page about the Mandelbrot set. I am using the algorithm given there.

Definition of the Mandelbrot set
For each point of the complex plane we associate the sequence: zn+1=zn2+A with z0=0 and A=a+ib the point affix. Iff the sequence is bounded the point A belongs to the Mandelbrot”s set. Problem is, it is not easy for a computer to say if a sequence remains bounded. It would require an infinite number of calculations. For each point, we are simply going to make a ‘large’ number of calculation on the sequence. It can be shown analytically that if the module of zn is greater than 2 the sequence will diverge. So during nmax iterations, if the sequence goes above 2, the sequence diverges and it has diverged all the quicker as the number of iteration is low. If it is quick to diverge it is far from the set. A color will be associated to each point according to its distance from the set. If the algorithm reaches nmax the probability for the point to belong to the set is maximal with respect to our computation.

To code without complex numbers we will use the real coordinates, the sequence being written equivalently as:
yn+1=2 xn yn+b

Code for Open Flash Chart
The implementation with Rails and OFC is explained hereafter. It is using a scatter chart.

in test_it_controller.rb

  def index_mandelbrot_fractal
    # from http://perso.numericable.fr/~haasjn/haasjn/AlgoMandel.txt 
    @graph = open_flash_chart_object(500,500,"/test_it/graph_code_Mandelbrot_fractal")     

Also in test_it_controller.rb

  def graph_code_Mandelbrot_fractal
    #    Algorithm to draw Mandelbrot's fractal 
    #    variables a,b,x,y,xmin,ymax,cx,cy,width,step:real
    #              i,j,nx,ny,n:int
    #              r: table
    #    cx,cy    coordinates of the image center in the complex plane
    #    xmin     image left limit 
    #    ymax     image upper limit
    #    width    image width in the complex plane
    #    nx       image horizontal resolution 
    #    ny       image vertical resolution
    #    nmax     maximum number of loops to compute the convergence of the complex sequence
    #    step     step between 2 points 
    #    r        table containing the result for each point
    #    in the loop 
    #    i,j  indices of the point 
    #    a,b  point coordinates
    #    x,y  values of the complex sequence
    #    x1   next value of x 
    #    n    indice of the complex sequence
    #    Algorithm beginning 
    #    cx,cy,width,nx,ny,nmax are given at start 
    cx = 0
    cy = 0
    width = 4.to_f
    nx = 100.to_f
    ny = 100.to_f
    nmax = 250.to_f

    xmin = cx-width/2
    ymax = cy+width/2*ny/nx
    step  = width/nx

    # Preparation of the chart
    chart = OpenFlashChart.new
    title = Title.new("Mandelbrot set")
    r = Array.new # results 

    # The loop asks : does the point (a,b) belong to the Mandelbrot set ? 
    # The bigger n, the more probable the point belongs to  the set 
    for j in 0..ny-1
      for i in 0..nx-1
        #  while x*x+y*y<4 and n<=nmax
        while x*x+y*y<4 && n<=nmax

        # Adding the point to the chart
        # Needs to associate a color according to n 
        # that is according to the time needed to converge
        amplif = 1
        c = (16.0.+n/nmax*(255.0-16.0)*amplif).to_int
        c = [255,c].min
        col_gray = (255-c).to_int.to_s(16).to_s
        col =  "#"+col_gray+col_gray+col_gray
        scatter = Scatter.new(col, 2);
        chart.add_element( scatter )

        # if you want to store the result 
      end #i
    end #j

    x_axis = XAxis.new
    chart.x_axis = x_axis

    y_axis = YAxis.new
    y_axis.set_range( -ymax, ymax )
    chart.y_axis = y_axis
    render :text => chart.to_s      

in index_mandelbrot_fractal.html.erb

<script type="text/javascript" src="/javascripts/swfobject.js"></script>
<%= @graph %>

Notice the code for the computation and the graph are made together in the controller code. This is just for simplicity to write this post. Technically, the computation is more a work for your model. Preparing the graph is also a work for the model. With a DRY code you would have one model method to prepare the data, one to prepare the chart. Then in the controller you call the method that prepares the chart and you sends the data to the view.

Here is the Mandelbrot set chart. Beware it takes about 10 seconds to load. Indeed the algorithm is computationally intensive. The code is available in the OFC test app on github. Here is the controller code.

Thanks for having read this world first: drawing the Mandelbrot set with Ruby on Rails and OFC.

Posted in , | 2 comments | Tags , , , , , | atom

There will be war, or, how to prevent it

Posted by Harry Seldon on February 27, 2009

For some time, I have wanted to post about “crises are natural preludes to wars”. I am definitely not that qualified to say that, so I am glad these guys (LEAP experts) are. They predicted quite well the crisis, they invented the word “global systemic crisis” back in 2006. What they say is very scary. Even if they do their best not to mention “war”, they speak about “global geopolitical dislocation”, “tragic consequences” and say “the world will look more like Europe in 1913 rather than our world in 2007”. However, as I am an optimistic guy, let me remind you that I have good news about the crisis and that controls and that genius can save us.

In case I am not clear about why controls can save the world, here is the short version: uncontrolled systems, like natural systems are almost always unstable and chaotical. Chaotical systems (1) are ‘worse’ than unstable because they look like they are stable, like they are converging to a limit but actually at about any time they can diverge. So nothing is worse than “no control”. At worst a bad control leaves us in an uncontrolled situation.
Therefore, the world needs more control at all scales from “personnal self-control” to “World control” going through cities, regions, states, or countries control systems. In case you wonder, I am really not speaking of some kind of a Big Brother, fascist, centralized control system. I am more speaking of a democratic, distributed (decentralized) control system. If you are a computer scientist think about the Git Distributed Version Control System, (intro to git here, graphical explanation here). I will explain more in details what I am thinking about in a later post. Remember my point for today. There is no real choice it is either control or war. War, being the expression of the natural divergence of an uncontrolled human system; WWIII would be a ‘game over’ for the world. However, once you choose control, there are plenty of possibilities, stay tuned.

For French readers, I learnt about that article from the LEAP reading this on yahoo news and that article is itself directly taken from Le Monde.

(1) Climate or Volcanoes are good examples of chaotical systems. For a long time they look quiet, and all of a sudden they explode. So yes, they should be controlled. CO2 control is an attempt for climate. Not sure it will work, not sure it is really useful but it is definitely worth trying it. I have a humoristic post about a volcano control system in preparation.

PS If you are interested in controls questions, please join the control theory group on Facebook.
PPS If you wonder what ThinkoSphere is doing in all that, I will speak about it in a later post. But you are definitely right, it is related.

Posted in , | 2 comments | Tags , , , , , | atom

Facebook's Control Theory group, you know you are a Control theorist when

Posted by Harry Seldon on February 26, 2009

You will want to join the Control Theory group on Facebook if, or you know you are a Control theorist when:

  • For you, Vibration Control is not only a Sex toy.

  • Finding the good frequency is not only the problem of your girlfriend.

  • “Slower, Faster, now it is good” reminds you your work.

  • You see everything as a control system. (which is called being controlphrenic)

  • You have already thought “laws are way too complex, a PID would do the job”.

  • You have already said to your lawyer “Don’t tell me about laws, I am designing them all day”.

  • Every 10 words you say is either feedback, stable, unstable, transient, control or state.

  • Kalman is some god.

  • Navigation is for you another word for Kalman filter.

  • You know the difference between guidance, navigation and controls.

  • For you, airplanes, rockets, cars, finance, politics, trains, teams should be controlled with some good sensors, good actuators and good controls.

  • “Everything is under control” means something to you.

  • Socrates should have said “control yourself” instead of “know yourself”.

  • Every Pilot should be an “Automatic Pilot”.

  • But actually, you do not enter an automatic vehicle ,”you know too much” ;-)

  • ‘Chaos’ does have not the same meaning as for anybody else.

  • Control theory can save the world

Feel free to complete the list in the comments!

Posted in | 2 comments | Tags , , , , , , , , | atom

Yes, he can save the world !

Posted by Harry Seldon on February 23, 2009

He is from a minority. He is American, lives in the US but has a dual culture. He studied in the best universities. He is one of the smartest guys on Earth. He had many awards for his outstanding work along his long and brilliant career. He has always fought received ideas. He is not afraid of complexity but knows to recognize simplicity in the middle of intricated systems that most people consider as infinitely complex. He is not afraid of telling people when they are wrong. He is not afraid of telling them what to do. He does not hesitate to fight alone against the majority but definitely prefers to be with the majority. If listened to earlier, many casualties would have been avoided. He wants to change the world and he has a plan.
No, I am not speaking about Barack Obama. Let me continue. He is Franco-American. He studied aeronautics. He deserves a Nobel prize in all categories: economy, physics, medecine (biology), chemistry, and even litterature and peace, because his work helped describing and understanding the geometry of nature. His work can indeed be applied to stock market, natural borders, lungs description, fluid mechanics, animal population evolution, clouds. He wrote many inspiring books. If more listened to the world would be way more peaceful because better understood and less submitted to crisis.
Yes, I am speaking about Benoit Mandelbrot and the good news is: his work on finance is slowly being recognized by the media and by economists.

Listen to Mandelbrot and global warming, crisis and wars will just be bad memories. OK I am exaggerating, but I am not sure how much ;-).

PS If you know which conferences Mandelbrot is going to attend this year, please let me know in the comments because he is definitely the celebrity I would love most to meet.
mandelbrot antenna

Posted in , | no comments | Tags , , , , , , | atom



Recent Comments

Recent Posts


actuators aircraft atc blog chaos chaos_theory charts control controllers controls crisis economy finance flight fractals git gnc gs guidance linux mandelbrot marketing navigation ns ofc on pilot rails ruby sas scs sensors statistics systems techcrunch thinkosphere tutorial typo ubuntu wifi