Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/rlcg.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 rlcg.cpp
00003                                ----------
00004     begin                : Wed Apr 1 2009
00005     copyright            : (C) 2009 by Stefan Jahn
00006     email                : stefan@lkcc.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #include "main.h"
00018 #include "rlcg.h"
00019 
00020 #include <QFontMetrics>
00021 
00022 RLCG::RLCG()
00023 {
00024   Description = QObject::tr("RLCG transmission line");
00025 
00026   Lines.append(new Line(-30,  0, 30,  0,QPen(Qt::darkBlue,2)));
00027   Lines.append(new Line(-28,  7, 28,  7,QPen(Qt::darkBlue,2)));
00028 
00029   Lines.append(new Line(-28, 14,-21,  7,QPen(Qt::darkBlue,2)));
00030   Lines.append(new Line(-21, 14,-14,  7,QPen(Qt::darkBlue,2)));
00031   Lines.append(new Line(-14, 14, -7,  7,QPen(Qt::darkBlue,2)));
00032   Lines.append(new Line( -7, 14,  0,  7,QPen(Qt::darkBlue,2)));
00033   Lines.append(new Line(  0, 14,  7,  7,QPen(Qt::darkBlue,2)));
00034   Lines.append(new Line(  7, 14, 14,  7,QPen(Qt::darkBlue,2)));
00035   Lines.append(new Line( 14, 14, 21,  7,QPen(Qt::darkBlue,2)));
00036   Lines.append(new Line( 21, 14, 28,  7,QPen(Qt::darkBlue,2)));
00037 
00038   QFont Font(QucsSettings.font); // default application font
00039   // symbol text is smaller (10 pt default)
00040   Font.setPointSize(10); 
00041   // get the small font size; use the screen-compatible metric
00042   QFontMetrics  smallmetrics(Font, 0); 
00043   int fHeight = smallmetrics.lineSpacing();
00044   QString tmp = QObject::tr("RLCG");
00045   int w = smallmetrics.width(tmp);
00046   Texts.append(new Text(w/-2, -fHeight, tmp));
00047 
00048   Ports.append(new Port(-30, 0));
00049   Ports.append(new Port( 30, 0));
00050 
00051   x1 = -30; y1 = -fHeight;
00052   x2 =  30; y2 = 16;
00053 
00054   tx = x1+4;
00055   ty = y2+4;
00056   Model = "RLCG";
00057   Name  = "Line";
00058 
00059   Props.append(new Property("R", "0.0", false,
00060     QObject::tr("resistive load")+" ("+QObject::tr ("Ohm/m")+")"));
00061   Props.append(new Property("L", "0.6e-6", true,
00062     QObject::tr("inductive load")+" ("+QObject::tr ("H/m")+")"));
00063   Props.append(new Property("C", "240e-12", true,
00064     QObject::tr("capacitive load")+" ("+QObject::tr ("F/m")+")"));
00065   Props.append(new Property("G", "0.0", false,
00066     QObject::tr("conductive load")+" ("+QObject::tr ("S/m")+")"));
00067   Props.append(new Property("Length", "1 mm", true,
00068     QObject::tr("electrical length of the line")));
00069   Props.append(new Property("Temp", "26.85", false,
00070     QObject::tr("simulation temperature in degree Celsius")));
00071 }
00072 
00073 RLCG::~RLCG()
00074 {
00075 }
00076 
00077 Component* RLCG::newOne()
00078 {
00079   return new RLCG();
00080 }
00081 
00082 Element* RLCG::info(QString& Name, char* &BitmapFile, bool getNewOne)
00083 {
00084   Name = QObject::tr("RLCG Transmission Line");
00085   BitmapFile = (char *) "rlcg";
00086 
00087   if(getNewOne)  return new RLCG();
00088   return 0;
00089 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines