Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
e_trsolver.h
Go to the documentation of this file.
1 /*
2  * e_trsolver.h - transient solver external interface 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$
22  *
23  */
24 
34 #ifndef __E_TRSOLVER_H__
35 #define __E_TRSOLVER_H__
36 
37 #include "qucs_interface.h"
38 #include "trsolver.h"
39 #include <vector>
40 
41 namespace qucs {
42 
55 class e_trsolver : public trsolver
56 {
57 public:
59  //e_trsolver ();
60  e_trsolver (char *);
62  ~e_trsolver ();
63 
64  int init (nr_double_t, nr_double_t, int);
65 // int finish ();
66  bool isExternal() { return true; };
67 
68 public:
69 
70  int stepsolve_sync (nr_double_t synctime);
71  void acceptstep_sync (void);
72  int stepsolve_async (nr_double_t steptime);
73  void acceptstep_async (void);
74  void rejectstep_async (void);
75  void getsolution (double *);
76 
99  int setECVSVoltage(char * ecvsname, nr_double_t V);
100 
102  int getJacRows ();
103 
105  int getJacCols ();
106 
113  void getJacData (int r, int c, nr_double_t& data);
114 
125  int getNodeV (char * label, nr_double_t& nodeV);
126 
137  int getVProbeV (char * probename, nr_double_t& probeV);
138 
149  int getIProbeI (char * probename, nr_double_t& probeI);
150 
151  // debugging functions
152  void debug (void);
153  void printx (void);
154 
169  void (*messagefcn)(int level, const char * format, ...);
170 
171 private:
172 
174  nr_double_t reltol;
175  nr_double_t abstol;
176  nr_double_t vntol;
177  nr_double_t time;
178  nr_double_t saveCurrent;
179  nr_double_t lastsynctime;
180  int running;
181  int rejected;
183 
184  void initETR (nr_double_t start, nr_double_t, int);
185  void truncateHistory (nr_double_t);
186  void updateExternalInterpTime(nr_double_t);
187  void storeHistoryAges (void);
188  void updateHistoryAges(nr_double_t);
189 
190 // int solve_nonlinear_step (void);
191  void adjustDelta_sync (nr_double_t);
192 
193  // Asynchronous specific items
194 
195  // For going back in history of a solution after multiple
196  // solution steps
197  std::vector<nr_double_t> initialhistages;
199  nr_double_t lastasynctime;
200  nr_double_t lastdeltas[8];
201  nr_double_t lastdelta;
202  // restores the solver to an earlier stored state, used
203  // when an asynchronous major step is rejected by the
204  // parent process
205  void restoreSolution (void);
208 };
209 
210 } // namespace qucs
211 
212 #endif /* __e_trsolver_H__ */
213 
start
Definition: parse_zvr.y:126
void getsolution(double *)
Definition: e_trsolver.cpp:873
void fillLastSolution(tvector< nr_double_t > *)
Definition: e_trsolver.cpp:285
tvector< nr_double_t > * lastsolution[8]
Definition: e_trsolver.h:198
int setECVSVoltage(char *ecvsname, nr_double_t V)
Sets the voltage of an exterally controlled voltage source.
Definition: e_trsolver.cpp:990
nr_double_t lastsynctime
Definition: e_trsolver.h:179
void updateExternalInterpTime(nr_double_t)
void storeHistoryAges(void)
Definition: e_trsolver.cpp:272
void(* messagefcn)(int level, const char *format,...)
Pointer to function used to print messages during a sim.
Definition: e_trsolver.h:169
void debug(void)
Definition: e_trsolver.cpp:161
void updateHistoryAges(nr_double_t)
Definition: e_trsolver.cpp:840
nr_double_t abstol
Definition: e_trsolver.h:175
void restoreSolution(void)
void truncateHistory(nr_double_t)
r
Definition: parse_mdl.y:515
int getJacCols()
Returns the number of columns in the Jacobian matrix for the circuit.
nr_double_t lastdeltas[8]
Definition: e_trsolver.h:200
void adjustDelta_sync(nr_double_t)
Definition: e_trsolver.cpp:555
void copySolution(tvector< nr_double_t > *[8], tvector< nr_double_t > *[8])
Definition: e_trsolver.cpp:826
int getNodeV(char *label, nr_double_t &nodeV)
Obtains the voltage of a node by name.
Definition: e_trsolver.cpp:887
std::vector< nr_double_t > initialhistages
Definition: e_trsolver.h:197
nr_double_t time
Definition: e_trsolver.h:177
int getVProbeV(char *probename, nr_double_t &probeV)
Obtains the voltage reported by a voltage probe.
Definition: e_trsolver.cpp:903
nr_double_t lastdelta
Definition: e_trsolver.h:201
#define V(con)
Definition: evaluate.cpp:63
void initETR(nr_double_t start, nr_double_t, int)
Definition: e_trsolver.cpp:292
dataset * data
Definition: analysis.h:274
void rejectstep_async(void)
Definition: e_trsolver.cpp:798
int stepsolve_async(nr_double_t steptime)
Definition: e_trsolver.cpp:637
int getJacRows()
Returns the number of rows in the Jacobian matrix for the circuit.
The generic external interface class header file.
ACREATOR(e_trsolver)
int stepsolve_sync(nr_double_t synctime)
Definition: e_trsolver.cpp:407
void getJacData(int r, int c, nr_double_t &data)
Obtains the data from the Jacobian matrix for the circuit.
int getIProbeI(char *probename, nr_double_t &probeI)
Obtains the current reported by a current probe.
Definition: e_trsolver.cpp:949
nr_double_t saveCurrent
Definition: e_trsolver.h:178
nr_double_t lastasynctime
Definition: e_trsolver.h:199
nr_double_t reltol
Definition: e_trsolver.h:174
int init(nr_double_t, nr_double_t, int)
Definition: e_trsolver.cpp:180
void acceptstep_async(void)
Definition: e_trsolver.cpp:780
bool isExternal()
informs whether this is an external sim
Definition: e_trsolver.h:66
void printx(void)
Definition: e_trsolver.cpp:370
nr_double_t vntol
Definition: e_trsolver.h:176
void acceptstep_sync(void)
Definition: e_trsolver.cpp:507