RT-WDF  0.0.1
Real-time Wave Digital Filter Framework
rt-wdf_nlModels.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the RT-WDF library.
5  Copyright (c) 2015,2016 - Maximilian Rest, Ross Dunkel, Kurt Werner.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  RT-WDF is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  -----------------------------------------------------------------------------
17  To release a closed-source product which uses RT-WDF, commercial licenses are
18  available: write to rt-wdf@e-rm.de for more information.
19 
20  ==============================================================================
21 
22  rt-wdf_nlModels.h
23  Created: 2 Dec 2015 4:10:47pm
24  Author: mrest
25 
26  ==============================================================================
27 */
28 
29 #ifndef RTWDF_NLMODELS_H_INCLUDED
30 #define RTWDF_NLMODELS_H_INCLUDED
31 
32 //==============================================================================
33 #include "rt-wdf_types.h"
34 
35 //==============================================================================
36 // Defines for NL identifiers
37 // TODO: introduce enums
38 
39 
40 // Diodes:
42 #define DIODE 00
43 
44 #define DIODE_AP 01
45 
46 // Bipolar Transistors:
48 #define NPN_EM 10
49 
50 // Triode Tubes:
52 #define TRI_DW 20
53 
54 
55 
56 //==============================================================================
57 // Forward declarations
58 class nlModel;
59 class diodeModel;
60 class diodeApModel;
61 class bjtEmModel;
62 class triDwModel;
63 
64 
65 
66 //==============================================================================
67 class nlModel {
68 
69 public:
70  //----------------------------------------------------------------------
77  nlModel( int numPorts );
78 
79  //----------------------------------------------------------------------
83  virtual ~nlModel( );
84 
85  //----------------------------------------------------------------------
99  virtual void calculate( vec* fNL,
100  mat* JNL,
101  vec* x,
102  int* currentPort ) = 0;
103 
104  //----------------------------------------------------------------------
112  int getNumPorts( );
113 
114 private:
115  //----------------------------------------------------------------------
117  unsigned int numPorts;
118 
119 };
120 
121 
122 //==============================================================================
123 class diodeModel : public nlModel {
124 
125 public:
126  //----------------------------------------------------------------------
133  diodeModel( );
134 
135  //----------------------------------------------------------------------
149  void calculate( vec* fNL,
150  mat* JNL,
151  vec* x,
152  int* currentPort );
153 
154 };
155 
156 
157 //==============================================================================
158 class diodeApModel : public nlModel {
159 
160 public:
161  //----------------------------------------------------------------------
168  diodeApModel();
169 
170  //----------------------------------------------------------------------
184  void calculate( vec* fNL,
185  mat* JNL,
186  vec* x,
187  int* currentPort );
188 
189 };
190 
191 
192 //==============================================================================
193 class npnEmModel : public nlModel {
194 
195 public:
196  //----------------------------------------------------------------------
203  npnEmModel();
204 
205  //----------------------------------------------------------------------
219  void calculate( vec* fNL,
220  mat* JNL,
221  vec* x,
222  int* currentPort );
223 
224 };
225 
226 
227 //==============================================================================
228 class triDwModel : public nlModel {
229 
230 public:
231  //----------------------------------------------------------------------
238  triDwModel();
239 
240  //----------------------------------------------------------------------
254  void calculate( vec* fNL,
255  mat* JNL,
256  vec* x,
257  int* currentPort );
258 
259 };
260 
261 
262 
263 #endif // RTWDF_NLMODELS_H_INCLUDED
Definition: rt-wdf_nlModels.h:193
nlModel(int numPorts)
Definition: rt-wdf_nlModels.cpp:35
virtual void calculate(vec *fNL, mat *JNL, vec *x, int *currentPort)=0
Definition: rt-wdf_nlModels.h:67
Definition: rt-wdf_nlModels.h:228
Definition: rt-wdf_nlModels.h:158
int getNumPorts()
Definition: rt-wdf_nlModels.cpp:44
Definition: rt-wdf_nlModels.h:123
virtual ~nlModel()
Definition: rt-wdf_nlModels.cpp:39