My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
potentiometer.cpp
Go to the documentation of this file.
1 /*
2  * potentiometer.cpp - device implementations for potentiometer module
3  *
4  * This is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  */
10 
11 #include "potentiometer.h"
12 
14 {
15  Description = QObject::tr ("Potentiometer verilog device");
16 
17  Props.append (new Property ("R_pot", "1e4", false,
18  QObject::tr ("nominal device resistance")
19  +" ("+QObject::tr ("Ohm")+")"));
20  Props.append (new Property ("Rotation", "120", false,
21  QObject::tr ("shaft/wiper arm rotation")
22  +" ("+QObject::tr ("degrees")+")"));
23  Props.append (new Property ("Taper_Coeff", "0", false,
24  QObject::tr ("resistive law taper coefficient")));
25  Props.append (new Property ("LEVEL", "1", false,
26  QObject::tr ("device type selector")+" [1, 2, 3]"));
27  Props.append (new Property ("Max_Rotation", "240.0", false,
28  QObject::tr ("maximum shaft/wiper rotation")
29  +" ("+QObject::tr ("degrees")+")"));
30  Props.append (new Property ("Conformity", "0.2", false,
31  QObject::tr ("conformity error")
32  +" ("+QObject::tr ("%")+")"));
33  Props.append (new Property ("Linearity", "0.2", false,
34  QObject::tr ("linearity error")
35  +" ("+QObject::tr ("%")+")"));
36  Props.append (new Property ("Contact_Res", "1", false,
37  QObject::tr ("wiper arm contact resistance")
38  +" ("+QObject::tr ("Ohm")+")"));
39  Props.append (new Property ("Temp_Coeff", "100", false,
40  QObject::tr ("resistance temperature coefficient")
41  +" ("+QObject::tr ("PPM/Celsius")+")"));
42  Props.append (new Property ("Tnom", "26.85", false,
43  QObject::tr ("parameter measurement temperature")
44  +" ("+QObject::tr ("Celsius")+")"));
45  Props.append (new Property ("Temp", "26.85", false,
46  QObject::tr ("simulation temperature")));
47 
48  createSymbol ();
49  tx = x1 + 8;
50  ty = y2 + 4;
51  Model = "potentiometer";
52  Name = "POT";
53 }
54 
56 {
57  potentiometer * p = new potentiometer();
58  p->Props.getFirst()->Value = Props.getFirst()->Value;
59  p->recreate(0);
60  return p;
61 }
62 
63 Element * potentiometer::info(QString& Name, char * &BitmapFile, bool getNewOne)
64 {
65  Name = QObject::tr("Potentiometer");
66  BitmapFile = (char *) "potentiometer";
67 
68  if(getNewOne) return new potentiometer();
69  return 0;
70 }
71 
73 {
74  // frame
75  Lines.append(new Line(-30,-13,-30, 10,QPen(QPen::darkBlue,2)));
76  Lines.append(new Line(-30, 10, 30, 10,QPen(QPen::darkBlue,2)));
77  Lines.append(new Line( 30, 10, 30,-13,QPen(QPen::darkBlue,2)));
78  Lines.append(new Line( 30,-13,-30,-13,QPen(QPen::darkBlue,2)));
79 
80  // resistor
81  Lines.append(new Line(-40, 0, -25, 0,QPen(QPen::darkBlue,2)));
82  Lines.append(new Line(-25, 0, -20,-5,QPen(QPen::darkBlue,2)));
83  Lines.append(new Line(-20, -5, -15, 0,QPen(QPen::darkBlue,2)));
84  Lines.append(new Line(-15, 0, -10,-5,QPen(QPen::darkBlue,2)));
85  Lines.append(new Line(-10, -5, -5, 0,QPen(QPen::darkBlue,2)));
86  Lines.append(new Line( -5, 0, 0, -5,QPen(QPen::darkBlue,2)));
87  Lines.append(new Line( 0, -5, 5, 0,QPen(QPen::darkBlue,2)));
88  Lines.append(new Line( 5, 0, 10, -5,QPen(QPen::darkBlue,2)));
89  Lines.append(new Line( 10, -5, 15, 0,QPen(QPen::darkBlue,2)));
90  Lines.append(new Line( 15, 0, 20, -5,QPen(QPen::darkBlue,2)));
91  Lines.append(new Line( 20, -5, 25, 0,QPen(QPen::darkBlue,2)));
92  Lines.append(new Line( 25, 0, 40, 0,QPen(QPen::darkBlue,2)));
93 
94  // arrow
95  Lines.append(new Line( -4, -9, 0, -5,QPen(QPen::darkBlue,2)));
96  Lines.append(new Line( 4, -9, 0, -5,QPen(QPen::darkBlue,2)));
97  Lines.append(new Line( 0, -5, 0,-20,QPen(QPen::darkBlue,2)));
98 
99  Texts.append(new Text(-23, 0, QObject::tr("B"), Qt::black, 6.0, 1.0, 0.0));
100  Texts.append(new Text( 18, 0, QObject::tr("T"), Qt::black, 6.0, 1.0, 0.0));
101 
102  Ports.append(new Port(-40, 0)); // B
103  Ports.append(new Port( 0, -20)); // M
104  Ports.append(new Port( 40, 0)); // T
105 
106  x1 = -40; y1 = -20;
107  x2 = 40; y2 = 15;
108 }