You are on page 1of 21

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618)

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?

Why do we need a model?

What are its attributes? Problem Solving

What models are you familiar with?

What is curve fitting?


3
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Decision Types Stakeholders


 System selection  End Users
 Yes/No
 Manufacturers
 Best possible amongst options
 System/Component Design  Utility
 Decide Operating Strategy  Society/Government
 Decide Policies  Others

5 6

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Perspectives Levels of Analysis


 Cost - Initial Cost, Operating Cost, Life  Physical Verification
Cycle Cost  Operational
 Functional – Does it perform the
 Reliability-Availability, Unmet Energy
desired function?
 Emissions - Local, Global  Efficiency – Is it possible to improve the
 Sustainability operating efficiency?
 Process Changes/Modifications
 Equity

7 8
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

It is better to have an approximate answer to the right


question than an exact answer to the wrong one.

—John Tukey Models

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Model: Dictionary Meaning Systems


 Noun
 a standard or example for imitation or Measurable Measurable
comparison Inputs Outputs
 a simplified representation of a system or solar radiation electric power
phenomenon with any hypotheses required to
wind speed System Low/high
describe the system or explain the phenomenon
 Verb power demand temperature
heat
 to simulate (a process, concept, or the operation thermal demand
of a system), commonly with the aid of a
computer
A model is a representation of reality
11 12
Source: Dictionary.com
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

Purpose of Modelling Why do we need a Model?


• Design – allow the exploration of the impact of changing
• In General, Modelling helps system parameters
 Answering specific questions • Research – serve as a tool develop and test hypotheses

 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

Types of Models Mathematical Models


• Physical • Mathematical relations as a (simplifying) formal
• Descriptive abstraction of reality
• Mathematical • Issues when deriving a mathematical model:
– A mathematical model of a process is a system of – Which quantities have influence, and how
equations whose solution is representative of the
important is it?
response of the process to a corresponding set of
– What relations exist between them? "Which
inputs
type of mathematics?“
– What is the given task (solve, optimise, etc.)?
17 18

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Models & Information Black Box Model


 Black Box Model • Only input and output are known.
 No prior information about the system is • Internal dynamics are either too complex or unknown.
known
 White Box Model Input Output

 Complete prior information about the system


is available and known
• Easy to Model
• Model involves empirical estimation of relation between
 Grey Box Model input and output

19 20
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

White Box Model Grey Box Model


• Input, output, and internal dynamics are known. • Input, output, and some information about the internal
• One should have complete knowledge of the system to dynamics of the system are known
derive a white box model
u(t) y(t)
2 y[u(t), t]
dy(t ) du(t ) d y(t )
u(t) 3  y(t)
dt dt dt 2

• A compromise between black box and white box models


• Generally, difficult to Model • Model mixes empirical and fundamental relations
• Model involves relation between input, output, and
internal parameters
21 22

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Mathematical Models Fundamental vs. Empirical


• Fundamental Model: based on fundamental concepts such
• Fundamental vs. Empirical Models
as conservation of mass and energy
• Dynamic vs. Steady-state Models • These models provide great perceptions into process
design/ operation/ control
• Lumped vs. Distributed Parameter Models • Can be complex. May not be easy to develop and solve
• Continuous vs. Discrete Models
• Empirical Model: based on experimental data and
• Linear vs. Non-linear Models empirical correlations
• Deterministic vs. Probabilistic Models • Data driven, also called statistical models
• Simple to develop, solve, and apply
• Empirical models are sufficient for many design/operation
applications
23 24
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Dynamic vs. Steady-state Lumped vs. Distributed Parameter


• Dynamic Model: accounts for time dependent changes in • Lumped Parameter Model: system properties do not
system behavior change with position (space)
• Typically, involves differential equations • Involve algebraic and differential equations

• 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

Continuous vs. Discrete Linear or Non-linear


• Continuous Model: involves continuous variables
• Linear Model: involves linear equations
• Small changes are modelled as differential equations
• Obeys superposition principles

• Discrete Model: involves discrete variables


• Non-linear Model: involves non-linear equations
• Small changes are modelled as difference equations

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

• Probabilistic Model: includes randomness


• Also called stochastic
• Involves imprecise data
• Probability or possibility theories for mathematical
operations

29 30

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

The type of model one uses generally depends


Examples
on the context in which it is used
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Limited Overs Cricket Match Limited Overs Cricket Match


• Interruption of a limited over cricket match due to rain
or other circumstances
• A method was proposed by two English statisticians,
Duckworth and Lewis

33 34

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Solar Thermal Power Plant Simplified Process Flow Diagram


High Temperature
Vessel
• Best operating strategy
Pump-II
13 bar, 393°C 42 bar, 350°C
8.53 kg/s 1.93 kg/s
Turbine
1 MWe

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)

17.5 bar, 232°C 46.3 bar, 171°C


8.53 kg/s Preheater
2.22 kg/s

Pump-III
45 bar, 105°C Cooling Water
1.09 kg/s
Pump-VI

Pump-I Low Temperature Deareator


35 Pump-V 36
Vessel Nayak et al., 2015
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

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

Life Cycle of Modelling Steps of Model Building


Implementation Conceptualisation
Who? Real World Why? 1. Problem definition
Intervention, Problems Perception, 2. Understanding physical phenomena and system
Improvement Diagnosis, Goal characteristics
3. Selection of key variables
Solutions / Conceptual 4. Initial model
Observations Validation Model 5. Parameter estimation
6. Testing, evaluation, and validation of the model
7. Analysis of the model and its characteristics
Simulation Model Building 8. Fine-tuning and improvement of the model
How? What?
Scope of Decisions Mathematical 9. Model for application
Scope of Effectivity
Model
39 40
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Monitoring and Experiments Model Verification vs. Validation


• Monitoring and experiments are • Verification: process of comparing two or more
complementary to modelling and results to ensure its accuracy. Task of
simulation determining if the implementation of a model has
been done correctly

• Purpose of performing experiments • Validation: process of comparing results of


– Validation the conceptual model to the real system. Task of
– Readjustment determining if the model constructed
– Fine-tuning accurately represents the underlying real system
being modelled
41 42

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

Model Validation Art of Modelling


Modelling is an art
Inputs System Matches with The art of good modelling relies on:
yes
Model Experiments/ Accept
given Observations a) A sound understanding and appreciation of the problem
? b) A realistic understanding and mathematical
representation of associated important phenomena
no
Change c) Finding useful, preferably quantitative, solutions
Model d) Interpretations of the mathematical results—insights,
predictions, etc.

Model validation is important

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

Newton’s Divided-Difference Quadratic Interpolation/


Interpolating Polynomials • If three data points are available, the estimate is
improved by introducing some curvature into the line
Linear Interpolation/
connecting the points.
• Is the simplest form of interpolation, connecting two data
points with a straight line. f 2 ( x)  b0  b1 ( x  x0 )  b2 ( x  x0 )( x  x1 )
Slope and a
finite divided • A simple procedure can be used to determine the
f1 ( x)  f ( x0 ) f ( x1 )  f ( x0 ) difference values of the coefficients.

x  x0 x1  x0 approximation to
x  x0 b0  f ( x0 )
1st derivative
f ( x1 )  f ( x0 ) f ( x1 )  f ( x0 )
f1 ( x)  f ( x0 )  ( x  x0 ) Linear-interpolation x  x1 b1 
x1  x0 x1  x0
formula
f ( x2 )  f ( x1 ) f ( x1 )  f ( x0 )

• f1(x) designates that this is a first-order interpolating x2  x1 x1  x0
x  x2 b2 
polynomial. x2  x0
55 56
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

General Form of Newton’s Interpolating Polynomials/


Lagrange Interpolating Polynomials
f n ( x)  f ( x0 )  ( x  x0 ) f [ x1 , x0 ]  ( x  x0 )( x  x1 ) f [ x2 , x1 , x0 ]
   ( x  x0 )( x  x1 )  ( x  xn 1 ) f [ xn , xn 1 , , x0 ]
• The Lagrange interpolating polynomial is simply a
b0  f ( x0 )
reformulation of the Newton’s polynomial that
b1  f [ x1 , x0 ]
b2  f [ x2 , x1 , x0 ]
avoids the computation of divided differences:
 n
bn  f [ xn , xn 1 ,  , x1 , x0 ] f n ( x)   Li ( x) f ( xi )
f ( xi )  f ( x j ) i 0
f [ xi , x j ]  Bracketed function
xi  x j n x  xj
Li ( x)  
evaluations are finite
f [ xi , x j ]  f [ x j , xk ] divided differences
f [ xi , x j , xk ] 
xi  xk j 0 xi  x j
j i

f [ xn , xn 1 ,  , x1 ]  f [ xn 1 , xn  2 , , x0 ]
f [ xn , xn 1 , , x1 , x0 ] 
xn 18x0
Chapter 57 58

Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

x  x1 x  x0 Lagrange’s Interpolation Formula


f1 ( x)  f ( x0 )  f ( x1 )
x0  x1 x1  x0
• Data points:
f 2 ( x) 
x  x1 x  x2  f ( x )  x  x0 x  x2  f ( x ) ,

x0  x1 x0  x 2  0 x1  x0 x1  x 2  1 ⋯


+


x  x0 x  x1  f ( x ) ⋯

x2  x0 x2  x1  2 ⋯

•As with Newton’s method, the Lagrange version has an ⋯

estimated error of: • In general:

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

• For every one unit 20

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

Regression How do we find the best line?


• Does there seem to 25
• Linear regression
be a linear 20
tries to find the best
relationship in the line (curve) to fit the
data?
15 data
• Which do you think is
• Is the data perfectly 10

the best?
linear?
• What is a way to
5

• Could we fit a line to 0 determine the best


this data? 0 2 4 6 8 10 12
line to use?
Energy Systems Modelling & Analysis (EN 401/618) VR/2023 Energy Systems Modelling & Analysis (EN 401/618) VR/2023

What is linear regression? Regression


• Method of best fit
• The method of finding • Data points: ,
the best line (curve) is 25
• Model to be fitted:
least squares, which 20 : identically & independently distributed (iid) random error
y = 1.5x + 4
minimizes the • Assumption:
15
distance from the line • Objective: minimize sum of the square of errors
for each of points 10

• The equation of the 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

Statistical Distributions Analysis of Variance (ANOVA)


Source df Sum of Mean f
(error) is assumed to be identically & independently squares squares
distributed (iid) Regression dfR = 1 SSR SSR SSR(n-2)/
• Assumption: (normal distribution) SSE
• Residuals are used for estimating the error Error dfE = n-2 SSE SSE/
• Sum of square of the normally distributed (n-terms) (n-2)
errors follows (chi-square) distribution with n degree of Total n-1 SST
freedom (corrected
for mean)
• Ratio of two scaled quantities ( ) follows f-distribution Decide α (acceptance error of the regression, typically 5%)
• This can be used for acceptance of the model Determine F(dfR, dfE, 1-α) from f-distribution
f > F(dfR, dfE, 1-α), accept the model with a risk of α
74

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  101 N-m
Radians N-m Radians2 N-m-Radians
ANOVA
0.698132 0.188224 0.487388 0.131405 k 2  9.6091 102 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

You might also like