Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/param_sweep.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                               param_sweep.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 "param_sweep.h"
00018 #include "main.h"
00019 
00020 
00021 Param_Sweep::Param_Sweep()
00022 {
00023   Description = QObject::tr("Parameter sweep");
00024 
00025   QString  s = Description;
00026   int a = s.findRev(" ");
00027   if (a != -1) s[a] = '\n';    // break line
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 = ".SW";
00039   Name  = "SW";
00040 
00041   // The index of the first 6 properties must not changed. Used in recreate().
00042   Props.append(new Property("Sim", "", true,
00043     QObject::tr("simulation to perform parameter sweep on")));
00044   Props.append(new Property("Type", "lin", true,
00045     QObject::tr("sweep type")+" [lin, log, list, const]"));
00046   Props.append(new Property("Param", "R1", true,
00047     QObject::tr("parameter to sweep")));
00048   Props.append(new Property("Start", "5 Ohm", true,
00049     QObject::tr("start value for sweep")));
00050   Props.append(new Property("Stop", "50 Ohm", true,
00051     QObject::tr("stop value for sweep")));
00052   Props.append(new Property("Points", "20", true,
00053     QObject::tr("number of simulation steps")));
00054 }
00055 
00056 Param_Sweep::~Param_Sweep()
00057 {
00058 }
00059 
00060 Component* Param_Sweep::newOne()
00061 {
00062   return new Param_Sweep();
00063 }
00064 
00065 Element* Param_Sweep::info(QString& Name, char* &BitmapFile, bool getNewOne)
00066 {
00067   Name = QObject::tr("Parameter sweep");
00068   BitmapFile = (char *) "sweep";
00069 
00070   if(getNewOne)  return new Param_Sweep();
00071   return 0;
00072 }
00073 
00074 void Param_Sweep::recreate(Schematic*)
00075 {
00076   Property *pp = Props.at(1);
00077   Props.next();
00078   if((pp->Value == "list") || (pp->Value == "const")) {
00079     // Call them "Symbol" to omit them in the netlist.
00080     pp = Props.next();
00081     pp->Name = "Symbol";
00082     pp->display = false;
00083     pp = Props.next();
00084     pp->Name = "Symbol";
00085     pp->display = false;
00086     Props.next()->Name = "Values";
00087   }
00088   else {
00089     Props.next()->Name = "Start";
00090     Props.next()->Name = "Stop";
00091     Props.next()->Name = "Points";
00092   }
00093 }
00094 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines