This repository contains the code used in our paper “A Comparison of Tracking Step Inputs with a Piezo Stage Using MPC and Saturated LQG Control,” recently submitted to the IEEE Transaction on Control Systems Technology.
experiments
: This folder contains the Matlab code used to run the experiments and simulations. The relavent script isrun_sweep_gamma.m
, which produced both the simulation experimental results. The first part of the script runs the simulations. The second part drives LabView via ActiveX to run the experiments.publish_plotting
: This folder contains all of the code used to produce the figures in the manuscript.labview
: This folder contains all of the LabView code. This includes our implementation of the FGM and linear state feedback.models
: Just contains Simulink models used in the simulations.functions
: Contains a bunch of Matlab classes and functions. This folder and its sub-foldercanon
need to be added to your Matlab path to succesfully run pretty much anything in here. Most of the scripts will add these two folders to the path themselves, providesPATHS
is properly configured as described below.modelFitting
: This folder contains the code used to fit the drift, hysteresis and vibrational state space models.unit_tests
: Contains some unit tests. Unfortuanately, coverage is poor.latex
: Contains source for the manuscript itself.sandbox
: Only look in here if you are brave.
In theory, all the figures and manuscript pdf can be built (on linux) by typing make
in the root directory. Unfortunately, this does not run the experiments, but relies on saved data.
To succesfully run the scripts, you must do a small amount of configuration.
- Download the data set from https://rabraker.com/publication_data/data_tcst.zip. This file is about 800 megabytes. It is not included in this repo because (1)github doesn’t like it when you store such large amounts of data and (2) it violates the principle of only putting human generated items in a repo. Unzip this file somewhere, probably inside the checkout repo (it is already ignore in
.gitignore
). - Setup a couple paths. The file
functions/PATHS.m
is class with a bunch of static methods which return paths, e.g., of where to save figures or where the experimental data is located. The methodsPATHS.exp()
andPATHS.MPCJ_root()
provide the base paths from which all others are derived. You should edit these two methods such thatPATHS.exp()
returns the location where you saved the accompanying data set.PATHS.MPCJ_root()
returns the path to the root of the repository. For example, on my machine
>> PATHS.exp() ans = '/media/labserver/mpc-journal' >> ls(PATHS.exp()) ans = step-exps sysID >> PATHS.MPCJ_root() ans = '/home/arnold/matlab/afm_mpc_journal'
This repository has several dependencies. To the best of my knowledege, these are:
The repo needs a working installation of Matlab. Due to the Simulink files, this needs to be R2018b or later.
sysID
(availibale viagit clone https://git.rabraker.com/sysID.git
) is a set of LabView and Matlab tools I have written to faciliate system identification. This contains both the swept sines code as well as the code to fit the transfer function via logarithmic cost. Thefunctions
folder in this repo should be on your Matlab path.- qpOASES (Optional) This contains the quadratic programming solver used in some of the exploratory analysis. For the type of condensed MPC problem we considered, this solver is about an order or magnitude faster than the native Matlab solver. However, none of the results in the paper directly rely on this.
The experimental code is written in LabView 2017. The LabView code depends on
utils_lib
(availible viagit clone https://git.rabraker.com/utils_lib.git
) is a small set of LabView utility functions I have written that are used across multiple projects, which is why they are in a separate repo.- VI Tester from JKI (optional). This is only needed if you want to run the LabView unit tests.
- openG is a really useful set of extensions to LabView.
- NI Control Design and Simulation Module
You can, of course see all the packages used in jpaper.tex
. I think the only oddball package is svg
. All of the figures generated by the Matlab scripts are saved as .svg files. Conversion to pdf format for Latex is accomplished with the svg package from CTAN. This Latex package in turn relies on Inkscape. Inkscape produces a pdf that Latex doesn’t like too much because of something about page groups. Thus, in the Latex file, I set inkscapeexe=/home/arnold/matlab/afm_mpc_journal/latex/svg2pdf.py
, which filters out the offending parts of the pdf. If you don’t have python, that can be removed and you’ll just get a bunch errors/warnings but the pdf should still build.
If you find that I have missed some, please let me know so I can update this list.
- Figure out a more robust (i.e., reliable/long-term) way to release the data than on my personal webserver.