My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sp_sim.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  sp_sim.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 "sp_sim.h"
19 #include "main.h"
20 
21 
23 {
24  Description = QObject::tr("S parameter simulation");
25 
26  QString s = Description;
27  int a = s.find(" ");
28  int b = s.findRev(" ");
29  if (a != -1 && b != -1) {
30  if (a > (int) s.length() - b) b = a;
31  }
32  if (b != -1) s[b] = '\n';
33 
34  Texts.append(new Text(0, 0, s.left(b), QPen::darkBlue, QucsSettings.largeFontSize));
35  if (b != -1)
36  Texts.append(new Text(0, 0, s.mid(b+1), QPen::darkBlue, QucsSettings.largeFontSize));
37 
38  x1 = -10; y1 = -9;
39  x2 = x1+121; y2 = y1+59;
40 
41  tx = 0;
42  ty = y2+1;
43  Model = ".SP";
44  Name = "SP";
45 
46  // The index of the first 4 properties must not changed. Used in recreate().
47  Props.append(new Property("Type", "lin", true,
48  QObject::tr("sweep type")+" [lin, log, list, const]"));
49  Props.append(new Property("Start", "1 GHz", true,
50  QObject::tr("start frequency in Hertz")));
51  Props.append(new Property("Stop", "10 GHz", true,
52  QObject::tr("stop frequency in Hertz")));
53  Props.append(new Property("Points", "19", true,
54  QObject::tr("number of simulation steps")));
55  Props.append(new Property("Noise", "no", false,
56  QObject::tr("calculate noise parameters")+
57  " [yes, no]"));
58  Props.append(new Property("NoiseIP", "1", false,
59  QObject::tr("input port for noise figure")));
60  Props.append(new Property("NoiseOP", "2", false,
61  QObject::tr("output port for noise figure")));
62  Props.append(new Property("saveCVs", "no", false,
63  QObject::tr("put characteristic values into dataset")+
64  " [yes, no]"));
65  Props.append(new Property("saveAll", "no", false,
66  QObject::tr("save subcircuit characteristic values into dataset")+
67  " [yes, no]"));
68 }
69 
71 {
72 }
73 
75 {
76  return new SP_Sim();
77 }
78 
79 Element* SP_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
80 {
81  Name = QObject::tr("S-parameter simulation");
82  BitmapFile = (char *) "sparameter";
83 
84  if(getNewOne) return new SP_Sim();
85  return 0;
86 }
87 
89 {
90  Property *pp = Props.first();
91  if((pp->Value == "list") || (pp->Value == "const")) {
92  // Call them "Symbol" to omit them in the netlist.
93  pp = Props.next();
94  pp->Name = "Symbol";
95  pp->display = false;
96  pp = Props.next();
97  pp->Name = "Symbol";
98  pp->display = false;
99  Props.next()->Name = "Values";
100  }
101  else {
102  Props.next()->Name = "Start";
103  Props.next()->Name = "Stop";
104  Props.next()->Name = "Points";
105  }
106 }