Dynamics and Control with Jupyter Notebooks
1. Introduction to Sympy and the Jupyter Notebook for engineering calculations
1.1. A quick tour
1.2. Math in text boxes
1.3. Special symbols in variable names
1.4. SymPy
1.5. Calculus
1.6. Limits
1.7. Approximation
1.8. Solving equations
2. Python stuff not done in MPR
2.1. List comprehensions
2.2. Dictionaries
2.3. Tuples
2.3.1. Tuple expansion
2.4. The for loop in Python
2.4.1. zip
2.5. lambda
3. The Jupyter notebook cheat sheet
3.1. Table of Contents
3.2. Numeric
3.3. Basic plotting functions
3.4. Symbolic manipulation
3.4.1. Imports
3.4.2. Working with rational functions and polynomials
3.4.3. Functions useful for discrete systems
3.5. Equation solving
3.5.1. Symbolic
3.5.2. Numeric sympy
3.5.3. Numeric
3.6. Matrix math
3.6.1. Symbolic
3.6.2. Numeric
1. The draining cup problem
1.1. Volume-height relationship
1.2. Dynamic model
1. Equation solving tools
1.1. Exact solution using sympy
1.2. Special case: linear systems
1.3. Nonlinear equations
1.3.1. Numeric root finding
1.3.2. Downsides of numerical solution
1.4. Differential equations
1.4.1. Analytic solution
1.4.2. Numeric solution
1.4.2.1. A note about odeint
2. The problem with simple math on computers
2.1. Computers use base 2 instead of base 10
2.2. Solutions
2.2.1. Built-in to Python
2.2.2. Sympy
2.3. Why isn’t math always done in base 10?
2.4. Forcing rounding of exact representations
3. Read simulation input from a file
4. Fed Batch Bioreactor
5. CSTR system
5.1. Model
5.2. Solve for steady state
5.3. Nonlinear behaviour
6. Mixing system
7. Steady state calculation
7.1. Flow rates
7.2. Compositions
8. Design
9. Dynamic simulation
1. Valve equation
1.1. Rewriting in terms of devation variables
2. A note about simplification
2.1. Multiple variables
3. Laplace transforms in SymPy
3.1. Direct evaluation
3.2. Library function
3.3. What is that θ?
3.4. Reproducing standard transform table
3.5. More complicated inverses
4. Convolution and transfer functions
4.1. Numeric convolution
5. Visualising complex functions
5.1. One-dimensional functions
1. Standard process inputs
1.1. Step
1.2. Laplace transform
1.3. Scaling and translation
1.4. Rectangular pulse
1.4.1. Arbitrary piecewise constant functions
1.5. Ramp
1.6. Continuous piecewise linear functions
1.7. Arbitrary piecewise linear functions
2. First order systems
3. Sinusoidal response
3.1. First order
3.2. Second order sinusoidal response
3.3. Amplitude over frequency
1. Random response generator
2. Simulation of arbitrary transfer functions
2.1. Convert to ODE and integrate manually
2.2. LTI support in scipy.signal
2.2.1. Step responses
2.2.2. Responses to arbitrary inputs
2.2.3. Manual integration using state space form
2.2.4. Demonstration for higher order functions
2.2.5. State space for higher order functions
2.2.6. Systems in series
2.3. 3. Control module
3. Simplifying block diagrams
4. Approximation
4.1. Taylor approximation
4.2. Padé approximation
4.2.1. Further exploration
4.3. Approximations based on response matching
4.4. Skogestad’s “Half Rule”
1. Transfer function matrices
1.1. Representing matrices in SymPy
1.2. Representing matrices using the control library
2. Conversion to state space
3. State space representation
3.1. Converting between state space and transfer function forms
3.1.1. Scipy.signal
3.1.2. Control library
3.2. Symbolic conversion
3.3. Analysis
1. Linear regression
2. Create the design matrices
2.1. Pseudoinverse solution
2.2. Dedicated solvers
3. Nonlinear regression
4. Fitting step responses
5. Neural network regression
5.1. Scikit-learn
5.2. Keras
1. Fourier series
1.1. Step function
1.2. Step response via Frequency response
2. What does a sinusoid sound like?
2.1. But signals aren’t pure sinusoids
2.2. Numeric Fourier Transform
2.3. But that sounds terrible
3. Frequency response plots
4. Bode
5. Phase unwrapping
6. Nyquist
7. With the control library
8. Asymptotic Bode diagrams
9. Systems with real poles
10. Systems with complex poles
11. Dead time
1. Strategies for filtering out noise from a sampled signal
1.1. Pandas
2. Moving averages
2.1. Exponentially weighted moving average
3. The
\(z\)
-transform
3.1. Definition
3.2. Direct calculation in SymPy
3.3. Transfer functions from difference equations
3.4. Responses and inversion
3.5. Calculation using scipy
3.6. Calculation using the control libary
1. Instructions
2. PID step responses
2.1. PI
2.2. PID
2.3. PD
3. First-order system with proportional control
3.1. Offset as function of gain
3.2. Second order system with proportional control
4. PID control on TCLab
5. Programmatic interaction
6. Advanced usage
7. Accessing the historian
8. More detailed analysis
9. Closed loop controlled responses
1. Closed loop stability
2. Using the control library
2.1. Direct substitution
3. Why do we need the Routh Array
4. A better way
5. Root locus diagrams
1. Direct synthesis PID design
1.1. Alternate solution
2. Minimal integral measures
3. ITAE parameters for FOPDT system
4. Interactive version
1. Stability in the frequency domain
1.1. Locating poles and zeros of a complex function
1.2. Closed loop stability
1.3. Nyquist stability criterion
1.4. Bode stability criterion
1. Dead time reduces control performance
2. Smith Predictor
1. Numeric simulation
2. Symbolic calculation
3. Discrete PI with ITAE parameters
3.1. Reconstruction
3.2. Discrete responses
3.3. With output limits
3.4. With setpoint tracking
4. Dahlin controller
5. Discretise the system
6. Dahlin Controller
7. Continuous response
8. Simple discrete simulation: Dahlin controller
8.1. Simple discretisation
8.2. Do discrete transfer function math
8.3. Convert from positive to negative powers of z
8.4. Simple blocksim simulation
9. Noise models
1. Multivariable control
1.1. Closed loop transfer functions for multivariable systems
1.2. Characteristic equation
2. Multivariable Stability analysis
3. Multivariable pairing (RGA)
3.1. Simulation results
4. Eigenvalue problem
5. Decoupling
5.1. 1. Inverse-based
5.2. 2. Zero off-diagonals
5.3. 3. Adjugate method
6. Model Predictive Control
1. Control valve design
1. No delays
1.1. Normal way
1.2. Preallocation
2. Dead time
2.1. Lists and interp
2.2. Approximate indexing
3. Nonlinear tank system
4. PI Control
5. Classes
5.1. What is this good for?
5.2. Objects must be “like” things
6. Taking off the engine cover
7. Objects
7.1. Tank system
7.2. PI Controller
7.3. Generic integration
7.4. Re-using the interface
8. A discrete controller class
9. Blocksim
9.1. Re-using parts of a diagram
10. Disturbances
11. Algebraic equations
1. FOPDT fit
4. PID control on TCLab
5. Programmatic interaction
6. Advanced usage
7. Accessing the historian
8. More detailed analysis
2. TCLab in the frequency domain
2.1. Direct frequency domain tests
2.2. FFT based bode diagram
Dynamics and Control with Jupyter Notebooks
Dynamics and control
View page source
Dynamics and control
Getting Started
1. Introduction to Sympy and the Jupyter Notebook for engineering calculations
1.1. A quick tour
1.2. Math in text boxes
1.3. Special symbols in variable names
1.4. SymPy
1.5. Calculus
1.6. Limits
1.7. Approximation
1.8. Solving equations
2. Python stuff not done in MPR
2.1. List comprehensions
2.2. Dictionaries
2.3. Tuples
2.4. The for loop in Python
2.5. lambda
3. The Jupyter notebook cheat sheet
3.1. Table of Contents
3.2. Numeric
3.3. Basic plotting functions
3.4. Symbolic manipulation
3.5. Equation solving
3.6. Matrix math
Dynamics
Modelling
1. The draining cup problem
1.1. Volume-height relationship
1.2. Dynamic model
Time domain simulation
1. Equation solving tools
1.1. Exact solution using sympy
1.2. Special case: linear systems
1.3. Nonlinear equations
1.4. Differential equations
2. The problem with simple math on computers
2.1. Computers use base 2 instead of base 10
2.2. Solutions
2.3. Why isn’t math always done in base 10?
2.4. Forcing rounding of exact representations
3. Read simulation input from a file
4. Fed Batch Bioreactor
5. CSTR system
5.1. Model
5.2. Solve for steady state
5.3. Nonlinear behaviour
6. Mixing system
7. Steady state calculation
7.1. Flow rates
7.2. Compositions
8. Design
9. Dynamic simulation
Linear systems
1. Valve equation
1.1. Rewriting in terms of devation variables
2. A note about simplification
2.1. Multiple variables
3. Laplace transforms in SymPy
3.1. Direct evaluation
3.2. Library function
3.3. What is that θ?
3.4. Reproducing standard transform table
3.5. More complicated inverses
4. Convolution and transfer functions
4.1. Numeric convolution
5. Visualising complex functions
5.1. One-dimensional functions
First and second order system Dynamics
1. Standard process inputs
1.1. Step
1.2. Laplace transform
1.3. Scaling and translation
1.4. Rectangular pulse
1.5. Ramp
1.6. Continuous piecewise linear functions
1.7. Arbitrary piecewise linear functions
2. First order systems
3. Sinusoidal response
3.1. First order
3.2. Second order sinusoidal response
3.3. Amplitude over frequency
Complex system dynamics
1. Random response generator
2. Simulation of arbitrary transfer functions
2.1. Convert to ODE and integrate manually
2.2. LTI support in scipy.signal
2.3. 3. Control module
3. Simplifying block diagrams
4. Approximation
4.1. Taylor approximation
4.2. Padé approximation
4.3. Approximations based on response matching
4.4. Skogestad’s “Half Rule”
Multivariable system representations
1. Transfer function matrices
1.1. Representing matrices in SymPy
1.2. Representing matrices using the control library
2. Conversion to state space
3. State space representation
3.1. Converting between state space and transfer function forms
3.2. Symbolic conversion
3.3. Analysis
System identification
1. Linear regression
2. Create the design matrices
2.1. Pseudoinverse solution
2.2. Dedicated solvers
3. Nonlinear regression
4. Fitting step responses
5. Neural network regression
5.1. Scikit-learn
5.2. Keras
Frequency domain
1. Fourier series
1.1. Step function
1.2. Step response via Frequency response
2. What does a sinusoid sound like?
2.1. But signals aren’t pure sinusoids
2.2. Numeric Fourier Transform
2.3. But that sounds terrible
3. Frequency response plots
4. Bode
5. Phase unwrapping
6. Nyquist
7. With the control library
8. Asymptotic Bode diagrams
9. Systems with real poles
10. Systems with complex poles
11. Dead time
Sampled systems
1. Strategies for filtering out noise from a sampled signal
1.1. Pandas
2. Moving averages
2.1. Exponentially weighted moving average
3. The
\(z\)
-transform
3.1. Definition
3.2. Direct calculation in SymPy
3.3. Transfer functions from difference equations
3.4. Responses and inversion
3.5. Calculation using scipy
3.6. Calculation using the control libary
Control
Conventional feedback control
1. Instructions
2. PID step responses
2.1. PI
2.2. PID
2.3. PD
3. First-order system with proportional control
3.1. Offset as function of gain
3.2. Second order system with proportional control
4. PID control on TCLab
5. Programmatic interaction
6. Advanced usage
7. Accessing the historian
8. More detailed analysis
9. Closed loop controlled responses
Laplace domain analysis of control systems
1. Closed loop stability
2. Using the control library
2.1. Direct substitution
3. Why do we need the Routh Array
4. A better way
5. Root locus diagrams
PID controller design, tuning and troubleshooting
1. Direct synthesis PID design
1.1. Alternate solution
2. Minimal integral measures
3. ITAE parameters for FOPDT system
4. Interactive version
Frequency domain analysis of control systems
1. Stability in the frequency domain
1.1. Locating poles and zeros of a complex function
1.2. Closed loop stability
1.3. Nyquist stability criterion
1.4. Bode stability criterion
Advanced control methods
1. Dead time reduces control performance
2. Smith Predictor
Discrete control and analysis
1. Numeric simulation
2. Symbolic calculation
3. Discrete PI with ITAE parameters
3.1. Reconstruction
3.2. Discrete responses
3.3. With output limits
3.4. With setpoint tracking
4. Dahlin controller
5. Discretise the system
6. Dahlin Controller
7. Continuous response
8. Simple discrete simulation: Dahlin controller
8.1. Simple discretisation
8.2. Do discrete transfer function math
8.3. Convert from positive to negative powers of z
8.4. Simple blocksim simulation
9. Noise models
Multivariable control
1. Multivariable control
1.1. Closed loop transfer functions for multivariable systems
1.2. Characteristic equation
2. Multivariable Stability analysis
3. Multivariable pairing (RGA)
3.1. Simulation results
4. Eigenvalue problem
5. Decoupling
5.1. 1. Inverse-based
5.2. 2. Zero off-diagonals
5.3. 3. Adjugate method
6. Model Predictive Control
Control Practice
1. Control valve design
Simulation
1. No delays
1.1. Normal way
1.2. Preallocation
2. Dead time
2.1. Lists and interp
2.2. Approximate indexing
3. Nonlinear tank system
4. PI Control
5. Classes
5.1. What is this good for?
5.2. Objects must be “like” things
6. Taking off the engine cover
7. Objects
7.1. Tank system
7.2. PI Controller
7.3. Generic integration
7.4. Re-using the interface
8. A discrete controller class
9. Blocksim
9.1. Re-using parts of a diagram
10. Disturbances
11. Algebraic equations
Temperature Control Lab (TCLab)
1. FOPDT fit
4. PID control on TCLab
5. Programmatic interaction
6. Advanced usage
7. Accessing the historian
8. More detailed analysis
2. TCLab in the frequency domain
2.1. Direct frequency domain tests
2.2. FFT based bode diagram
Search Page
Search Page