My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
trsolver.h
Go to the documentation of this file.
1 /*
2  * trsolver.h - transient solver class definitions
3  *
4  * Copyright (C) 2004, 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: trsolver.h 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #ifndef __TRSOLVER_H__
26 #define __TRSOLVER_H__
27 
28 #include "nasolver.h"
29 #include "states.h"
30 
31 class sweep;
32 class circuit;
33 class history;
34 
35 class trsolver : public nasolver<nr_double_t>, public states<nr_double_t>
36 {
37  public:
39  trsolver (char *);
40  trsolver (trsolver &);
41  ~trsolver ();
42  int solve (void);
43  int predictor (void);
44  int corrector (void);
45  void nextStates (void);
46  void fillStates (void);
47  void setMode (int);
48  void setDelta (void);
49  void adjustDelta (nr_double_t);
50  void adjustOrder (int reduce = 0);
51  void initTR (void);
52  void deinitTR (void);
53  static void calcTR (trsolver *);
54  void restart (void);
55  void initDC (void);
56  static void calcDC (trsolver *);
57  void initSteps (void);
58  void saveAllResults (nr_double_t);
59  nr_double_t checkDelta (void);
60  void updateCoefficients (nr_double_t);
61  void initHistory (nr_double_t);
62  void updateHistory (nr_double_t);
63  void saveHistory (circuit *);
64  void predictBashford (void);
65  void predictEuler (void);
66  void predictGear (void);
67  void initCircuitTR (circuit *);
69  int dcAnalysis (void);
70 
71  private:
72  sweep * swp;
73  nr_double_t predCoeff[8];
74  nr_double_t corrCoeff[8];
75  nr_double_t deltas[8];
76  nr_double_t delta;
77  nr_double_t deltaMax;
78  nr_double_t deltaMin;
79  nr_double_t deltaOld;
80  nr_double_t stepDelta;
81  int CMethod; // user specified corrector method
82  int PMethod; // user specified predictor method
83  int corrMaxOrder; // maximum corrector order
84  int predMaxOrder; // maximum predictor order
85  int corrType; // current corrector method
86  int predType; // current predictor method
87  int corrOrder; // current corrector order
88  int predOrder; // current predictor order
89  int rejected;
90  int converged;
91  tvector<nr_double_t> * solution[8];
92  nr_double_t current;
93  int statSteps;
94  int statRejected;
95  int statIterations;
96  int statConvergence;
97  history * tHistory;
98  bool relaxTSR;
99  bool initialDC;
100 };
101 
102 #endif /* __TRSOLVER_H__ */