Professional Documents
Culture Documents
01/618) VR/2023
Outline
Topic 2
Topics Lectures
- Introduction to modelling, curve ~4
fitting, linear regression
Modelling
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Learning Objectives
What is a model?
5 6
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
7 8
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Model of a System
The Model:
Measurable Measurable
Inputs Outputs
solar radiation electric power
An Approximate A model is a description and logical equivalent
wind speed Low/high
Logical of some system intended to predict what
power demand Equivalent of the temperature happens if certain actions are taken.
Real Systems or heat
thermal
demand Processes
13
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Understanding problems better from fragmented to • Process control – allow for the development of new
control strategies
holistic view
• Forecasting – are used to predict future performance
Intervention • Performance analysis – allow for analysing performance
over time
System modifications
• Education – provide a tool to actively explore new ideas
Communicating with others and improve the learning process
15 16
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
19 20
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
• Steady-state Model: time independent, system in • Distributed Parameter Model: system properties do
equilibrium change with position (space)
• Typically, involves algebraic equations • Involve partial differential equations
25 26
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
27 28
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Mathematical Complexity
Deterministic vs. Probabilistic
• Deterministic Model: parameters are known with certainty
Rasmuson et al., 2014
• Input and output are precise
29 30
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
33 34
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Superheater
44 bar, 256.1°C 0.1 bar, 45.5°C
0.84 kg/s (Sat. Steam) 1.78 kg/s
PTC Field
(8175m2) Steam
Steam Separator
Generator
LFR Field
(7020m2)
Pump-III
45 bar, 105°C Cooling Water
1.09 kg/s
Pump-VI
Petroleum Refinery
Model Building
• Maximise profit 37
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
43 44
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Errors in Models
• Inappropriate assumptions made in formulating One model may be better than another in that it
the model has better explanatory features: more specific
• Omission of certain term in the governing predictions can be made that are subsequently
equations confirmed, at least to some degree.
• Misinterpretations of the mathematical
—John Adam (Mathematics in Nature)
conclusions in the original context of the
problem
• There may be errors in the mathematical
analysis
45
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Model Accuracy
• It may happen that even a less accurate
model is preferable to a more As in many hierarchies of scientific models, the virtue
mathematically sophisticated one of a simpler theory can, under the right
• Accuracy of a model depends on the circumstances, outweigh its vices.
perspective and intended applications
—Lee and Fraser
47
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Model Evaluation
Ability to give correct inputs for the
decision it is intended for
Reliability
Accuracy of prediction Mathematical modelling is a tool to complement
scientific and technological development and
Computational effort/ cost
cannot replace theory and experimentation
Computational time
49
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Curve Fitting
Curve fitting is the process of finding the ‘best-fit’ curve for a
given set of data.
It is the representation of the relationship between input and
output variables by means of a mathematical equation.
Curve Fitting 𝑦
Exact: Interpolation
Approximate: Regression
52
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Interpolation Interpolation
• Interpolation is the process of computing • Estimation of intermediate values between precise
data points. The most common method is:
intermediate value of a function = ( )
from a given set of tabular values of the f ( x) a0 a1 x a2 x 2 an x n
function
• There is one and only one nth-order polynomial that
𝟎 𝟏 𝟐 … 𝒏
fits n+1 points
𝟎 𝟏 𝟐 … 𝒏 • Other methods
– The Newton polynomial
– The Lagrange polynomial
54
53
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
x x0 x x1 f ( x ) ⋯
x2 x0 x2 x1 2 ⋯
⋯
•As with Newton’s method, the Lagrange version has an ⋯
n
Rn f [ x, xn , xn 1 , , x0 ] ( x xi )
i 0
59
60
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Coefficients of an Interpolating
Polynomial f ( x0 ) a0 a1 x0 a2 x02 an x0n
• Although both the Newton and Lagrange f ( x1 ) a0 a1 x1 a2 x12 an x1n
polynomials are well suited for determining
intermediate values between points, they do not
provide a polynomial in conventional form: f ( xn ) a0 a1 xn a2 xn2 an xnn
f ( x) a0 a1 x a2 x 2 a x x n
Where “x”s are the knowns and “a”s are the unknowns.
• Since n+1 data points are required to determine n+1
coefficients, simultaneous linear systems of equations
can be used to calculate “a”s.
61 62
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Spline Interpolation
• There are cases where polynomials can lead to
erroneous results because of round off error
and overshoot.
• Alternative approach is to apply lower-order
polynomials to subsets of data points. Such
connecting polynomials are called spline
functions.
63 64
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Regression
• The equation of a line
is y=mx+c Line
increase in x, there is 18
an m unit increase in
16
y = 1.5x + 4
14
Regression y 12
10
• c is the value of y 8
when x is equal to
6
zero 2
0
0 2 4 6 8 10 12
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
the best?
linear?
• What is a way to
5
line is y=1.5x + 4 0
0 2 4 6 8 10 12
70
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Regression Regression
• It may be proved easily:
(y y ) 2 ( yˆ i y ) 2 ( yi yˆ i ) 2
i
i
i
i
Sum of squares Sum of squares Sum of squares
about mean due to regression of errors
SST SSR SSE
• SST = SSR + SSE
• Coefficient of determination, R2 = 1 – (SSE/SST)
71 72
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Example Example
75 76
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Example Example
The torque, T needed to turn the torsion spring of a mousetrap through
an angle, is given below. Find k1 and k2.
T k1 k 2
0.4
Angle, θ Torque, T
Torque (N-m)
0.3
Radians N-m
0.698132 0.188224
0.2
0.959931 0.209138
1.134464 0.230052
0.1
1.570796 0.250965 0.5 1 1.5 2
1.919862 0.313707 θ (radians)
77 78
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Example Example
k1 1.1767 101 N-m
Radians N-m Radians2 N-m-Radians
ANOVA
0.698132 0.188224 0.487388 0.131405 k 2 9.6091 102 N-m/rad
0.959931 0.209138 0.921468 0.200758
R Square 0.949437217
1.134464 0.230052 1.2870 0.260986
Observations 5
1.570796 0.250965 2.4674 0.394215
1.919862 0.313707 3.6859 0.602274
5
ANOVA
i 1
6.2831 1.1921 8.8491 1.5896
df SS F Significance F
0.35
y = 0.0961x + 0.1177
Regression 1 0.008803758 56.33218 0.004900668
0.3
R² = 0.9494 Error 3 0.000468849
0.25
Total 4 0.009272607
0.2
0.15
0.1
0.05
0
0 0.5 1 1.5 2 2.5
79 80
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023
Learning Outcomes •
References/Further Reading
ETH Zurich Lecture notes Systems Modelling and Analysis 2011
• Duckworth, F.C. and Lewis, A.J., 1998. A fair method for resetting the
What is a model target in interrupted one-day cricket matches. Journal of the
Operational Research Society, 49(3), pp.220-227.
• Nayak, J.K., Kedare, S.B., Banerjee, R., Bandyopadhyay, S., Desai,
N.B., Paul, S. and Kapila, A., 2015. A 1 MW national solar thermal
Why do we need a model research cum demonstration facility at Gwalpahari, Haryana, India.
Current Science, pp.1445-1457.
• Rasmuson, A., Andersson, B., Olsson, L. and Andersson, R., 2014.
What are its attributes Mathematical modeling in chemical engineering. Cambridge University
Press.
• Chapra, Steven C., Canale, Raymond P., Numerical methods for
engineers, McGraw-Hill Education NY.
Curve fitting and Linear Regression • NPTEL, Prof C Balaji, IIT Madras, -
https://nptel.ac.in/courses/112/106/112106064/
• NPTEL, Prof Shalabh, IIT Kanpur,
https://nptel.ac.in/courses/111/104/111104098/
81 82