Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/sp_sim.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 sp_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 "sp_sim.h"
00018 #include "main.h"
00019 
00020 
00021 SP_Sim::SP_Sim()
00022 {
00023   Description = QObject::tr("S parameter 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 (b != -1) s[b] = '\n';
00032 
00033   Texts.append(new Text(0, 0, s.left(b), Qt::darkBlue, QucsSettings.largeFontSize));
00034   if (b != -1)
00035     Texts.append(new Text(0, 0, s.mid(b+1), Qt::darkBlue, QucsSettings.largeFontSize));
00036 
00037   x1 = -10; y1 = -9;
00038   x2 = x1+121; y2 = y1+59;
00039 
00040   tx = 0;
00041   ty = y2+1;
00042   Model = ".SP";
00043   Name  = "SP";
00044 
00045   // The index of the first 4 properties must not changed. Used in recreate().
00046   Props.append(new Property("Type", "lin", true,
00047   QObject::tr("sweep type")+" [lin, log, list, const]"));
00048   Props.append(new Property("Start", "1 GHz", true,
00049   QObject::tr("start frequency in Hertz")));
00050   Props.append(new Property("Stop", "10 GHz", true,
00051   QObject::tr("stop frequency in Hertz")));
00052   Props.append(new Property("Points", "19", true,
00053   QObject::tr("number of simulation steps")));
00054   Props.append(new Property("Noise", "no", false,
00055   QObject::tr("calculate noise parameters")+
00056   " [yes, no]"));
00057   Props.append(new Property("NoiseIP", "1", false,
00058   QObject::tr("input port for noise figure")));
00059   Props.append(new Property("NoiseOP", "2", false,
00060   QObject::tr("output port for noise figure")));
00061   Props.append(new Property("saveCVs", "no", false,
00062   QObject::tr("put characteristic values into dataset")+
00063   " [yes, no]"));
00064   Props.append(new Property("saveAll", "no", false,
00065   QObject::tr("save subcircuit characteristic values into dataset")+
00066   " [yes, no]"));
00067 }
00068 
00069 SP_Sim::~SP_Sim()
00070 {
00071 }
00072 
00073 Component* SP_Sim::newOne()
00074 {
00075   return new SP_Sim();
00076 }
00077 
00078 Element* SP_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
00079 {
00080   Name = QObject::tr("S-parameter simulation");
00081   BitmapFile = (char *) "sparameter";
00082 
00083   if(getNewOne)  return new SP_Sim();
00084   return 0;
00085 }
00086 
00087 void SP_Sim::recreate(Schematic*)
00088 {
00089   Property *pp = Props.first();
00090   if((pp->Value == "list") || (pp->Value == "const")) {
00091     // Call them "Symbol" to omit them in the netlist.
00092     pp = Props.next();
00093     pp->Name = "Symbol";
00094     pp->display = false;
00095     pp = Props.next();
00096     pp->Name = "Symbol";
00097     pp->display = false;
00098     Props.next()->Name = "Values";
00099   }
00100   else {
00101     Props.next()->Name = "Start";
00102     Props.next()->Name = "Stop";
00103     Props.next()->Name = "Points";
00104   }
00105 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines