Qucs-core
0.0.19
|
00001 /* 00002 * trsolver.h - transient solver class definitions 00003 * 00004 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Stefan Jahn <stefan@lkcc.org> 00005 * 00006 * This is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2, or (at your option) 00009 * any later version. 00010 * 00011 * This software is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this package; see the file COPYING. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 * 00021 * $Id$ 00022 * 00023 */ 00024 00025 #ifndef __TRSOLVER_H__ 00026 #define __TRSOLVER_H__ 00027 00028 #include "nasolver.h" 00029 #include "states.h" 00030 00031 namespace qucs { 00032 00033 class sweep; 00034 class circuit; 00035 class history; 00036 00037 class trsolver : public nasolver<nr_double_t>, public states<nr_double_t> 00038 { 00039 public: 00040 ACREATOR (trsolver); 00041 trsolver (const std::string &name); 00042 trsolver (trsolver &); 00043 ~trsolver (); 00044 int solve (void); 00045 int predictor (void); 00046 int corrector (void); 00047 void nextStates (void); 00048 void fillStates (void); 00049 void setMode (int); 00050 void setDelta (void); 00051 void adjustDelta (nr_double_t); 00052 void adjustOrder (int reduce = 0); 00053 void initTR (void); 00054 void deinitTR (void); 00055 static void calcTR (trsolver *); 00056 void restart (void); 00057 void initDC (void); 00058 static void calcDC (trsolver *); 00059 void initSteps (void); 00060 void saveAllResults (nr_double_t); 00061 nr_double_t checkDelta (void); 00062 void updateCoefficients (nr_double_t); 00063 void initHistory (nr_double_t); 00064 void updateHistory (nr_double_t); 00065 void saveHistory (circuit *); 00066 void predictBashford (void); 00067 void predictEuler (void); 00068 void predictGear (void); 00069 void initCircuitTR (circuit *); 00070 void fillSolution (tvector<nr_double_t> *); 00071 int dcAnalysis (void); 00072 00073 protected: 00074 sweep * swp; 00075 nr_double_t predCoeff[8]; 00076 nr_double_t corrCoeff[8]; 00077 nr_double_t deltas[8]; 00078 nr_double_t delta; 00079 nr_double_t deltaMax; 00080 nr_double_t deltaMin; 00081 nr_double_t deltaOld; 00082 nr_double_t stepDelta; 00083 int CMethod; // user specified corrector method 00084 int PMethod; // user specified predictor method 00085 int corrMaxOrder; // maximum corrector order 00086 int predMaxOrder; // maximum predictor order 00087 int corrType; // current corrector method 00088 int predType; // current predictor method 00089 int corrOrder; // current corrector order 00090 int predOrder; // current predictor order 00091 int rejected; 00092 int converged; 00093 tvector<nr_double_t> * solution[8]; 00094 nr_double_t current; 00095 int statSteps; 00096 int statRejected; 00097 int statIterations; 00098 int statConvergence; 00099 history * tHistory; 00100 bool relaxTSR; 00101 bool initialDC; 00102 00103 }; 00104 00105 } // namespace qucs 00106 00107 #endif /* __TRSOLVER_H__ */