Changes

1,834 bytes added ,  00:15, 11 December 2017
no edit summary
Line 1: Line 1:  +
== How To Use ==
 +
 
=== Important implentation notes===
 
=== Important implentation notes===
   Line 7: Line 9:  
===Layperson "how it works"===
 
===Layperson "how it works"===
   −
The central idea to spaghetti is an linear compensator that computes a control effort, given the history of measured altitudes. You don't need to know how it works. This control effort is in kg/s. It this then scaled by a gain, called k. Since ballasting and venting are discrete on/off, and the commanded effort is continuous, this needs to be converted into a series of discrete actions, separated by a time interval. This is much like PWM, but instead of changing duty cycle directly, you are changing the time interval between events such that the action time is fixed to it's minimum acceptable value, and produce the least discretization (in the future this may want to be changed to conserve power and minimize the number of valve actions).
+
The central idea to spaghetti is an linear compensator that computes a control effort, given the history of measured altitudes. You don't need to know how it works in order to command it. This control effort is in kg/s. It this then scaled by a gain, called k. Since ballasting and venting are discrete on/off, and the commanded effort is continuous, this needs to be converted into a series of discrete actions, separated by a time interval. This is much like PWM, but instead of changing duty cycle directly, you are changing the time interval between events such that the action time is fixed to it's minimum acceptable value, and produce the least discretization (in the future this may want to be changed to conserve power and minimize the number of valve actions).
    
===Constants===
 
===Constants===
Line 36: Line 38:     
Also, you don't want to act when your effort is really low and you are close to the target. There needs to be a minimum threshold before you start acting. This is rate_min. The higher you make rate_min, the more the controller acts like a bang-bang controller, where it waits till it's pretty late and then acts a bunch. about 1 order of magnitude below your max rate is probably a decent place to start for your rate min.
 
Also, you don't want to act when your effort is really low and you are close to the target. There needs to be a minimum threshold before you start acting. This is rate_min. The higher you make rate_min, the more the controller acts like a bang-bang controller, where it waits till it's pretty late and then acts a bunch. about 1 order of magnitude below your max rate is probably a decent place to start for your rate min.
 +
 +
 +
 +
== How it works ==
 +
 +
=== Feedback control ===
 +
Spaghetti uses feedback to determine what actions it should take. This is pretty intuitive, as obviously it needs to feedback the current altitude in order to make calculation of the next desired action. Here is the control loop structure:
 +
 +
[ Diagram coming soon]
 +
 +
=== Compensator ===
 +
 +
The heart of the spaghetti controller is the linear compensator that calculates the control effort. The first thing you may wonder is: what do you mean by linear? and what do you mean by compensatory? First of, the compensator is a single input single output system. It calculates an output given a sequence of inputs. It's also what is called Linear Time Invariant (LTI). This means that for any input u1 that produces output y1, the input 2*u1 will produce an output 2*y1. In addition, and two different inputs u1 and u2, with corresponding outputs y1 and y2, the input u1 + u2 will have output y1 + y2. In math terms, this means that it's closed under addition and multiplication, and hence linear. The time invariant part means that if you shift an input in time, the output will be exactly the same, just also shifted in time.
 +
 +
Why is this so important? Because it allows us to analyze the system in the frequency domain. to be continued.
 +
 +
=== Implementation in code ===
 +
 +
If we switch gears into digital signal processing land, we realize that we can implement a leaner system in discrete time
 +
 +
[[Biquad controller | https://en.wikipedia.org/wiki/Digital_biquad_filter]]
 +
 +
 +
 +
=== If you think controls are cool and wanna learn more ===
 +
 +
Relevant classes:
 +
 +
* EE102A Signal Processing and Linear Systems I (highly highly recommend, great intro class)
 +
* EE102B Signal Processing and Linear Systems II
 +
* ENGR105 Feedback Control
 +
 +
[[Category:ValBal_Controls]
77

edits