Introduction to Dynamic Modeling
Main.DynamicModeling History
Hide minor edits - Show changes to markup
m = GEKKO()
m = GEKKO(remote=False)
m.solve(remote=True)
m.solve()
plt.figure() plt.plot(x.value,y.value)
plt.figure(1) plt.plot(x.value,y.value,'r--',label='Path')
plt.figure()
plt.legend(); plt.grid()
plt.figure(2) plt.subplot(2,1,1)
plt.legend()
plt.figure()
plt.legend(); plt.grid()
plt.subplot(2,1,2)
plt.legend()
plt.legend(); plt.grid()
(:toggle hide python button show="Show Python Code":)
(:toggle hide python button show="Show Python ODEINT Code":)
- Simultaneous method with APMonitor
- install and load APMonitor
try:
from APMonitor import *
except:
import pip pip.main(['install','APMonitor']) from APMonitor import *
- solve model
z2 = apm_solve('skydiver',7)
plt.figure(1)
plt.figure()
plt.plot(z2['time'],z2['x'],'r:',lw=3) plt.plot(z2['time'],z2['y'],'b--',lw=3)
plt.legend(['ODEINT x','ODEINT y','APM x','APM y'])
plt.legend(['x','y'])
plt.plot(z2['time'],z2['vx'],'r--',lw=3) plt.plot(z2['time'],z2['vy'],'b--',lw=3) plt.plot(z2['time'],z2['v'],'k--',lw=3)
plt.legend(['ODEINT V_x','ODEINT V_y','ODEINT V', 'APM V_x','APM V_y','APM V'])
plt.figure(2) plt.plot(z2['x'],z2['y'],'r-') plt.xlabel('Position (x)') plt.ylabel('Position (y)')
plt.legend(['V_x','V_y','V'])
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/eKATopbW_rU" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe> (:htmlend:)
(:toggle hide gekko button show="Show GEKKO (Python) Code":)
(:toggle hide gekko button show="Show Python GEKKO Code":)
(:divend:)
(:divend:)
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/eKATopbW_rU" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe> (:htmlend:)
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB, APM Python, or Python GEKKO as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB or Python GEKKO. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor/Gekko). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
The focus of this course is on modeling, simulation, estimation, and optimization of dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines. The examples are particularly focused on engineering applications although much of the theory and applications can also be applied to other fields as well.
The focus of this course is on modeling, simulation, estimation, and optimization of dynamic systems. See the Engineering Design Optimization course for information on solving static design problems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines. The examples are particularly focused on engineering applications although much of the theory and applications can also be applied to other fields as well.
plt.plot(t,x,'r-',linewidth=2) plt.plot(t,y,'b-',linewidth=2) plt.plot(z2['time'],z2['x'],'r:',linewidth=3) plt.plot(z2['time'],z2['y'],'b--',linewidth=3)
plt.plot(t,x,'r-',lw=2) plt.plot(t,y,'b-',lw=2) plt.plot(z2['time'],z2['x'],'r:',lw=3) plt.plot(z2['time'],z2['y'],'b--',lw=3)
plt.plot(t,vx,'r-',linewidth=2) plt.plot(t,vy,'b-',linewidth=2) plt.plot(t,v,'k-',linewidth=2) plt.plot(z2['time'],z2['vx'],'r--',linewidth=3) plt.plot(z2['time'],z2['vy'],'b--',linewidth=3) plt.plot(z2['time'],z2['v'],'k--',linewidth=3)
plt.plot(t,vx,'r-',lw=2) plt.plot(t,vy,'b-',lw=2) plt.plot(t,v,'k-',lw=2) plt.plot(z2['time'],z2['vx'],'r--',lw=3) plt.plot(z2['time'],z2['vy'],'b--',lw=3) plt.plot(z2['time'],z2['v'],'k--',lw=3)
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/eKATopbW_rU" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe> (:htmlend:)
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB or APM Python as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB, APM Python, or Python GEKKO as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
(:toggle hide gekko button show="Show Gekko Code":)
(:toggle hide gekko button show="Show GEKKO (Python) Code":)
(:divend:)
(:divend:)
(:divend:)
(:divend:)
(:toggle hide gekko button show="Show Gekko Code":) (:div id=gekko:) (:source lang=python:)
from gekko import GEKKO import numpy as np import matplotlib.pyplot as plt
- number of points in time discretization
n = 91
- Initialize Model
m = GEKKO()
- define time discretization
m.time = np.linspace(0,90,n)
- make array of drag coefficients, changing at time 60
drag = [(0.2 if t<=60 else 10) for t in m.time]
- define constants
g = m.Const(value=9.81) mass = m.Const(value=80)
- define drag parameter
d = m.Param(value=drag)
- initialize variables
x,y,vx,vy,v,Fx,Fy = [m.Var(value=0) for i in range(7)]
- initial conditions
y.value = 5000 vx.value = 50
- Equations
- force balance
m.Equation(Fx == -d * vx**2) m.Equation(Fy == -mass*g + d*vy**2)
- F = ma
m.Equation(Fx/mass == vx.dt()) m.Equation(Fy/mass == vy.dt())
- vel = dxdt
m.Equation(vx == x.dt()) m.Equation(vy == y.dt())
- total velocity
m.Equation(v == (vx**2 + vy**2)**.5)
- Set global options
m.options.IMODE = 4 #dynamic simulation
- Solve simulation
m.solve(remote=True)
- Plot results
plt.figure() plt.plot(x.value,y.value) plt.xlabel('x') plt.ylabel('y')
plt.figure() plt.plot(m.time,x.value,label='x') plt.plot(m.time,y.value,label='y') plt.xlabel('time') plt.legend()
plt.figure() plt.plot(m.time,vx.value,label='vx') plt.plot(m.time,vy.value,label='vy') plt.xlabel('time') plt.legend()
plt.show() (:sourceend:)
(:divend:)
This problem can also be solved with an ODE integrator such as Python's ODEINT function in SciPy.Integrate or MATLAB's ode23 function. The focus of this class is on solving dynamic optimization problems where ODE integrators are not suitable because of the inefficiencies of shooting methods. Regardless, it is valuable to know how to use ODE integrators for simulation. Below is the source code using ODEINT in Python.
This problem can also be solved with an ODE integrator such as Python's ODEINT function in SciPy.Integrate or MATLAB's ode23 function. The focus of this class is on solving dynamic optimization problems where ODE integrators are not suitable because of the inefficiencies of shooting methods. Regardless, it is valuable to know how to use ODE integrators for simulation. Below is the source code in MATLAB and Python.
(:toggle hide matlab button show="Show MATLAB Code":) (:div id=matlab:) (:source lang=matlab:) clear all; close all; clc
Method 1: MATLAB integration with ode15s % initial conditions z0 = [0,5000,50,0]; % time points t = linspace(0,90,1); % solve [t,z1] = ode15s('skydiver',t,z0);
% parse results ode_x = z1(:,1); ode_y = z1(:,2); ode_vx = z1(:,3); ode_vy = z1(:,4); ode_v = sqrt(ode_vx.^2+ode_vy.^2);
Method 2: APMonitor addpath('apm') % load APMonitor.com files y = apm_solve('skydiver',7); z = y.x; % solve numerically
Plot results figure(1) subplot(2,1,1) plot(t,ode_x,'r-','LineWidth',2) hold on plot(t,ode_y,'b-','LineWidth',2) plot(z.time,z.x,'r:','LineWidth',3) plot(z.time,z.y,'b--','LineWidth',3) ylabel('Position (m)') legend('x','y')
subplot(2,1,2) plot(t,ode_vx,'r-','LineWidth',2) hold on plot(t,ode_vy,'b-','LineWidth',2) plot(t,ode_v,'k-','LineWidth',2) plot(z.time,z.vx,'r:','LineWidth',3) plot(z.time,z.vy,'b--','LineWidth',3) plot(z.time,z.v,'k--','LineWidth',3) xlabel('Time (sec)') ylabel('Velocity (m/s)') legend('V_x','V_y','V','APM V_x','APM V_y','APM V')
figure(2) plot(z.x,z.y,'r-','LineWidth',2) xlabel('Position (x)') ylabel('Position (y)') (:sourceend:) (:divend:)
(:toggle hide python button show="Show Python Code":) (:div id=python:)
(:sourceend:)
(:sourceend:)
(:divend:)
This problem can also be solved with an ODE integrator such as Python's ODEINT function in SciPy.Integrate or MATLAB's ode23 function. The focus of this class is on solving dynamic optimization problems where ODE integrators are not suitable because of the inefficiencies of shooting methods. Regardless, it is valuable to know how to use ODE integrators for simulation. Below is the source code using ODEINT in Python.
(:source lang=python:)
- Sequential method with SciPy.integrate.odeint
import numpy as np from scipy.integrate import odeint
def skydive(z,t):
# constants g = 9.81 # m/s^2, gravitational constant m = 80 # kg, mass of skydiver and pack if t<61: c = 0.2 # N-s^2/m^2, drag coefficient, chute closed else: c = 10.0 # N-s^2/m^2, drag coefficient, chute open # states (z) x = z[0] # meters, horizontal position y = z[1] # meters, vertical position / elevation vx = z[2] # m/s, skydiver horizontal velocity = airplane velocity vy = z[3] # m/s, skydiver vertical velocity # derived values v = np.sqrt(vx**2+vy**2) # m/s, magnitude of velocity Fx = -c * vx**2 Fy = -m*g + c*vy**2 # calculate derivatives dxdt = vx dydt = vy dvxdt = Fx / m dvydt = Fy / m dzdt = [dxdt,dydt,dvxdt,dvydt] return dzdt
- initial conditions
z0 = [0,5000,50,0]
- time points
t = np.linspace(0,90,91)
- solve
z1 = odeint(skydive,z0,t)
- parse results
x = z1[:,0] y = z1[:,1] vx = z1[:,2] vy = z1[:,3] v = np.sqrt(vx**2+vy**2)
- Simultaneous method with APMonitor
- install and load APMonitor
try:
from APMonitor import *
except:
import pip pip.main(['install','APMonitor']) from APMonitor import *
- solve model
z2 = apm_solve('skydiver',7)
- Plot results
import matplotlib.pyplot as plt
plt.figure(1) plt.subplot(2,1,1) plt.plot(t,x,'r-',linewidth=2) plt.plot(t,y,'b-',linewidth=2) plt.plot(z2['time'],z2['x'],'r:',linewidth=3) plt.plot(z2['time'],z2['y'],'b--',linewidth=3) plt.ylabel('Position (m)') plt.legend(['ODEINT x','ODEINT y','APM x','APM y'])
plt.subplot(2,1,2) plt.plot(t,vx,'r-',linewidth=2) plt.plot(t,vy,'b-',linewidth=2) plt.plot(t,v,'k-',linewidth=2) plt.plot(z2['time'],z2['vx'],'r--',linewidth=3) plt.plot(z2['time'],z2['vy'],'b--',linewidth=3) plt.plot(z2['time'],z2['v'],'k--',linewidth=3) plt.xlabel('Time (sec)') plt.ylabel('Velocity (m/s)') plt.legend(['ODEINT V_x','ODEINT V_y','ODEINT V', 'APM V_x','APM V_y','APM V'])
plt.figure(2) plt.plot(z2['x'],z2['y'],'r-') plt.xlabel('Position (x)') plt.ylabel('Position (y)') plt.show() (:sourceend:)
(:source lang=python:)
- Sequential method with SciPy.integrate.odeint
import numpy as np from scipy.integrate import odeint
def skydive(z,t):
# constants g = 9.81 # m/s^2, gravitational constant m = 80 # kg, mass of skydiver and pack if t<61: c = 0.2 # N-s^2/m^2, drag coefficient, chute closed else: c = 10.0 # N-s^2/m^2, drag coefficient, chute open # states (z) x = z[0] # meters, horizontal position y = z[1] # meters, vertical position / elevation vx = z[2] # m/s, skydiver horizontal velocity = airplane velocity vy = z[3] # m/s, skydiver vertical velocity # derived values v = np.sqrt(vx**2+vy**2) # m/s, magnitude of velocity Fx = -c * vx**2 Fy = -m*g + c*vy**2 # calculate derivatives dxdt = vx dydt = vy dvxdt = Fx / m dvydt = Fy / m dzdt = [dxdt,dydt,dvxdt,dvydt] return dzdt
- initial conditions
z0 = [0,5000,50,0]
- time points
t = np.linspace(0,90,91)
- solve
z1 = odeint(skydive,z0,t)
- parse results
x = z1[:,0] y = z1[:,1] vx = z1[:,2] vy = z1[:,3] v = np.sqrt(vx**2+vy**2)
- Simultaneous method with APMonitor
- install and load APMonitor
try:
from APMonitor import *
except:
import pip pip.main(['install','APMonitor']) from APMonitor import *
- solve model
z2 = apm_solve('skydiver',7)
- Plot results
import matplotlib.pyplot as plt
plt.figure(1) plt.subplot(2,1,1) plt.plot(t,x,'r-',linewidth=2) plt.plot(t,y,'b-',linewidth=2) plt.plot(z2['time'],z2['x'],'r:',linewidth=3) plt.plot(z2['time'],z2['y'],'b--',linewidth=3) plt.ylabel('Position (m)') plt.legend(['ODEINT x','ODEINT y','APM x','APM y'])
plt.subplot(2,1,2) plt.plot(t,vx,'r-',linewidth=2) plt.plot(t,vy,'b-',linewidth=2) plt.plot(t,v,'k-',linewidth=2) plt.plot(z2['time'],z2['vx'],'r--',linewidth=3) plt.plot(z2['time'],z2['vy'],'b--',linewidth=3) plt.plot(z2['time'],z2['v'],'k--',linewidth=3) plt.xlabel('Time (sec)') plt.ylabel('Velocity (m/s)') plt.legend(['ODEINT V_x','ODEINT V_y','ODEINT V', 'APM V_x','APM V_y','APM V'])
plt.figure(2) plt.plot(z2['x'],z2['y'],'r-') plt.xlabel('Position (x)') plt.ylabel('Position (y)') plt.show() (:sourceend:)
(:source lang=python:)
- Sequential method with SciPy.integrate.odeint
import numpy as np from scipy.integrate import odeint
def skydive(z,t):
# constants g = 9.81 # m/s^2, gravitational constant m = 80 # kg, mass of skydiver and pack if t<61: c = 0.2 # N-s^2/m^2, drag coefficient, chute closed else: c = 10.0 # N-s^2/m^2, drag coefficient, chute open # states (z) x = z[0] # meters, horizontal position y = z[1] # meters, vertical position / elevation vx = z[2] # m/s, skydiver horizontal velocity = airplane velocity vy = z[3] # m/s, skydiver vertical velocity # derived values v = np.sqrt(vx**2+vy**2) # m/s, magnitude of velocity Fx = -c * vx**2 Fy = -m*g + c*vy**2 # calculate derivatives dxdt = vx dydt = vy dvxdt = Fx / m dvydt = Fy / m dzdt = [dxdt,dydt,dvxdt,dvydt] return dzdt
- initial conditions
z0 = [0,5000,50,0]
- time points
t = np.linspace(0,90,91)
- solve
z1 = odeint(skydive,z0,t)
- parse results
x = z1[:,0] y = z1[:,1] vx = z1[:,2] vy = z1[:,3] v = np.sqrt(vx**2+vy**2)
- Simultaneous method with APMonitor
- install and load APMonitor
try:
from APMonitor import *
except:
import pip pip.main(['install','APMonitor']) from APMonitor import *
- solve model
z2 = apm_solve('skydiver',7)
- Plot results
import matplotlib.pyplot as plt
plt.figure(1) plt.subplot(2,1,1) plt.plot(t,x,'r-',linewidth=2) plt.plot(t,y,'b-',linewidth=2) plt.plot(z2['time'],z2['x'],'r:',linewidth=3) plt.plot(z2['time'],z2['y'],'b--',linewidth=3) plt.ylabel('Position (m)') plt.legend(['ODEINT x','ODEINT y','APM x','APM y'])
plt.subplot(2,1,2) plt.plot(t,vx,'r-',linewidth=2) plt.plot(t,vy,'b-',linewidth=2) plt.plot(t,v,'k-',linewidth=2) plt.plot(z2['time'],z2['vx'],'r--',linewidth=3) plt.plot(z2['time'],z2['vy'],'b--',linewidth=3) plt.plot(z2['time'],z2['v'],'k--',linewidth=3) plt.xlabel('Time (sec)') plt.ylabel('Velocity (m/s)') plt.legend(['ODEINT V_x','ODEINT V_y','ODEINT V', 'APM V_x','APM V_y','APM V'])
plt.figure(2) plt.plot(z2['x'],z2['y'],'r-') plt.xlabel('Position (x)') plt.ylabel('Position (y)') plt.show() (:sourceend:)
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB and APM Python as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB or APM Python as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB or Python script to simulate and display the results. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB (ode23, ode15s, etc) or Python (ODEINT) script to simulate and display the results. Simulate with APM MATLAB and APM Python as well. Compare the sequential (ODE integrators in MATLAB / Python) versus the simultaneous method (APMonitor). Observe how the number of time points in APMonitor affects the solution accuracy. Estimated Time: 1 hour
Objective: Provide a basic introduction to dynamic system modeling and simulation with the equations of motion. Create a MATLAB or Python script to simulate and display the results. Estimated Time: 1 hour
<iframe width="560" height="315" src="https://www.youtube.com/embed/y0ERNz5Kms8?rel=0" frameborder="0" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/2FeOaGUQwKA?rel=0" frameborder="0" allowfullscreen></iframe>
(video of solution)
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/y0ERNz5Kms8?rel=0" frameborder="0" allowfullscreen></iframe> (:htmlend:)
Develop a mathematical description of the motion of a falling object (e.g. skydiver) in one dimension where there is a frictional resistance that is proportional to the square of the velocity. Solve the equations numerically.
Integrate the system from zero initial time to terminal velocity and assume that the object is initially at rest. Assume a gravitational constant of 9.8 m/s2, a mass of 80 kg, and a frictional loss coefficient of 0.2 N-s2/m2.
Predict the position and velocity of a skydiver in two dimensions (horizontal and vertical) from the time of the initial jump through the first 90 seconds. At 60 seconds after the jump, the skydiver pulls the chute and the drag coefficient increases to slow the decent. The airplane is flying at a constant altitude of 5000 meters and 50 m/s when the skydiver jumps. The drag coefficient is 0.2 N-s2/m2 while free-falling and 10 N-s2/m2 with the parachute open. The gravitational constant is 9.8 m/s2 and the mass is 80 kg for the skydiver and chute.
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations numerically.
Integrate the system from zero initial time to steady state conditions and assume that the object is initially at rest. Assume a force of 5 N, a mass of 10 kg, and a frictional loss coefficient of 0.2 N-s/m.
Develop a mathematical description of the motion of a falling object (e.g. skydiver) in one dimension where there is a frictional resistance that is proportional to the square of the velocity. Solve the equations numerically.
Integrate the system from zero initial time to terminal velocity and assume that the object is initially at rest. Assume a gravitational constant of 9.8 m/s2, a mass of 80 kg, and a frictional loss coefficient of 0.2 N-s2/m2.
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/y0ERNz5Kms8?rel=0" frameborder="0" allowfullscreen></iframe> (:htmlend:)
Numerical Solution of Differential Equations
Excel, MATLAB, Python, and Simulink are used in the following example to solve the differential equation that describes the velocity of a vehicle.
Excel, MATLAB, Python, and Simulink are used in the following example to solve the differential equation that describes the velocity of a vehicle.
Excel, MATLAB, and Python are used in the following example to solve the differential equation that describes the velocity of a vehicle.
Excel, MATLAB, Python, and Simulink are used in the following example to solve the differential equation that describes the velocity of a vehicle.
(:html:) <iframe width="560" height="315" src="https://www.youtube.com/embed/VRs9gX6r1Ng?rel=0" frameborder="0" allowfullscreen></iframe> (:htmlend:)
Numerical Solution for Differential Equations
Numerical Solution of Differential Equations
Numerical Solution for Differential Equations
Excel, MATLAB, and Python are used in the following example to solve the differential equation that describes the velocity of a vehicle.
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations analytically and numerically.
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations numerically.
(video of numerical solution, APM MATLAB, APM Python, APMonitor - show how error changes with refined discretization)
0 = f(dx/dt,x,p) 0 < g(dx/dt,x,p)
0 = f(dx/dt,x,p) 0 < g(dx/dt,x,p)
y = a t2/2 + v0 t + y_0
y = a t2/2 + v0 t + y0
v = a t + v_0_ y = a t2/2 + v_0_ t + y_0
v = a t + v0 y = a t2/2 + v0 t + y_0
Notice that the initial condition for acceleration (a_0_) does not appear in the solution but initial conditions for velocity (v_0_) and position (y_0_) do influence the solution. If the force (F) changes at any time in the future, the time horizon is divided into separate segments where the force is constant. The first segment is computed and the final values become the initial values for the next segment.
Notice that the initial condition for acceleration (a0) does not appear in the solution but initial conditions for velocity (v0) and position (y0) do influence the solution. If the force (F) changes at any time in the future, the time horizon is divided into separate segments where the force is constant. The first segment is computed and the final values become the initial values for the next segment.
f(dx/dt,x,p)=0, Semi-Explicit ODE Form f(dx/dt,x,p)=0, Open Equation ODE Form
In the case of the object motion, the acceleration that is applied to the object may be the parameter that can be manipulated by the user or optimizer. The relationship between acceleration (a) and force (F) includes another parameter, the mass of the object (m). There are now three equations that describe the motion of the system and relate force (F) to acceleration (a), velocity (v), and position (y).
dx/dt = f(x,p), Semi-Explicit Form f(dx/dt,x,p)=0, Open Equation Form
In the case of the object motion, the acceleration is not typically manipulated directly but may be adjusted by a force that is acting on that object. The relationship between acceleration (a) and force (F) includes another parameter, the mass of the object (m). There are now three equations that describe the motion of the system and relate force (F) to acceleration (a), velocity (v), and position (y).
(video of analytic solution)
(video - Analytic & Numerical Solutions)
(video of numerical solution, APM MATLAB, APM Python, APMonitor - show how error changes with refined discretization)
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations analytically and numerically and determine the numerical error with finer discretization.
Integrate the system from zero initial time to steady state and assume that the object is initially at rest.
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations analytically and numerically.
Integrate the system from zero initial time to steady state conditions and assume that the object is initially at rest. Assume a force of 5 N, a mass of 10 kg, and a frictional loss coefficient of 0.2 N-s/m.
Solution
(video of solution)
The focus of this course is on modeling, simulation, estimation, and optimization of dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines.
The focus of this course is on modeling, simulation, estimation, and optimization of dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines. The examples are particularly focused on engineering applications although much of the theory and applications can also be applied to other fields as well.
The discussion starts with modeling because a reasonably accurate model of the system must first be created to approximate input to output relationships between values that can be adjusted (inputs) and those values that are used to judge the desirability of solution (outputs).
Dynamic systems can often be described as differential equations. One example is the equations of motion for an object in a friction-less environment in one dimension. In this case velocity (v) is the equal to the time-derivative of position (y) and acceleration (a) is the time-derivative of velocity.
Dynamic systems can often be described with differential equations. The equations can either be derived empirically from data or from fundamental relationships. One example of fundamental relationships are equations of motion for an object in a friction-less environment in one dimension. In this case velocity (v) is the equal to the time-derivative of position (y) and acceleration (a) is the time-derivative of velocity.
Analytic Solutions
An exact solution x(t) may exist from an analytic approach to solving the differential equations. In the in example case, the solution is found by integrating both sides of the differential equations. With the object initially at rest, this translates to zero initial conditions. An initial condition must be specified for each differential variable (those variables that appear in differential terms). In this case, the acceleration a is determined by the first equation but does not appear in differential form such as da/dt. Values of the parameters must be specified over the selected integration time horizon. The time horizon spans from the initial time where the initial conditions are specified to a future time tf. Suppose there is a constant force (F=5) applied to the body starting at t0=0. The analytic solution is then
Analytic Solution
An exact solution x(t) may exist from an analytic approach to solving the differential equations. In the in example case, the solution is found by integrating both sides of the differential equations. With the object initially at rest, this translates to zero initial conditions. An initial condition must be specified for each differential variable (those variables that appear in differential terms). In this case, the acceleration a is determined by the first equation but does not appear in differential form such as da/dt. Values of the parameters must be specified over the selected integration time horizon. The time horizon spans from the initial time where the initial conditions are specified to a future time tf. Suppose there is a constant force (F=5) applied to the body starting at t0=0. The analytic solution is then solved as a function of time.
v = a t = F t/m y = v(t)2/2
Numerical Solutions
Another method to solve dynamic system is with a numerical approach that approximates the exact solution x(t) at discrete time intervals, much like measuring a physical system at particular time points. The numerical approach is able to solve much larger and more complex systems of equations, especially when an analytic solution does not exist.
Mathematical Description
v = a t + v_0_ y = a t2/2 + v_0_ t + y_0
Notice that the initial condition for acceleration (a_0_) does not appear in the solution but initial conditions for velocity (v_0_) and position (y_0_) do influence the solution. If the force (F) changes at any time in the future, the time horizon is divided into separate segments where the force is constant. The first segment is computed and the final values become the initial values for the next segment.
Numerical Solution
Another method to solve dynamic system is with a numerical approach that approximates the exact solution x(t) at discrete time intervals, much like measuring a physical system at particular time points. The numerical approach is able to solve much larger and more complex systems of equations, especially when the exact analytic solution does not exist. One drawback to numerical solutions is that the accuracy of the solution is not exact and depends on factors such as the discretization methods employed and the error tolerance of the solver before convergence is confirmed.
(video - Analytic & Numerical Solutions)
Mathematical Description of Dynamic Systems
0 = f(dx/dt,x) 0 < g(dx/dt,x)
In this case, the differential (f1) and algebraic (f2) are condensed into f(dx/dt,x) and any algebraic expressions simply omit the derivative terms. Expressions may either be equality (f) or inequality (g) constraints.
A standard form for describing a system is as a collection of differential and algebraic expressions.
Dynamic models can be converted to steady state models by setting any
The focus of this course is on dynamic systems or those that change with time. It is particularly focused on engineering applications although much of the theory and applications could also be applied to other fields as well.
Dynamic systems
The speed of computers doubles approximately every 18 months. From 2000-2015 the speed of computers increased by about 1000 times.
Dynamic optimization is simulation and
0 = f(dx/dt,x,p) 0 < g(dx/dt,x,p)
In this case, the differential and algebraic equations are condensed into f(dx/dt,x) and any algebraic expressions simply omit the derivative terms. Expressions may either be equality (f) or inequality (g) constraints.
Exercise
Develop a mathematical description of the motion of an object in one dimension where there is a frictional resistance that is proportional to the velocity. Solve the equations analytically and numerically and determine the numerical error with finer discretization.
Integrate the system from zero initial time to steady state and assume that the object is initially at rest.
An exact solution x(t) may exist from an analytic approach to solving the differential equations. In the in example case, the solution is found by integrating both sides of the differential equations. With the object initially at rest, this translates to zero initial conditions. An initial condition must be specified for each differential variable (those variables that appear in differential terms). In this case, the acceleration a is determined by the first equation but does not appear in differential form such as da/dt. Values of the parameters must be specified over the selected integration time horizon. The time horizon spans from the initial time where the initial conditions are specified to a future time tf.
a(t) = F/m v(t) = a(t)2/2 y(t) = v(t)2/2
An exact solution x(t) may exist from an analytic approach to solving the differential equations. In the in example case, the solution is found by integrating both sides of the differential equations. With the object initially at rest, this translates to zero initial conditions. An initial condition must be specified for each differential variable (those variables that appear in differential terms). In this case, the acceleration a is determined by the first equation but does not appear in differential form such as da/dt. Values of the parameters must be specified over the selected integration time horizon. The time horizon spans from the initial time where the initial conditions are specified to a future time tf. Suppose there is a constant force (F=5) applied to the body starting at t0=0. The analytic solution is then
a = F/m v = a t = F t/m y = v(t)2/2
Dynamic systems can often be posed as differential equations. One example is the equations of motion for an object in a friction-less environment in one dimension. In this case velocity (v) is the equal to the time-derivative of position (y) and acceleration (a) is the time-derivative of velocity.
Dynamic systems can often be described as differential equations. One example is the equations of motion for an object in a friction-less environment in one dimension. In this case velocity (v) is the equal to the time-derivative of position (y) and acceleration (a) is the time-derivative of velocity.
The above differential equations are expressed in semi-explicit form where the derivative terms are isolated on the left side of the equation and all other variables are on the right side of the expression. A more general notation for the semi-explicit form is dx/dt = f(x,p) where f(x,p) is any combination of variables (x) or parameters (p). Variables (x) are those values that are determined by the solution of the equations while parameters (p) are those quantities that are either specified by a user or determined by an optimizer.
In the case of the object motion, the acceleration that is applied to the object may be the parameter that can be manipulated by the user or optimizer. arbitrarilythat is object
A more general form for differential equations is the open-equation format as (f(dx/dt,x,p)=0)
and algebraic (f2(x)=0) equations with variables x. These collections of equations are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are simplified to Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
The above differential equations are expressed in semi-explicit form where the derivative terms are isolated on the left side of the equation and all other variables are on the right side of the expression. A more general notation for the semi-explicit form is dx/dt = f(x,p) where f(x,p) is any combination of variables (x) or parameters (p). Variables (x) are those values that are determined by the solution of the equations while parameters (p) are those quantities that are either specified by a user or determined by an optimizer. A more general form for differential equations is the open-equation format as f(dx/dt,x,p)=0 where all terms are brought to one side of the equation.
f(dx/dt,x,p)=0, Semi-Explicit ODE Form f(dx/dt,x,p)=0, Open Equation ODE Form
In the case of the object motion, the acceleration that is applied to the object may be the parameter that can be manipulated by the user or optimizer. The relationship between acceleration (a) and force (F) includes another parameter, the mass of the object (m). There are now three equations that describe the motion of the system and relate force (F) to acceleration (a), velocity (v), and position (y).
F = m a dy/dt = v dv/dt = a
The equation F = m a is an algebraic equation with no differential terms. While it would be simple to eliminate a from the equation by substituting for F/m, suppose that it is not possible or convenient to rearrange the equations to eliminate the algebraic expressions. This collection of equations is now referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are simplified to Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives (not spatial derivatives) are present.
Dynamic systems are those where values that describe the system are expected to evolve over time and not necessarily remain at a steady state. When a dynamic system is at steady state, all time derivative values are zero (dx/dt=0).
Dynamic systems are those where values that describe the system are expected to evolve over time and not necessarily remain at a steady state. When a dynamic system is at steady state, all time derivative values are either set to zero (dx/dt=0) or do not otherwise appear in the equations.
For physical dynamic systems the values of x may be measured at specific times. For virtual or simulated dynamic systems there can either be analytic solutions or numerical solutions. An exact solution x(t) may exist from an analytic approach to solving the differential equations.
For physical systems the values of x may be measured at specific times. For virtual or simulated dynamic systems there can either be analytic solutions or a numerical solution.
Analytic Solutions
An exact solution x(t) may exist from an analytic approach to solving the differential equations. In the in example case, the solution is found by integrating both sides of the differential equations. With the object initially at rest, this translates to zero initial conditions. An initial condition must be specified for each differential variable (those variables that appear in differential terms). In this case, the acceleration a is determined by the first equation but does not appear in differential form such as da/dt. Values of the parameters must be specified over the selected integration time horizon. The time horizon spans from the initial time where the initial conditions are specified to a future time tf.
a(t) = F/m v(t) = a(t)2/2 y(t) = v(t)2/2
Numerical Solutions
The focus of this course is on modeling, simulation, estimation, and optimization for dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines.
The focus of this course is on modeling, simulation, estimation, and optimization of dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines.
Dynamic systems can often be posed as collections of differential (f1(dx/dt,x)=0 and algebraic (f2(x)=0) equations with variables x. These collections of equations are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are simplified to Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
Dynamic systems can often be posed as differential equations. One example is the equations of motion for an object in a friction-less environment in one dimension. In this case velocity (v) is the equal to the time-derivative of position (y) and acceleration (a) is the time-derivative of velocity.
dy/dt = v dv/dt = a
The above differential equations are expressed in semi-explicit form where the derivative terms are isolated on the left side of the equation and all other variables are on the right side of the expression. A more general notation for the semi-explicit form is dx/dt = f(x,p) where f(x,p) is any combination of variables (x) or parameters (p). Variables (x) are those values that are determined by the solution of the equations while parameters (p) are those quantities that are either specified by a user or determined by an optimizer.
In the case of the object motion, the acceleration that is applied to the object may be the parameter that can be manipulated by the user or optimizer. arbitrarilythat is object
A more general form for differential equations is the open-equation format as (f(dx/dt,x,p)=0)
and algebraic (f2(x)=0) equations with variables x. These collections of equations are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are simplified to Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
Differential Algebraic Equations
Dynamic systems can often be posed as collections of differential (f1(dx/dt,x)=0 and algebraic (f2(x)=0) equations. These collections are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are referred to as Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
Dynamic Systems
Dynamic systems can often be posed as collections of differential (f1(dx/dt,x)=0 and algebraic (f2(x)=0) equations with variables x. These collections of equations are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are simplified to Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
Another method to solve DAEs is with a numerical approach that approximates the exact solution x(t) at discrete time intervals, much like measuring a physical system at particular time points. The numerical approach is able to solve much larger and more complex systems of equations, especially when an analytic solution does not exist.
Mathematical Description of DAEs
Models are collections of assumptions, mathematical expressions, boundary conditions, initial conditions, and constraints. These mathematical expressions can range from a simple equation of motion for an object in a frictionless environment to complex systems that describe multi-body physics and interactions. A standard model form is shown below:
Another method to solve dynamic system is with a numerical approach that approximates the exact solution x(t) at discrete time intervals, much like measuring a physical system at particular time points. The numerical approach is able to solve much larger and more complex systems of equations, especially when an analytic solution does not exist.
Mathematical Description
Models are not just equations but are collections of assumptions, mathematical expressions, boundary conditions, initial conditions, and constraints. These mathematical expressions can range from a simple equation of motion for an object in a frictionless environment to complex systems that describe multi-body physics and interactions. A standard model form is shown below:
In this case, the differential (f1) and algebraic (f2) are condensed into f(dx/dt,x) and any algebraic expressions simply omit the derivative terms.
Values that describe
A standard form for describing a system is as a collection of differential and algebraic expressions. These may either be equality (f) or inequality (g) constraints. The variables (x)
In this case, the differential (f1) and algebraic (f2) are condensed into f(dx/dt,x) and any algebraic expressions simply omit the derivative terms. Expressions may either be equality (f) or inequality (g) constraints.
A standard form for describing a system is as a collection of differential and algebraic expressions.
The focus of this course is on modeling, simulation, estimation, and optimization for dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of optimization in engineering disciplines.
Dynamic versus Steady State Numerical Solution
Dynamic systems are those where certain values that describe the system are expected to evolve over time and not necessarily remain at a steady state.
Steady state: Values (x) do not change with time Dynamic: At least one value (x) changes with time
Values of x may be measured at specific times or an expression may exist from an analytic solution of the differential equations as x(t). Differential equations are those in which a Another method to solve dynamic
Mathematical Description
The focus of this course is on modeling, simulation, estimation, and optimization for dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of dynamic optimization in engineering disciplines.
Differential Algebraic Equations
Dynamic systems can often be posed as collections of differential (f1(dx/dt,x)=0 and algebraic (f2(x)=0) equations. These collections are referred to as Differential Algebraic Equations (DAEs). When there are no algebraic expressions, the system of equations are referred to as Ordinary Differential Equations (ODEs). If the differential equations have spatial and temporal derivatives, they become Partial Differential Equations (PDEs). For the purpose of this modeling discussion, any PDEs are discretized in space to return to ODE or DAE form where only time derivatives are present.
Dynamic versus Steady State
Dynamic systems are those where values that describe the system are expected to evolve over time and not necessarily remain at a steady state. When a dynamic system is at steady state, all time derivative values are zero (dx/dt=0).
Steady state: Values (x) do not change with time Dynamic: At least one value (x) changes with time
For physical dynamic systems the values of x may be measured at specific times. For virtual or simulated dynamic systems there can either be analytic solutions or numerical solutions. An exact solution x(t) may exist from an analytic approach to solving the differential equations.
Another method to solve DAEs is with a numerical approach that approximates the exact solution x(t) at discrete time intervals, much like measuring a physical system at particular time points. The numerical approach is able to solve much larger and more complex systems of equations, especially when an analytic solution does not exist.
Mathematical Description of DAEs
0 = f(dx/dt,x) 0 < g(dx/dt,x)
In this case, the differential (f1) and algebraic (f2) are condensed into f(dx/dt,x) and any algebraic expressions simply omit the derivative terms.
A standard form for describing a system is as a collection of differential and algebraic expressions. These may either be equality (f) or inequality (g) constraints. The variables (x)
A standard form for describing a system is as a collection of differential and algebraic expressions. These may either be equality (f) or inequality (g) constraints. The variables (x)
'Dynamic' systems
Dynamic systems
The focus of this course is on modeling, simulation, estimation, and optimization for dynamic systems. This section of the course starts with dynamic modeling or methods to mathematically describe time-evolving systems, particularly for the purpose of optimization in engineering disciplines.
Dynamic versus Steady State Numerical Solution
Dynamic systems are those where certain values that describe the system are expected to evolve over time and not necessarily remain at a steady state.
Steady state: Values (x) do not change with time Dynamic: At least one value (x) changes with time
Values of x may be measured at specific times or an expression may exist from an analytic solution of the differential equations as x(t). Differential equations are those in which a Another method to solve dynamic
Mathematical Description
Models are collections of assumptions, mathematical expressions, boundary conditions, initial conditions, and constraints. These mathematical expressions can range from a simple equation of motion for an object in a frictionless environment to complex systems that describe multi-body physics and interactions. A standard model form is shown below:
Values that describe
A standard form for describing a system is as a collection of differential and algebraic expressions. These may either be equality (f) or inequality (g) constraints. The variables (x)
Dynamic models can be converted to steady state models by setting any
The focus of this course is on dynamic systems or those that change with time. It is particularly focused on engineering applications although much of the theory and applications could also be applied to other fields as well.
'Dynamic' systems
The speed of computers doubles approximately every 18 months. From 2000-2015 the speed of computers increased by about 1000 times.
Dynamic optimization is simulation and
(:title Introduction to Dynamic Modeling:) (:keywords dynamic modeling, engineering, differential, algebraic, modeling language, tutorial:) (:description Dynamic modeling with Differential Algebraic Equations (DAEs):)