Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/ac_sim.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 ac_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 "ac_sim.h"
00018 #include "main.h"
00019 
00020 
00021 AC_Sim::AC_Sim()
00022 {
00023   Description = QObject::tr("ac simulation");
00024 
00025   QString s = Description;
00026   int a = s.indexOf(" ");
00027   int b = s.findRev(" ");
00028   if (a != -1 && b != -1) {
00029     if (a > (int) s.length() - b)  b = a;
00030   }
00031   if (a < 8 || s.length() - b < 8) b = -1;
00032   if (b != -1) s[b] = '\n';
00033 
00034   Texts.append(new Text(0, 0, s.left(b), Qt::darkBlue, QucsSettings.largeFontSize));
00035   if (b != -1)
00036     Texts.append(new Text(0, 0, s.mid(b+1), Qt::darkBlue, QucsSettings.largeFontSize));
00037 
00038   x1 = -10; y1 = -9;
00039   x2 = x1+128; y2 = y1+41;
00040 
00041   tx = 0;
00042   ty = y2+1;
00043   Model = ".AC";
00044   Name  = "AC";
00045 
00046   // The index of the first 4 properties must not changed. Used in recreate().
00047   Props.append(new Property("Type", "lin", true,
00048       QObject::tr("sweep type")+" [lin, log, list, const]"));
00049   Props.append(new Property("Start", "1 GHz", true,
00050       QObject::tr("start frequency in Hertz")));
00051   Props.append(new Property("Stop", "10 GHz", true,
00052       QObject::tr("stop frequency in Hertz")));
00053   Props.append(new Property("Points", "19", true,
00054       QObject::tr("number of simulation steps")));
00055   Props.append(new Property("Noise", "no", false,
00056       QObject::tr("calculate noise voltages")+
00057       " [yes, no]"));
00058 }
00059 
00060 AC_Sim::~AC_Sim()
00061 {
00062 }
00063 
00064 Component* AC_Sim::newOne()
00065 {
00066   return new AC_Sim();
00067 }
00068 
00069 Element* AC_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
00070 {
00071   Name = QObject::tr("ac simulation");
00072   BitmapFile = (char *) "ac";
00073 
00074   if(getNewOne)  return new AC_Sim();
00075   return 0;
00076 }
00077 
00078 void AC_Sim::recreate(Schematic*)
00079 {
00080   Property *pp = Props.first();
00081   if((pp->Value == "list") || (pp->Value == "const")) {
00082     // Call them "Symbol" to omit them in the netlist.
00083     pp = Props.next();
00084     pp->Name = "Symbol";
00085     pp->display = false;
00086     pp = Props.next();
00087     pp->Name = "Symbol";
00088     pp->display = false;
00089     Props.next()->Name = "Values";
00090   }
00091   else {
00092     Props.next()->Name = "Start";
00093     Props.next()->Name = "Stop";
00094     Props.next()->Name = "Points";
00095   }
00096 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines