My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
tr_sim.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tr_sim.cpp
3  ------------
4  begin : Sat Aug 23 2003
5  copyright : (C) 2003 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "tr_sim.h"
19 #include "main.h"
20 
21 
23 {
24  Description = QObject::tr("transient simulation");
25 
26  QString s = Description;
27  int a = s.find(" ");
28  if (a != -1) s[a] = '\n';
29 
30  Texts.append(new Text(0, 0, s.left(a), QPen::darkBlue, QucsSettings.largeFontSize));
31  if (a != -1)
32  Texts.append(new Text(0, 0, s.mid(a+1), QPen::darkBlue, QucsSettings.largeFontSize));
33 
34  x1 = -10; y1 = -9;
35  x2 = x1+104; y2 = y1+59;
36 
37  tx = 0;
38  ty = y2+1;
39  Model = ".TR";
40  Name = "TR";
41 
42  // The index of the first 4 properties must not changed. Used in recreate().
43  Props.append(new Property("Type", "lin", true,
44  QObject::tr("sweep type")+" [lin, log, list, const]"));
45  Props.append(new Property("Start", "0", true,
46  QObject::tr("start time in seconds")));
47  Props.append(new Property("Stop", "1 ms", true,
48  QObject::tr("stop time in seconds")));
49  Props.append(new Property("Points", "11", false,
50  QObject::tr("number of simulation time steps")));
51  Props.append(new Property("IntegrationMethod", "Trapezoidal", false,
52  QObject::tr("integration method")+
53  " [Euler, Trapezoidal, Gear, AdamsMoulton]"));
54  Props.append(new Property("Order", "2", false,
55  QObject::tr("order of integration method")+" (1-6)"));
56  Props.append(new Property("InitialStep", "1 ns", false,
57  QObject::tr("initial step size in seconds")));
58  Props.append(new Property("MinStep", "1e-16", false,
59  QObject::tr("minimum step size in seconds")));
60  Props.append(new Property("MaxIter", "150", false,
61  QObject::tr("maximum number of iterations until error")));
62  Props.append(new Property("reltol", "0.001", false,
63  QObject::tr("relative tolerance for convergence")));
64  Props.append(new Property("abstol", "1 pA", false,
65  QObject::tr("absolute tolerance for currents")));
66  Props.append(new Property("vntol", "1 uV", false,
67  QObject::tr("absolute tolerance for voltages")));
68  Props.append(new Property("Temp", "26.85", false,
69  QObject::tr("simulation temperature in degree Celsius")));
70  Props.append(new Property("LTEreltol", "1e-3", false,
71  QObject::tr("relative tolerance of local truncation error")));
72  Props.append(new Property("LTEabstol", "1e-6", false,
73  QObject::tr("absolute tolerance of local truncation error")));
74  Props.append(new Property("LTEfactor", "1", false,
75  QObject::tr("overestimation of local truncation error")));
76  Props.append(new Property("Solver", "CroutLU", false,
77  QObject::tr("method for solving the circuit matrix")+
78  " [CroutLU, DoolittleLU, HouseholderQR, HouseholderLQ, GolubSVD]"));
79  Props.append(new Property("relaxTSR", "no", false,
80  QObject::tr("relax time step raster")+" [no, yes]"));
81  Props.append(new Property("initialDC", "yes", false,
82  QObject::tr("perform an initial DC analysis")+" [yes, no]"));
83  Props.append(new Property("MaxStep", "0", false,
84  QObject::tr("maximum step size in seconds")));
85 }
86 
88 {
89 }
90 
92 {
93  return new TR_Sim();
94 }
95 
96 Element* TR_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
97 {
98  Name = QObject::tr("Transient simulation");
99  BitmapFile = (char *) "tran";
100 
101  if(getNewOne) return new TR_Sim();
102  return 0;
103 }
104 
106 {
107  Property *pp = Props.first();
108  if((pp->Value == "list") || (pp->Value == "const")) {
109  // Call them "Symbol" to omit them in the netlist.
110  pp = Props.next();
111  pp->Name = "Symbol";
112  pp->display = false;
113  pp = Props.next();
114  pp->Name = "Symbol";
115  pp->display = false;
116  Props.next()->Name = "Values";
117  }
118  else {
119  Props.next()->Name = "Start";
120  Props.next()->Name = "Stop";
121  Props.next()->Name = "Points";
122  }
123 }