My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ac_sim.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  ac_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 "ac_sim.h"
19 #include "main.h"
20 
21 
23 {
24  Description = QObject::tr("ac 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 (a < 8 || s.length() - b < 8) b = -1;
33  if (b != -1) s[b] = '\n';
34 
35  Texts.append(new Text(0, 0, s.left(b), QPen::darkBlue, QucsSettings.largeFontSize));
36  if (b != -1)
37  Texts.append(new Text(0, 0, s.mid(b+1), QPen::darkBlue, QucsSettings.largeFontSize));
38 
39  x1 = -10; y1 = -9;
40  x2 = x1+128; y2 = y1+41;
41 
42  tx = 0;
43  ty = y2+1;
44  Model = ".AC";
45  Name = "AC";
46 
47  // The index of the first 4 properties must not changed. Used in recreate().
48  Props.append(new Property("Type", "lin", true,
49  QObject::tr("sweep type")+" [lin, log, list, const]"));
50  Props.append(new Property("Start", "1 GHz", true,
51  QObject::tr("start frequency in Hertz")));
52  Props.append(new Property("Stop", "10 GHz", true,
53  QObject::tr("stop frequency in Hertz")));
54  Props.append(new Property("Points", "19", true,
55  QObject::tr("number of simulation steps")));
56  Props.append(new Property("Noise", "no", false,
57  QObject::tr("calculate noise voltages")+
58  " [yes, no]"));
59 }
60 
62 {
63 }
64 
66 {
67  return new AC_Sim();
68 }
69 
70 Element* AC_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne)
71 {
72  Name = QObject::tr("ac simulation");
73  BitmapFile = (char *) "ac";
74 
75  if(getNewOne) return new AC_Sim();
76  return 0;
77 }
78 
80 {
81  Property *pp = Props.first();
82  if((pp->Value == "list") || (pp->Value == "const")) {
83  // Call them "Symbol" to omit them in the netlist.
84  pp = Props.next();
85  pp->Name = "Symbol";
86  pp->display = false;
87  pp = Props.next();
88  pp->Name = "Symbol";
89  pp->display = false;
90  Props.next()->Name = "Values";
91  }
92  else {
93  Props.next()->Name = "Start";
94  Props.next()->Name = "Stop";
95  Props.next()->Name = "Points";
96  }
97 }