rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
Model.m
1 classdef Model < ARE.Model
2 % MODEL
3 % Main class for the DARE model
4 
5  properties
6  RB_closed_loop_norm = 'fro';
7  RB_closed_loop_stable = false;
8  end
9 
10  methods
11 
12  function pt = problem_type(this)
13  pt = 'DARE';
14  end
15 
16  function g = gamma(this, model_data, dsim)
17  calculator = DARE.GammaCalculation.Lyapunov();
18  g = calculator.calculate(this, model_data, dsim);
19  end
20 
21  function [n] = closed_loop_norm(this, model_data, dsim)
22  % CLOSED_LOOP_NORM Implementation of an efficient algorithm for
23  % the approximation of the 2-norm of the closed-loop matrix.
24  [E,A,B,~,~,R] = this.assemble(model_data);
25 
26  M1 = A'*B;
27  Rxinv = inv(R + (B'*dsim.Z)*(dsim.Z'*B));
28  M2 = Rxinv*(B'*dsim.Z)*(dsim.Z'*A);
29  M3 = (A'*dsim.Z)*(dsim.Z'*B)*Rxinv;
30  BtB = B'*B;
31  n = sqrt(eigs( @(x) A'*(A*x) - M1*(M2*x) - M2'*(M1'*x) + ...
32  M3*(BtB*(M3'*x)), this.n, 1));
33  end
34 
35  function [stable,cleig] = closed_loop_stable(this,model_data,dsim)
36  % CLOSED_LOOP_STABLE Implementation of an efficient algorithm
37  % for checking whether the closed loop matrix gives a stable
38  % system. This is done by calculting the maximum eigenvalue of
39  % the closed loop system.
40  [E,A,B,~,~,R] = this.assemble(model_data);
41  Rxinv = inv(R + (B'*dsim.Z)*(dsim.Z'*B));
42  K = Rxinv*(B'*dsim.Z)*(dsim.Z'*A);
43  [EL,EU] = lu(E);
44  cleig = eigs( @(x) EU\(EL\(A*x - B*(K*x))), this.n, 1 );
45  stable = abs(cleig) < 1;
46  end
47 
48  end
49 
50 end
MODEL Class that defines the assemble method which is used by both, the DetailedModel and the Reduced...
Definition: Model.m:18
Implementation of the parametric algebraic Riccati equation.
Implementation of the parametric discrete-time algebraic Riccati equation.
Definition: Kernel.m:1