My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
param_sweep.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  param_sweep.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 "param_sweep.h"
19 #include "main.h"
20 
21 
23 {
24  Description = QObject::tr("Parameter sweep");
25 
26  QString s = Description;
27  int a = s.findRev(" ");
28  if (a != -1) s[a] = '\n'; // break line
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 = ".SW";
40  Name = "SW";
41 
42  // The index of the first 6 properties must not changed. Used in recreate().
43  Props.append(new Property("Sim", "", true,
44  QObject::tr("simulation to perform parameter sweep on")));
45  Props.append(new Property("Type", "lin", true,
46  QObject::tr("sweep type")+" [lin, log, list, const]"));
47  Props.append(new Property("Param", "R1", true,
48  QObject::tr("parameter to sweep")));
49  Props.append(new Property("Start", "5 Ohm", true,
50  QObject::tr("start value for sweep")));
51  Props.append(new Property("Stop", "50 Ohm", true,
52  QObject::tr("stop value for sweep")));
53  Props.append(new Property("Points", "20", true,
54  QObject::tr("number of simulation steps")));
55 }
56 
58 {
59 }
60 
62 {
63  return new Param_Sweep();
64 }
65 
66 Element* Param_Sweep::info(QString& Name, char* &BitmapFile, bool getNewOne)
67 {
68  Name = QObject::tr("Parameter sweep");
69  BitmapFile = (char *) "sweep";
70 
71  if(getNewOne) return new Param_Sweep();
72  return 0;
73 }
74 
76 {
77  Property *pp = Props.at(1);
78  Props.next();
79  if((pp->Value == "list") || (pp->Value == "const")) {
80  // Call them "Symbol" to omit them in the netlist.
81  pp = Props.next();
82  pp->Name = "Symbol";
83  pp->display = false;
84  pp = Props.next();
85  pp->Name = "Symbol";
86  pp->display = false;
87  Props.next()->Name = "Values";
88  }
89  else {
90  Props.next()->Name = "Start";
91  Props.next()->Name = "Stop";
92  Props.next()->Name = "Points";
93  }
94 }
95