Static output feedback and fixed order controller design package for Python
SOF is the simplest feedback controller structure. More precisely, it redirects the system output to the system input after multiplying by a constant gain matrix. You can find brief information about SOF in this page.
The algorithm implemented in this package can calculate a stabilizing SOF gain which also minimizes the
However, this algorithm works when some sufficient conditions are satisfied. If the problem parameters (listed below) is not appropriate, the algorithm fails and prints an error message. Please see the article, and the PhD thesis, for detailed information and analysis.
The algorithm is mainly developed for discrete time systems, but it may also compute similar SOF gains for continuous time systems when this algorithm is applied to the zero-order hold (ZOH) discretized versions with a sufficiently large sampling frequency.
Furthermore, the algorithm can be used to calculate fixed-order controllers. Please, check tests for examples and docs for detailed information.
python3 -m venv venv
source venv/bin/activate
pip install -e '.[dev]'
pytest
It can be installed via pip from pypi
.
pip install focont
Consider this highly simplified real life example below which is a naively discretized version of the ideal Newton motion equations. It is a model of a ball's motion on an inclined plane.
In the model, the top of plane is assumed to be the origin and force
where
where
With this information, the system matrices can be written as
where
Problem:
Calculate a static output feedback (SOF) gain
where force is a function of measurment
In other terms, how can I use the measurment
from focont import foc, system
def main():
A = [
[ 1.01, 0.10 ],
[ 0.00, 0.99 ],
]
B = [
[ 0 ],
[ 1 ],
]
C = [ [ 1, 1 ] ]
Q = [
[ 1, 0 ],
[ 0, 0 ],
]
R = [ [ 1 ] ]
data = { "A": A, "B": B, "C": C, "Q": Q, "R": R }
pdata = system.load(data)
foc.solve(pdata)
foc.print_results(pdata)
if __name__ == "__main__":
main()
Prints out:
Progress: 10%, dP=0.4662574448312318
Iterations converged, a solution is found
- Stabilizing SOF gain:
[[-0.6147]]
- Eigenvalues of the closed loop system:
[0.8907 0.4946]
|e|:
[0.8907 0.4946]
Meaning that, rlocus
method. When
the cost
In this plot, the minimum cost is
Let us modify the cost function and attach a higher weight to the consumed energy. Meaning that, we do not care much about how quickly the ball is transported but we want to spend less energy.
In this case, the SOF gain
The dashed lines are obtained when the consumed energy is largely penalized in the cost function. As it can be seen, it gets closer to the origin slower, but consumed energy (blue) is smaller.