rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Model.m
2 % MODEL
3 % Class that defines the assemble method which is used by both, the
4 % DetailedModel and the ReducedModel.
5 %
6 % Andreas Schmidt, 2016
7 
8  properties
9  enable_error_estimator = false;
10  calc_residual = true;
11 
12  % Additional fields for basis generation:
13  RB_gamma_mode = 'Kernel';
14  RB_gamma_enabled = 1;
15  RB_gamma_settings = {};
16 
17  % The number of measurement outputs
18  p;
19  % The number of control inputs and measurements
20  m;
21  n;
22 
23  model_data;
24  end
25 
26  methods(Abstract)
27  A = A_coeff(this);
28  A = A_comp(this,model_data);
29  B = B_comp(this,model_data);
30  end
31 
32  methods(Access=public)
33 
34  function [E,A,B,C,Q,R] = assemble(this, md)
35  % ASSEMBLE Assembles all the data matrices.
36  % This function works for both, the reduced and the
37  % full model.
38 
39  A = lincomb_sequence(md.A_comp, this.A_coeff());
40  B = lincomb_sequence(md.B_comp, this.B_coeff());
41  C = lincomb_sequence(md.C_comp, this.C_coeff());
42  E = lincomb_sequence(md.E_comp, this.E_coeff());
43  R = lincomb_sequence(md.R_comp, this.R_coeff());
44  Q = lincomb_sequence(md.Q_comp, this.Q_coeff());
45  end
46 
47  function E = mass_matrix(this, md)
48  % MASS_MATRIX Get the mass matrix of the problem
49  % This function is used by the LRFG algorithm for the
50  % orthogonalization procedure
51  Ecoeff = this.E_coeff();
52  E = lincomb_sequence(md.E_comp, Ecoeff);
53  end
54 
55  function g = gamma(this, model_data, dsim)
56  % GAMMA
57  % Calculate the value of gamma. This is used by applying
58  % the Lyapunov equation method.
59  %
60  calculator = ARE.GammaCalculation.Lyapunov();
61  g = calculator.gamma(this, model_data, dsim);
62  end
63 
64  function R = R_coeff(this)
65  R = 1;
66  end
67  function Q = Q_coeff(this)
68  Q = 1;
69  end
70  function E = E_coeff(this)
71  E = 1;
72  end
73  function C = C_coeff(this)
74  C = 1;
75  end
76  function B = B_coeff(this)
77  B = 1;
78  end
79 
80  function R = R_comp(this, model_data)
81  if isempty(this.m), error('Please define the m property'), end
82  R = {eye(this.m)};
83  end
84  function Q = Q_comp(this, model_data)
85  if isempty(this.p), error('Please define the p property'), end
86  Q = {eye(this.p)};
87  end
88  function E = E_comp(this, model_data)
89  if isempty(this.n), error('Please define the dimension n property'), end
90  E = {speye(this.n)};
91  end
92  function C = C_comp(this, model_data)
93  C = cellfun(@transpose, this.C_comp());
94  end
95 
96  function [T,y,x] = simulate(this, model_data, dsim)
97  % SIMULATE This function simulates the underlying LTI model
98  % If you provide dsim, the closed-loop simulation will be
99  % performed.
100  end
101  end
102 
103 end
Abstract OOP model implementation interface.
MODEL Abstract model class.
Definition: Model.m:18
Implementation of the parametric algebraic Riccati equation.
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1