/* * hbsolver.h - harmonic balance solver class definitions * * Copyright (C) 2005, 2006, 2007, 2008 Stefan Jahn * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, * Boston, MA 02110-1301, USA. * * $Id$ * */ #ifndef __HBSOLVER_H__ #define __HBSOLVER_H__ #include #include "ptrlist.h" #include "tvector.h" namespace qucs { class vector; class strlist; class circuit; class hbsolver : public analysis { public: ACREATOR (hbsolver); hbsolver (char *); hbsolver (hbsolver &); ~hbsolver (); int solve (void); void initHB (void); void initDC (void); static void calc (hbsolver *); void collectFrequencies (void); int checkBalance (void); void splitCircuits (void); void expandFrequencies (nr_double_t, int); bool isExcitation (circuit *); strlist * circuitNodes (ptrlist); void getNodeLists (void); int assignVoltageSources (ptrlist); int assignNodes (ptrlist, strlist *, int offset = 0); void prepareLinear (void); void createMatrixLinearA (void); void fillMatrixLinearA (tmatrix *, int); void invertMatrix (tmatrix *, tmatrix *); void createMatrixLinearY (void); void saveResults (void); void calcConstantCurrent (void); nr_complex_t excitationZ (tvector *, circuit *, int); void finalSolution (void); void fillMatrixNonLinear (tmatrix *, tmatrix *, tvector *, tvector *, tvector *, tvector *, int); void prepareNonLinear (void); void solveHB (void); void loadMatrices (void); void VectorFFT (tvector *, int isign = 1); void VectorIFFT (tvector *, int isign = 1); int calcOrder (int); void MatrixFFT (tmatrix *); void calcJacobian (void); void solveVoltages (void); tvector expandVector (tvector, int); tmatrix expandMatrix (tmatrix, int); tmatrix extendMatrixLinear (tmatrix, int); void fillMatrixLinearExtended (tmatrix *, tvector *); void saveNodeVoltages (circuit *, int); private: std::vector negfreqs; // full frequency set std::vector posfreqs; // full frequency set but positive std::vector rfreqs; // real positive frequency set int * ndfreqs; // number of frequencies for each dimension std::vector dfreqs; // base frequencies for each dimension nr_double_t frequency; strlist * nlnodes, * lnnodes, * banodes, * nanodes, * exnodes; ptrlist excitations; ptrlist nolcircuits; ptrlist lincircuits; tmatrix * Y; // transadmittance matrix of linear network tmatrix * A; // MNA-matrix of linear network tmatrix * Z; // transimpedance matrix of linear network tmatrix * YV; // linear transadmittance matrix tmatrix * NA; // MNA-matrix of complete network tmatrix * JQ; // C-Jacobian in t and f tmatrix * JG; // G-Jacobian in t and f tmatrix * JF; // full Jacobian for non-linear balancing tvector * IG; // currents in t and f tvector * FQ; // charges in t and f tvector * VS; tvector * VP; tvector * FV; // error vector F(V) of HB equation tvector * IL; // currents into linear network tvector * IN; // currents into non-linear network tvector * IR; tvector * QR; tvector * RH; tvector * OM; tvector * IC; // source currents into balanced nodes tvector * IS; // currents through sources themselves tvector * x; tvector * vs; int runs; int lnfreqs; int nlfreqs; int nnlvsrcs; int nlnvsrcs; //int nlnnodes; int nnanodes; int nexnodes; int nbanodes; }; } // namespace qucs #endif /* __HBSOLVER_H__ */