.. pyMPC documentation master file, created by sphinx-quickstart on Tue May 28 18:47:14 2019. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. pyMPC ===== --------------------------------------------- A python library for Model Predictive Control --------------------------------------------- pyMPC is an open-source python library for Model Predictive Control (MPC). The project is hosted on this `GitHub repository `_. Requirements ------------ As a bare minimum, you will need a python 3.x environment with: * `numpy `_ * `scipy `_ * `OSQP `_ * `matplotlib `_ All dependencies should be installed automatically following the pyMPC installation instructions below Installation ------------ 1. Copy or clone the pyMPC project in a local folder. For instance, run .. code-block:: bash git clone https://github.com/forgi86/pyMPC.git in the command line 2. Navigate to the local pyMPC folder (where the file setup.py) .. code-block:: bash cd PYMPC_LOCAL_FOLDER 3. Install pyMPC in your python environment: .. code-block:: bash pip install -e . Usage ----- This code snippets illustrates the use of the MPCController class: .. code-block:: python from pyMPC.mpc import MPCController ... K = MPCController(Ad,Bd,Np=20, x0=x0,xref=xref,uminus1=uminus1, Qx=Qx, QxN=QxN, Qu=Qu,QDu=QDu, xmin=xmin,xmax=xmax,umin=umin,umax=umax,Dumin=Dumin,Dumax=Dumax) K.setup() ... xstep = x0 for i in range(nsim): uMPC = K.output() xstep = Ad.dot(xstep) + Bd.dot(uMPC) # system simulation steps K.update(xstep) # update with measurement Examples -------- Full working examples are given in the `examples `_ folder on git: * `Point mass, full state feedback `_ * `Cart-pole system, full state feedback `_ * `Cart-pole system, with Kalman Filter `_ Content ------- .. toctree:: :maxdepth: 2 code math Indices and tables ------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search`