KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RCLadder.m
Go to the documentation of this file.
1 namespace models{
2 namespace circ{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
19 class RCLadder
20  :public models.BaseFullModel {
45  public:
46 
57  public:
58 
59 
60  RCLadder(dims) {
61 
62  this = this@models.BaseFullModel;
63 
64  if nargin == 0
65  dims = 30;
66  end
67  this.Dims= dims;
68 
69  this.registerProps(" Dims ");
70 
71  this.Name= " RC Ladder circuit model ";
72 
73  this.T= 3;
74  this.dt= .0025;
75  this.tau= 1;
76  this.SaveTag= sprintf(" rcladder_d%d_T%g ",dims,this.T);
77  this.Data= data.ModelData(this);
78 
79  this.System= models.circ.RCLadderSys(this);
80 
81  /* Only train with first input! */
82  this.TrainingInputs= [2 3];
83 
84  this.Sampler= [];
85 
86  app = approx.KernelApprox(this.System);
87  a = approx.algorithms.VKOGA;
88  a.MaxRelErr= 1e-5;
89  a.MaxAbsResidualErr= 1e-3;
90  ec = kernels.config.ExpansionConfig;
91  ec.StateConfig= kernels.config.GaussConfig(" D ",.3:.1:2);
92  a.ExpConfig= ec;
93  app.Algorithm= a;
94 
95  t = data.selection.TimeSelector;
96  t.Size= 12000;
97  app.TrainDataSelector= t;
98  this.Approx= app;
99 
100  s = spacereduction.PODReducer;
101  s.Mode= " abs ";
102  s.Value= 3;
103  s.UseSVDS= false;
104  this.SpaceReducer= s;
105 
106  s = solvers.SemiImplicitEuler(this);
107  s.MaxStep= .05; /* Stability constraint due to diffusion term */
108 
109  this.ODESolver= s;
110 
111  this.ErrorEstimator= error.IterationCompLemmaEstimator;
112  }
113 
114 
115 
116 #if 0 //mtoc++: 'set.Dims'
117 function Dims(value) {
118  if ~isposintscalar(value)
119  error(" value must be a positive integer scalar ");
120  end
121  this.Dims= value;
122  }
123 
124 #endif
125 
126 
127  public: /* ( Static ) */
128 
129  static function test_RCLadderModel() {
130  m = models.circ.RCLadder(100);
131  m.simulate([], 1);
132  [t,y,~,x] = m.simulate([], 2);
133  m.plot(t,y);
134  m.plotState(t,x);
135  }
136 
137 
138  protected: /* ( Static ) */
139 
140  static function this = loadobj() {
141  if ~isa(this, " models.circ.RCLadder ")
142  s = this;
143  this = models.circ.RCLadder(s.Dims);
144  /* field "Dims" is set in constructor */
145  this = loadobj@models.BaseFullModel(this, s);
146  else
147  this = loadobj@models.BaseFullModel(this);
148  end
149  }
150 
156 };
157 }
158 }
159 
char Name
The name of the Model.
Definition: BaseModel.m:117
error.BaseEstimator ErrorEstimator
The associated error estimator for this model.
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
double dt
The desired time-stepsize for simulations.
Definition: BaseModel.m:291
integer TrainingInputs
The indices of inputs to use for training data generation. Uses the DefaultInput if not set (and Defa...
sampling.BaseSampler Sampler
The sampling strategy the Model uses.
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
static function test_RCLadderModel()
Definition: RCLadder.m:129
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
Definition: DPCMObject.m:125
An integer value.
double tau
Time scaling factor .
Definition: BaseModel.m:252
solvers.BaseSolver ODESolver
The solver to use for the ODE. Must be an instance of any solvers.BaseSolver subclass.
Definition: BaseModel.m:315
approx.BaseApprox Approx
The approximation method for the CoreFunction.
double T
The final timestep up to which to simulate.
Definition: BaseModel.m:271
data.ModelData Data
The full model's data container. Defaults to an empty container.
spacereduction.BaseSpaceReducer SpaceReducer
The reduction algorithm for subspaces.
ModelData(varargin)
Creates a new container for large full model data.
Definition: ModelData.m:180
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
static function this = loadobj()
Definition: RCLadder.m:140
Dims
The target dimension of the RC ladder circuit.
Definition: RCLadder.m:47
char SaveTag
A custom tag that can be used as a prefix to files for corresponding model identification.
RCLadder: Model of a nonlinear resistor with independent current source.
Definition: RCLadder.m:19