Git Product home page Git Product logo

mypy's Introduction

mypy: An Useful Toolbox for Control Engineers

Overview

mypy is an useful toolbox for control engineers. It can be used for a wide range of purposes: to identify a system transfer functions, to optimize a trajectory plan, to automatically design good FB controllers, ..., and so on.

Requirements

  • Python 3.5+.
  • numpy, scipy, and sympy (all included in anaconda)
  • mycvxopt requires cvxopt.

Install

Just append mypy to your PYTHONPATH, or

import sys
sys.path.append(r"/home/me/mypy")

Documentation

Read pdfs in doc/

Examples

  • Optimized Multisine: better S/N-ratio excitation

optimized_multisine

Optimized Multisine.

FFT_of_optimized_multisine

FFT of Optimized Multisine.

  • System Identification: linear least squares, iterative weighted linear least squares, nonlinear least squares, and maximum likelihood estimation solution.

Bodeplot

FRF.

System_Identification_from_10_Hz_to_500_Hz

System Identification Results.

  • Trajectory Planning: B-spline trajectory of jerk 2/infinity-norm minimization with constraints (Red: infinity-norm minimization, Blue: 2-norm minimization)

po vel acc jer snap

  • Feedback Controller Design: Exploiting FRF results, find a linear FB controller that satisfies desired (given) linear constraints for all plant perturbations, i.e. (1) Gain-Crossover Linear Inequalities, (2) Phase Margin Linear Inequalities, (3) Gain Margin Linear Inequalities, (4) Second Phase Margin Linear Inequalities, (5) Gain Minimum/Maximum Linear Inequalities, (6) Stability Margin (Disk) Concave Inequalities via CCCP method, (7) Robust Stability Quadratic Inequalities (using socp or sdp), (8) Nominal Performance (Disk) Concave Inequalities via CCCP method. Default Controller: PIDs + 10 FIRs (13 variables).

plant

Plant FRF.

nyquist e_nyquist

Nyquist Plot of Optimized Open-Loop FRF.

sensitivity

Sensitivity.

Copyright and License

2017-, Shimoda Takaki, The University of Tokyo

mypy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

mypy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

mypy's People

Contributors

shimodatakaki avatar

Stargazers

Kosuke Numata avatar William Jussiau avatar Kobi Felton avatar  avatar Laurens avatar

Watchers

 avatar

mypy's Issues

On Fractional Constraints

Fractional constraints (a0.T xn+b0)/(c0.T xd + d0) < l0 can be transformed into
⇔ a0.T xn+b0 < l0(c0.T xd + d0)
⇔ a0.T xn - l0 c0.T xd < l0 d0 - b0
⇔ [a0.T, - l0 c0.T] [ xn, xd ].T < l0d0 - b0
This means fractional constraints are equivalent to linear/quadratic constraints under some assumptions*.
(* c0.T xd + d0 > 0)

For now the controller C is defined as (a0.T xn+b0)/ (Const.), but we can let controller C = (a0.T xn+b0)/(c0.T xd + d0) to optimize both numerator and denominator coefficients.

Magnitude only fitting

Experimental data are some times very bad, in such cases at least gain should be fitted to data!

myfbcd.py Sensitivity weighting should be (self.o_dgc/s)**2

Since PID + Plant has 1/s2 @ s~0, the sensitivity function of PID controller also is proportional to 1/s2.
So for a fair comparison, PID + FIR should also have 1/s**2 weighting (to decrease sensitivity in the lower frequency); otherwise the controller no longer rejects low frequency disturbance such as friction.

FRF data driven ILC

ILC is promising technology for feed-forward control.
FRF data driven FB and FF are good, and why not using ILC?

Feedforward Controller Design

2DOF Controller Structure allows independently modify T (complementary sensitivity).
FRF Data driven ffcd is desired!

FIR Filters Gain

Sum of FIR filters gain should be positive since FIR(s~0) ~ sum(gain).

5_bode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.