Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/tr_sim.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 tr_sim.cpp
00003                                ------------
00004     begin                : Sat Aug 23 2003
00005     copyright            : (C) 2003 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #include "tr_sim.h"
00018 #include "main.h"
00019 
00020 
00021 TR_Sim::TR_Sim()
00022 {
00023   Description = QObject::tr("transient simulation");
00024 
00025   QString  s = Description;
00026   int a = s.indexOf(" ");
00027   if (a != -1) s[a] = '\n';
00028 
00029   Texts.append(new Text(0, 0, s.left(a), Qt::darkBlue, QucsSettings.largeFontSize));
00030   if (a != -1)
00031     Texts.append(new Text(0, 0, s.mid(a+1), Qt::darkBlue, QucsSettings.largeFontSize));
00032 
00033   x1 = -10; y1 = -9;
00034   x2 = x1+104; y2 = y1+59;
00035 
00036   tx = 0;
00037   ty = y2+1;
00038   Model = ".TR";
00039   Name  = "TR";
00040 
00041   // The index of the first 4 properties must not changed. Used in recreate().
00042   Props.append(new Property("Type", "lin", true,
00043   QObject::tr("sweep type")+" [lin, log, list, const]"));
00044   Props.append(new Property("Start", "0", true,
00045   QObject::tr("start time in seconds")));
00046   Props.append(new Property("Stop", "1 ms", true,
00047   QObject::tr("stop time in seconds")));
00048   Props.append(new Property("Points", "11", false,
00049   QObject::tr("number of simulation time steps")));
00050   Props.append(new Property("IntegrationMethod", "Trapezoidal", false,
00051   QObject::tr("integration method")+
00052   " [Euler, Trapezoidal, Gear, AdamsMoulton]"));
00053   Props.append(new Property("Order", "2", false,
00054   QObject::tr("order of integration method")+" (1-6)"));
00055   Props.append(new Property("InitialStep", "1 ns", false,
00056   QObject::tr("initial step size in seconds")));
00057   Props.append(new Property("MinStep", "1e-16", false,
00058   QObject::tr("minimum step size in seconds")));
00059   Props.append(new Property("MaxIter", "150", false,
00060   QObject::tr("maximum number of iterations until error")));
00061   Props.append(new Property("reltol", "0.001", false,
00062   QObject::tr("relative tolerance for convergence")));
00063   Props.append(new Property("abstol", "1 pA", false,
00064   QObject::tr("absolute tolerance for currents")));
00065   Props.append(new Property("vntol", "1 uV", false,
00066   QObject::tr("absolute tolerance for voltages")));
00067   Props.append(new Property("Temp", "26.85", false,
00068   QObject::tr("simulation temperature in degree Celsius")));
00069   Props.append(new Property("LTEreltol", "1e-3", false,
00070   QObject::tr("relative tolerance of local truncation error")));
00071   Props.append(new Property("LTEabstol", "1e-6", false,
00072   QObject::tr("absolute tolerance of local truncation error")));
00073   Props.append(new Property("LTEfactor", "1", false,
00074   QObject::tr("overestimation of local truncation error")));
00075   Props.append(new Property("Solver", "CroutLU", false,
00076   QObject::tr("method for solving the circuit matrix")+
00077   " [CroutLU, DoolittleLU, HouseholderQR, HouseholderLQ, GolubSVD]"));
00078   Props.append(new Property("relaxTSR", "no", false,
00079   QObject::tr("relax time step raster")+" [no, yes]"));
00080   Props.append(new Property("initialDC", "yes", false,
00081   QObject::tr("perform an initial DC analysis")+" [yes, no]"));
00082   Props.append(new Property("MaxStep", "0", false,
00083   QObject::tr("maximum step size in seconds")));
00084 }
00085 
00086 TR_Sim::~TR_Sim()
00087 {
00088 }
00089 
00090 Component* TR_Sim::newOne()
00091 {
00092   return new TR_Sim();
00093 }
00094 
00095 Element* TR_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
00096 {
00097   Name = QObject::tr("Transient simulation");
00098   BitmapFile = (char *) "tran";
00099 
00100   if(getNewOne)  return new TR_Sim();
00101   return 0;
00102 }
00103 
00104 void TR_Sim::recreate(Schematic*)
00105 {
00106   Property *pp = Props.first();
00107   if((pp->Value == "list") || (pp->Value == "const")) {
00108     // Call them "Symbol" to omit them in the netlist.
00109     pp = Props.next();
00110     pp->Name = "Symbol";
00111     pp->display = false;
00112     pp = Props.next();
00113     pp->Name = "Symbol";
00114     pp->display = false;
00115     Props.next()->Name = "Values";
00116   }
00117   else {
00118     Props.next()->Name = "Start";
00119     Props.next()->Name = "Stop";
00120     Props.next()->Name = "Points";
00121   }
00122 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines