Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/potentiometer.cpp
Go to the documentation of this file.
00001 /*
00002  * potentiometer.cpp - device implementations for potentiometer module
00003  *
00004  * This is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2, or (at your option)
00007  * any later version.
00008  * 
00009  */
00010 
00011 #include "potentiometer.h"
00012 
00013 potentiometer::potentiometer()
00014 {
00015   Description = QObject::tr ("Potentiometer verilog device");
00016 
00017   Props.append (new Property ("R_pot", "1e4", false,
00018     QObject::tr ("nominal device resistance")
00019     +" ("+QObject::tr ("Ohm")+")"));
00020   Props.append (new Property ("Rotation", "120", false,
00021     QObject::tr ("shaft/wiper arm rotation")
00022     +" ("+QObject::tr ("degrees")+")"));
00023   Props.append (new Property ("Taper_Coeff", "0", false,
00024     QObject::tr ("resistive law taper coefficient")));
00025   Props.append (new Property ("LEVEL", "1", false,
00026     QObject::tr ("device type selector")+" [1, 2, 3]"));
00027   Props.append (new Property ("Max_Rotation", "240.0", false,
00028     QObject::tr ("maximum shaft/wiper rotation")
00029     +" ("+QObject::tr ("degrees")+")"));
00030   Props.append (new Property ("Conformity", "0.2", false,
00031     QObject::tr ("conformity error")
00032     +" ("+QObject::tr ("%")+")"));
00033   Props.append (new Property ("Linearity", "0.2", false,
00034     QObject::tr ("linearity error")
00035     +" ("+QObject::tr ("%")+")"));
00036   Props.append (new Property ("Contact_Res", "1", false,
00037     QObject::tr ("wiper arm contact resistance")
00038     +" ("+QObject::tr ("Ohm")+")"));
00039   Props.append (new Property ("Temp_Coeff", "100", false,
00040     QObject::tr ("resistance temperature coefficient")
00041     +" ("+QObject::tr ("PPM/Celsius")+")"));
00042   Props.append (new Property ("Tnom", "26.85", false,
00043     QObject::tr ("parameter measurement temperature")
00044     +" ("+QObject::tr ("Celsius")+")"));
00045   Props.append (new Property ("Temp", "26.85", false,
00046     QObject::tr ("simulation temperature")));
00047 
00048   createSymbol ();
00049   tx = x1 + 8;
00050   ty = y2 + 4;
00051   Model = "potentiometer";
00052   Name  = "POT";
00053 }
00054 
00055 Component * potentiometer::newOne()
00056 {
00057   potentiometer * p = new potentiometer();
00058   p->Props.getFirst()->Value = Props.getFirst()->Value; 
00059   p->recreate(0); 
00060   return p;
00061 }
00062 
00063 Element * potentiometer::info(QString& Name, char * &BitmapFile, bool getNewOne)
00064 {
00065   Name = QObject::tr("Potentiometer");
00066   BitmapFile = (char *) "potentiometer";
00067 
00068   if(getNewOne) return new potentiometer();
00069   return 0;
00070 }
00071 
00072 void potentiometer::createSymbol()
00073 {
00074   // frame
00075   Lines.append(new Line(-30,-13,-30, 10,QPen(Qt::darkBlue,2)));
00076   Lines.append(new Line(-30, 10, 30, 10,QPen(Qt::darkBlue,2)));
00077   Lines.append(new Line( 30, 10, 30,-13,QPen(Qt::darkBlue,2)));
00078   Lines.append(new Line( 30,-13,-30,-13,QPen(Qt::darkBlue,2)));
00079 
00080   // resistor
00081   Lines.append(new Line(-40,  0, -25, 0,QPen(Qt::darkBlue,2)));
00082   Lines.append(new Line(-25,  0, -20,-5,QPen(Qt::darkBlue,2)));
00083   Lines.append(new Line(-20, -5, -15, 0,QPen(Qt::darkBlue,2)));
00084   Lines.append(new Line(-15,  0, -10,-5,QPen(Qt::darkBlue,2)));
00085   Lines.append(new Line(-10, -5, -5,  0,QPen(Qt::darkBlue,2)));
00086   Lines.append(new Line( -5,  0,  0, -5,QPen(Qt::darkBlue,2)));
00087   Lines.append(new Line(  0, -5,  5,  0,QPen(Qt::darkBlue,2)));
00088   Lines.append(new Line(  5,  0, 10, -5,QPen(Qt::darkBlue,2)));
00089   Lines.append(new Line( 10, -5, 15,  0,QPen(Qt::darkBlue,2)));
00090   Lines.append(new Line( 15,  0, 20, -5,QPen(Qt::darkBlue,2)));
00091   Lines.append(new Line( 20, -5, 25,  0,QPen(Qt::darkBlue,2)));
00092   Lines.append(new Line( 25,  0, 40,  0,QPen(Qt::darkBlue,2)));
00093 
00094   // arrow
00095   Lines.append(new Line( -4, -9,  0, -5,QPen(Qt::darkBlue,2)));
00096   Lines.append(new Line(  4, -9,  0, -5,QPen(Qt::darkBlue,2)));
00097   Lines.append(new Line(  0, -5,  0,-20,QPen(Qt::darkBlue,2)));
00098 
00099   Texts.append(new Text(-23,   0, QObject::tr("B"), Qt::black, 6.0, 1.0, 0.0));
00100   Texts.append(new Text( 18,   0, QObject::tr("T"), Qt::black, 6.0, 1.0, 0.0));
00101 
00102   Ports.append(new Port(-40,   0)); // B
00103   Ports.append(new Port(  0, -20)); // M
00104   Ports.append(new Port( 40,   0)); // T
00105 
00106   x1 = -40; y1 = -20;
00107   x2 =  40; y2 =  15;
00108 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines