Difference between revisions of "Dynamic models - 2014"

From Process Control: 3P4
Jump to navigation Jump to search
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ClassSidebar
{{ClassSidebarYouTube
| date = 13 to 24 January 2014
| date = 13 to 07 February 2014
| dates_alt_text =  
| dates_alt_text =  
| vimeoID1 = 84058665
| vimeoID1 = Ju2laBXojzo
| vimeoID2 = 84228691
| vimeoID2 = Hpd_dNi11Gk
| vimeoID3 = 84412337
| vimeoID3 = lGa3JE5CTf8
| vimeoID4 = 84607743
| vimeoID4 = 5VYER15Trwg
| vimeoID5 = 84781274
| vimeoID5 = 6YwhQgFcGyk
| vimeoID6 =
| vimeoID6 = JeKFYhxGNLM
| vimeoID7 =
| vimeoID7 = 9bs2s4UXxWA
| vimeoID8 =
| vimeoID8 = uM5mLfNIFbo
| vimeoID9 =
| vimeoID9 = 2wNaCkFykyE
| vimeoID10 =
| vimeoID10 = rfWtzi2QAF0
| vimeoID11 =
| vimeoID11 = drXKr5BYA4o
| vimeoID12 = SAF1kb8RN-M
| course_notes_PDF =  
| course_notes_PDF =  
| course_notes_alt = Course notes
| course_notes_alt = Course notes
Line 30: Line 31:
| video_download_link4_MP4_size = 367 M
| video_download_link4_MP4_size = 367 M
| video_notes4 =
| video_notes4 =
| video_download_link5_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp4
| video_download_link5_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-03B.mp4
| video_download_link5_MP4_size = 305 M
| video_download_link5_MP4_size = 305 M
| video_notes5 =
| video_notes5 =
| video_download_link6_MP4 =  
| video_download_link6_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-03C.mp4
| video_download_link6_MP4_size = M
| video_download_link6_MP4_size = 317 M
| video_notes6 =
| video_notes6 =
| video_download_link7_MP4 =
| video_download_link7_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-04A.mp4
| video_download_link7_MP4_size = M
| video_download_link7_MP4_size = 294 M
| video_notes7 =
| video_notes7 =
| video_download_link8_MP4 =
| video_download_link8_MP4 =http://learnche.mcmaster.ca/media/2014-3P4-Class-04B.mp4
| video_download_link8_MP4_size = M
| video_download_link8_MP4_size = 271 M
| video_notes8 =
| video_notes8 =
| video_download_link9_MP4 =
| video_download_link9_MP4 =http://learnche.mcmaster.ca/media/2014-3P4-Class-04C.mp4
| video_download_link9_MP4_size = M
| video_download_link9_MP4_size = 322 M
| video_notes9 =
| video_notes9 =
| video_download_link10_MP4 =  
| video_download_link10_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-05A.mp4
| video_download_link10_MP4_size = M
| video_download_link10_MP4_size = 287 M
| video_notes10 =
| video_notes10 =
| video_download_link11_MP4 =  
| video_download_link11_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-05B.mp4
| video_download_link11_MP4_size = M
| video_download_link11_MP4_size = 267 M
| video_notes11 =}}__NOTOC__
| video_notes11 =
| video_download_link12_MP4 = http://learnche.mcmaster.ca/media/2014-3P4-Class-05C.mp4
| video_download_link12_MP4_size = 215 M
| video_notes12 =}}__NOTOC__


<!-- == Topics covered in this section==
== Readings and preparation for class; video and audio files ==
 
* What are the elements in a control loop
* Explain what feedback control is
* Be able to apply feedback manually to a chemical process
* What the objectives for control are
* What the benefits of Process Control are
* How we can quantify Process Control benefits
-->


== Readings and preparation for class; video and audio files ==
* Main reference: Marlin textbook, Chapter 3, Chapter 4, Chapter 5, and Appendix B
* Alternative reference: Seborg textbook, Chapters 2, 3, 4 and 5


{| class="wikitable"  style="text-align: center;"
{| class="wikitable"  style="text-align: center;"
Line 69: Line 66:
! Class number
! Class number
! colspan="2"|Video and audio files
! colspan="2"|Video and audio files
! Reading (Marlin)
! Main concepts
! Reading (Seborg*)
! Reading (other)
! Reading (other)
! Handout
! Handout
|-
|-
| 13 January
| 13 January
Line 79: Line 74:
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02A.mp4 Video] (361M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02A.mp4 Video] (361M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02A.mp3 Audio] (42M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02A.mp3 Audio] (42M)  
| rowspan="6" |Chapter 3, Chapter 4 and Appendix B
| style="text-align: left;"|  
| rowspan="6" |Chapters 2, 3, 4 and 5
* Why we need process models
* What is "steady state"
* General balance equations
* Derived the tank height model
| rowspan="2" style="text-align: left;"|
| rowspan="2" style="text-align: left;"|
* Your <tt>3E4</tt> notes on dynamic models and ODEs.  
* Your [https://learnche.org/3E4 <tt>3E4</tt> notes on dynamic models and ODEs].  
* Any math textbook on the ''Integrating Factor'' (or Appendix B in Marlin)
* Any math textbook on the ''Integrating Factor'' (or Appendix B in Marlin)
* [[Software_for_integrating_ODEs|MATLAB software for numerical integration]]
* [[Software_for_integrating_ODEs|MATLAB software for numerical integration]]
Line 91: Line 89:
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02B.mp4 Video] (364M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02B.mp4 Video] (364M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02B.mp3 Audio] (43M)   
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02B.mp3 Audio] (43M)   
| style="text-align: left;"|
* Use of the integrating factor
* Analytical solution of the tank height model
* MATLAB solution of ODEs
| None
| None
|-
|-
Line 97: Line 99:
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02C.mp4 Video] (227M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02C.mp4 Video] (227M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02C.mp3 Audio] (42M)   
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-02C.mp3 Audio] (42M)   
| style="text-align: left;"|
* Coffee cooling example
* What is the Laplace transform
* Using Laplace to solve the coffee cooling problem
| rowspan="2" style="text-align: left;"|  
| rowspan="2" style="text-align: left;"|  
:An amazing description of where the Laplace transform comes from: [http://www.youtube.com/watch?v=zvbdoSeGAgI Video 1] and continues [http://www.youtube.com/watch?v=hqOboV2jgVo with video 2]
:An amazing description of where the Laplace transform comes from: [http://www.youtube.com/watch?v=zvbdoSeGAgI Video 1] and continues [http://www.youtube.com/watch?v=hqOboV2jgVo with video 2]
| rowspan="2"| [http://learnche.mcmaster.ca/media/mcmaster/2014-3P4-02C-Laplace-Transforms.pdf Table of Laplace transforms] (from Seborg)
| rowspan="2"| [[Media:2014-3P4-02C-Laplace-Transforms.pdf| Table of Laplace transforms]] (from Seborg)
|-
|-
| 20 January
| 20 January
Line 105: Line 111:
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp4 Video] (367M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp4 Video] (367M)  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp3 Audio] (43M)   
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp3 Audio] (43M)   
| style="text-align: left;"|
* Review the coffee example
* Initial value and final value theorems
* Using deviation variables
* Solve coffee example in deviation form
|-
|-
| 22 January
| 22 January
| 03B
| 03B
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp4 Video] (305M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03B.mp4 Video] (305M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03A.mp3 Audio] (42M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03B.mp3 Audio] (42M)
| style="text-align: left;"|
* Reviewed deviation variables, IVT and FVT
* The tank height problem in deviation form
* Deriving a transfer function for the tank height for varying inlet flow
| None
| None
| None
| None
Line 115: Line 130:
| 24 January
| 24 January
| 03C
| 03C
|  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03C.mp4 Video] (317M)
|  
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-03C.mp3 Audio] (42M)
| style="text-align: left;"|
* Confirming understanding of a transfer function (TF)
* How to find system's output, for a given input
* Chaining up TFs for systems in series
* Learning about "pure gain" systems
| None
| None
|-
| 27 January
| 04A
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04A.mp4 Video] (294M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04A.mp3 Audio] (41M)
| style="text-align: left;"|
* combining transfer functions in series
* linearization of nonlinear functions
* basic block diagrams
| None
| None
|-
| 29  January
| 04B
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04B.mp4 Video] (271M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04B.mp3 Audio] (43M)
| style="text-align: left;"|
* linearization
* block diagrams for series and parallel systems
* time delays
| None
| None
| None
|-
| 31 January
| 04C
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04C.mp4 Video] (322 M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-04C.mp3 Audio] (44 M)
| style="text-align: left;"|
* time delay derivation and interpretation
* first order system theory
* composite input example
| See code below for class 04C
| None
|-
| 03 February
| 05A
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05A.mp4 Video] (287 M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05A.mp3 Audio] (42 M)
| style="text-align: left;"|
* review of all work covered in weeks 1 to 4
* assignment 3, question 3
| None
| [[Media:Developing-process-models.pdf|Developing process models]]
|-
| 05 February
| 05B
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05B.mp4 Video] (267 M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05B.mp3 Audio] (45 M)
| style="text-align: left;"|
* composite inputs
* formal introduction to second order systems
* question period
| rowspan="2"|
[http://hydraulicspneumatics.com/site-files/hydraulicspneumatics.com/files/uploads/2008/02/2008.06-Motion2.png Types of damping]
| None
|-
| 07 February
| 05C
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05C.mp4 Video] (267 M)
| [http://learnche.mcmaster.ca/media/2014-3P4-Class-05C.mp3 Audio] (45 M)
| style="text-align: left;"|
* wrapped up second order systems
* re-discussed the objective of control systems
| None
| None
|}
|}
<nowiki>*</nowiki> The book by Seborg ''et al''. is easily available new or second hand, as it was the prescribed textbook in 2013 (Marlin's book was prescribed in 2012). I will make reference to the chapters from Seborg on the website as well.
<nowiki>*</nowiki> The book by Seborg ''et al''. is easily available new or second hand, as it was the prescribed textbook in 2013 (Marlin's book was prescribed in 2012). I will make reference to the chapters from Seborg on the website as well.


Test your understanding before and after class with [http://www.pc-education.mcmaster.ca/Edumat.htm these resources from Dr. Thomas Marlin]. This website also contains full Powerpoint slides for each chapter from his textbook. Use this as a resource if you are still waiting for your copy of the Marlin textbook to arrive.
Test your understanding before and after class with [http://www.pc-education.mcmaster.ca/ these resources from Dr. Thomas Marlin]. This website also contains full Powerpoint slides for each chapter from his textbook. Use this as a resource to get a different teaching perspective on the same topic. It's quite OK if someone else's approach is a "better fit" for you than my approach.


== Computer code: class 02B, 15 January ==
== Computer code: class 02B, 15 January ==
Line 187: Line 272:
plot(indep, height, 'r.')
plot(indep, height, 'r.')
  </syntaxhighlight>
  </syntaxhighlight>
== Computer code: class 04C, 31 January ==
<syntaxhighlight lang="matlab">
t = 0:0.01:18;
y_regular = 3.*(1-exp(-t./4));
step_function = ones(size(t));
step_function(t<2) = 0;
y_delayed = 3.*(1-exp(-(t-2)./4)) .* step_function;
y_combined = y_regular + y_delayed;
% Show the plots
f = figure;
set(f,'Position',[440 79 841 638])
plot(t, y_regular,'b.-')
hold on
%plot(t, step_function,'k.-')  % if you want to visualize the step function
plot(t, y_delayed,'r.-')
plot(t, y_combined,'m.-')
legend('Response from 1 tank', 'Response from delayed tank', ...
    'Sum of the two responses', 'location','NorthWest')
grid on
</syntaxhighlight>

Latest revision as of 15:06, 5 November 2018

Class date(s): 13 to 07 February 2014
Download video: Link (plays in Google Chrome) [361 M]

Download video: Link (plays in Google Chrome) [364 M]

Download video: Link (plays in Google Chrome) [227 M]

Download video: Link (plays in Google Chrome) [367 M]

Download video: Link (plays in Google Chrome) [305 M]

Download video: Link (plays in Google Chrome) [317 M]

Download video: Link (plays in Google Chrome) [294 M]

Download video: Link (plays in Google Chrome) [271 M]

Download video: Link (plays in Google Chrome) [322 M]

Download video: Link (plays in Google Chrome) [287 M]

Download video: Link (plays in Google Chrome) [267 M]

Download video: Link (plays in Google Chrome) [215 M]

Readings and preparation for class; video and audio files

  • Main reference: Marlin textbook, Chapter 3, Chapter 4, Chapter 5, and Appendix B
  • Alternative reference: Seborg textbook, Chapters 2, 3, 4 and 5
Date Class number Video and audio files Main concepts Reading (other) Handout
13 January 02A Video (361M) Audio (42M)
  • Why we need process models
  • What is "steady state"
  • General balance equations
  • Derived the tank height model
None
15 January 02B Video (364M) Audio (43M)
  • Use of the integrating factor
  • Analytical solution of the tank height model
  • MATLAB solution of ODEs
None
17 January 02C Video (227M) Audio (42M)
  • Coffee cooling example
  • What is the Laplace transform
  • Using Laplace to solve the coffee cooling problem
An amazing description of where the Laplace transform comes from: Video 1 and continues with video 2
Table of Laplace transforms (from Seborg)
20 January 03A Video (367M) Audio (43M)
  • Review the coffee example
  • Initial value and final value theorems
  • Using deviation variables
  • Solve coffee example in deviation form
22 January 03B Video (305M) Audio (42M)
  • Reviewed deviation variables, IVT and FVT
  • The tank height problem in deviation form
  • Deriving a transfer function for the tank height for varying inlet flow
None None
24 January 03C Video (317M) Audio (42M)
  • Confirming understanding of a transfer function (TF)
  • How to find system's output, for a given input
  • Chaining up TFs for systems in series
  • Learning about "pure gain" systems
None None
27 January 04A Video (294M) Audio (41M)
  • combining transfer functions in series
  • linearization of nonlinear functions
  • basic block diagrams
None None
29 January 04B Video (271M) Audio (43M)
  • linearization
  • block diagrams for series and parallel systems
  • time delays
None None
31 January 04C Video (322 M) Audio (44 M)
  • time delay derivation and interpretation
  • first order system theory
  • composite input example
See code below for class 04C None
03 February 05A Video (287 M) Audio (42 M)
  • review of all work covered in weeks 1 to 4
  • assignment 3, question 3
None Developing process models
05 February 05B Video (267 M) Audio (45 M)
  • composite inputs
  • formal introduction to second order systems
  • question period

Types of damping

None
07 February 05C Video (267 M) Audio (45 M)
  • wrapped up second order systems
  • re-discussed the objective of control systems
None

* The book by Seborg et al. is easily available new or second hand, as it was the prescribed textbook in 2013 (Marlin's book was prescribed in 2012). I will make reference to the chapters from Seborg on the website as well.

Test your understanding before and after class with these resources from Dr. Thomas Marlin. This website also contains full Powerpoint slides for each chapter from his textbook. Use this as a resource to get a different teaching perspective on the same topic. It's quite OK if someone else's approach is a "better fit" for you than my approach.

Computer code: class 02B, 15 January

In a file called cstr_height.m:

function d_depnt__d_indep = cstr_height(indep, depnt)
 
% Dynamic balance for the CSTR height

%    indep: the independent ODE variable, such as time or length or the reactor
%    depnt: a VECTOR of dependent variables
% 
%    Returns:
%
%    d(depnt)
%   ---------- = a vector of ODEs
%    d(indep)
 
% Assign some variables for convenience of notation: one row per DEPENDENT variable
h = depnt(1);
 
% Constant and other equations
A = 0.5;      % m^2
F_i = 0.8;    % m^3/min
R   = 15;     % min/m^2
F_o = h/R;    % m^3/min

% Output from this ODE function must be a COLUMN vector, with n rows
% n = how many ODEs in this system?
n = numel(depnt); d_depnt__d_indep = zeros(n,1);

% Specify every element in the vector below: 1, 2, ... n
d_depnt__d_indep(1) = 1/A * (F_i - F_o);

The call the above model file from the "driver"; you can call this file anything, e.g. ODE_driver.m:

% The independent variable always requires an initial and final value:
indep_start = 0.0;  % s
indep_final = 50.0; % s
 
% Set initial condition(s): for integrating variables (dependent variables)
h_depnt_zero = 4.0;    % i.e. h(t=0) = 3.0
 
IC = [h_depnt_zero];
  
% Integrate the ODE(s):
[indep, depnt] = ode45(@c02B_linear, [indep_start, indep_final], IC);
 % Plot the results:
clf;
plot(indep, depnt(:,1))
grid('on')
hold('on')

xlabel('Time [min]')
ylabel('Tank height')
legend('h')
title('Tank height with time')

% Does it match the analytical equation?
height = 12 - 8.*exp(-indep/7.5);
hold on
plot(indep, height, 'r.')

Computer code: class 04C, 31 January

t = 0:0.01:18;
y_regular = 3.*(1-exp(-t./4));

step_function = ones(size(t));
step_function(t<2) = 0;
y_delayed = 3.*(1-exp(-(t-2)./4)) .* step_function;

y_combined = y_regular + y_delayed;

% Show the plots
f = figure;
set(f,'Position',[440 79 841 638])
plot(t, y_regular,'b.-')
hold on
%plot(t, step_function,'k.-')  % if you want to visualize the step function
plot(t, y_delayed,'r.-')
plot(t, y_combined,'m.-')

legend('Response from 1 tank', 'Response from delayed tank', ...
    'Sum of the two responses', 'location','NorthWest')
grid on