My Project
0.0.16
QUCS Mapping
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
DownLoad
QUCS-src
qucs-0.0.16
qucs-core
src
hbsolver.h
Go to the documentation of this file.
1
/*
2
* hbsolver.h - harmonic balance solver class definitions
3
*
4
* Copyright (C) 2005, 2006, 2007, 2008 Stefan Jahn <stefan@lkcc.org>
5
*
6
* This is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* This software is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this package; see the file COPYING. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19
* Boston, MA 02110-1301, USA.
20
*
21
* $Id: hbsolver.h 1825 2011-03-11 20:42:14Z ela $
22
*
23
*/
24
25
#ifndef __HBSOLVER_H__
26
#define __HBSOLVER_H__
27
28
#include "
ptrlist.h
"
29
#include "
tvector.h
"
30
31
class
vector
;
32
class
strlist
;
33
class
circuit
;
34
35
class
hbsolver
:
public
analysis
36
{
37
public
:
38
ACREATOR
(
hbsolver
);
39
hbsolver
(
char
*);
40
hbsolver
(
hbsolver
&);
41
~hbsolver
();
42
int
solve
(
void
);
43
void
initHB
(
void
);
44
void
initDC
(
void
);
45
static
void
calc
(
hbsolver
*);
46
void
collectFrequencies
(
void
);
47
int
checkBalance
(
void
);
48
49
void
splitCircuits
(
void
);
50
void
expandFrequencies
(nr_double_t,
int
);
51
bool
isExcitation
(
circuit
*);
52
strlist
*
circuitNodes
(
ptrlist<circuit>
);
53
void
getNodeLists
(
void
);
54
int
assignVoltageSources
(
ptrlist<circuit>
);
55
int
assignNodes
(
ptrlist<circuit>
,
strlist
*,
int
offset = 0);
56
void
prepareLinear
(
void
);
57
void
createMatrixLinearA
(
void
);
58
void
fillMatrixLinearA
(
tmatrix<nr_complex_t>
*,
int
);
59
void
invertMatrix
(
tmatrix<nr_complex_t>
*,
tmatrix<nr_complex_t>
*);
60
void
createMatrixLinearY
(
void
);
61
void
saveResults
(
void
);
62
void
calcConstantCurrent
(
void
);
63
nr_complex_t
excitationZ
(
tvector<nr_complex_t>
*,
circuit
*,
int
);
64
void
finalSolution
(
void
);
65
void
fillMatrixNonLinear
(
tmatrix<nr_complex_t>
*,
tmatrix<nr_complex_t>
*,
66
tvector<nr_complex_t>
*,
tvector<nr_complex_t>
*,
67
tvector<nr_complex_t>
*,
tvector<nr_complex_t>
*,
68
int
);
69
void
prepareNonLinear
(
void
);
70
void
solveHB
(
void
);
71
void
loadMatrices
(
void
);
72
void
VectorFFT
(
tvector<nr_complex_t>
*,
int
isign = 1);
73
void
VectorIFFT
(
tvector<nr_complex_t>
*,
int
isign = 1);
74
int
calcOrder
(
int
);
75
void
MatrixFFT
(
tmatrix<nr_complex_t>
*);
76
void
calcJacobian
(
void
);
77
void
solveVoltages
(
void
);
78
tvector<nr_complex_t>
expandVector
(
tvector<nr_complex_t>
,
int
);
79
tmatrix<nr_complex_t>
expandMatrix
(
tmatrix<nr_complex_t>
,
int
);
80
tmatrix<nr_complex_t>
extendMatrixLinear
(
tmatrix<nr_complex_t>
,
int
);
81
void
fillMatrixLinearExtended
(
tmatrix<nr_complex_t>
*,
82
tvector<nr_complex_t>
*);
83
void
saveNodeVoltages
(
circuit
*,
int
);
84
85
private
:
86
tvector<nr_double_t>
negfreqs;
// full frequency set
87
tvector<nr_double_t>
posfreqs;
// full frequency set but positive
88
tvector<nr_double_t>
rfreqs;
// real positive frequency set
89
int
* ndfreqs;
// number of frequencies for each dimension
90
tvector<nr_double_t>
dfreqs;
// base frequencies for each dimension
91
nr_double_t frequency;
92
strlist
* nlnodes, * lnnodes, * banodes, * nanodes, * exnodes;
93
ptrlist<circuit>
excitations;
94
ptrlist<circuit>
nolcircuits;
95
ptrlist<circuit>
lincircuits;
96
97
tmatrix<nr_complex_t>
* Y;
// transadmittance matrix of linear network
98
tmatrix<nr_complex_t>
* A;
// MNA-matrix of linear network
99
tmatrix<nr_complex_t>
* Z;
// transimpedance matrix of linear network
100
101
tmatrix<nr_complex_t>
* YV;
// linear transadmittance matrix
102
tmatrix<nr_complex_t>
* NA;
// MNA-matrix of complete network
103
104
tmatrix<nr_complex_t>
* JQ;
// C-Jacobian in t and f
105
tmatrix<nr_complex_t>
* JG;
// G-Jacobian in t and f
106
tmatrix<nr_complex_t>
* JF;
// full Jacobian for non-linear balancing
107
tvector<nr_complex_t>
* IG;
// currents in t and f
108
tvector<nr_complex_t>
* FQ;
// charges in t and f
109
tvector<nr_complex_t>
* VS;
110
tvector<nr_complex_t>
* VP;
111
tvector<nr_complex_t>
* FV;
// error vector F(V) of HB equation
112
tvector<nr_complex_t>
* IL;
// currents into linear network
113
tvector<nr_complex_t>
* IN;
// currents into non-linear network
114
115
tvector<nr_complex_t>
* IR;
116
tvector<nr_complex_t>
* QR;
117
tvector<nr_complex_t>
* RH;
118
tvector<nr_complex_t>
* OM;
119
120
tvector<nr_complex_t>
* IC;
// source currents into balanced nodes
121
tvector<nr_complex_t>
* IS;
// currents through sources themselves
122
tvector<nr_complex_t>
* x;
123
tvector<nr_complex_t>
* vs;
124
125
int
runs;
126
int
lnfreqs;
127
int
nlfreqs;
128
int
nnlvsrcs;
129
int
nlnvsrcs;
130
int
nlnnodes;
131
int
nnanodes;
132
int
nexnodes;
133
int
nbanodes;
134
};
135
136
#endif
/* __HBSOLVER_H__ */
Generated on Tue Dec 25 2012 14:30:34 for My Project by
1.8.2