Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/ecvs.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                 ecvs.cpp
00003                                -----------
00004     copyright            : (C) 2013 by Richard Crozier
00005     email                : richard dot crozier at yahoo dot co dot uk
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #include "ecvs.h"
00017 #include "schematic.h"
00018 
00019 ecvs::ecvs()
00020 {
00021   Description = QObject::tr("externally controlled voltage source");
00022 
00023 
00024 //  Arcs.append(new Arc( -3, -7,  7,  7,16*270, 16*180,QPen(Qt::darkBlue,2)));
00025 //  Arcs.append(new Arc( -3,  0,  7,  7, 16*90, 16*180,QPen(Qt::darkBlue,2)));
00026 
00027   // Circle in middle
00028   Arcs.append(new Arc(-12,-12, 24, 24,     0, 16*360,QPen(Qt::darkBlue,2)));
00029   // The 'E' symbol in middle of circle
00030   // horizontal lines (actually drawn vertically here)
00031   Lines.append(new Line(4, -3, 4, 3,QPen(Qt::darkGreen,2)));
00032   Lines.append(new Line(0, -3, 0, 2,QPen(Qt::darkGreen,2)));
00033   Lines.append(new Line(-4, -3, -4, 3,QPen(Qt::darkGreen,2)));
00034   // Vertical Line
00035   Lines.append(new Line(4, -3, -4, -3,QPen(Qt::darkGreen,2)));
00036 
00037   // Wires at top and bottom
00038   Lines.append(new Line(-30,  0,-12,  0,QPen(Qt::darkBlue,2)));
00039   Lines.append(new Line( 30,  0, 12,  0,QPen(Qt::darkBlue,2)));
00040   // positive symbol
00041   Lines.append(new Line( 18,  5, 18, 11,QPen(Qt::red,1)));
00042   Lines.append(new Line( 21,  8, 15,  8,QPen(Qt::red,1)));
00043   // negative symbol
00044   Lines.append(new Line(-18,  5,-18, 11,QPen(Qt::black,1)));
00045 
00046 //  Lines.append(new Line( -6,-17, -6,-21,QPen(Qt::darkBlue,1)));
00047 //  Lines.append(new Line( -8,-17, -8,-21,QPen(Qt::darkBlue,1)));
00048 //  Lines.append(new Line(-10,-17,-10,-21,QPen(Qt::darkBlue,1)));
00049 //  Lines.append(new Line( -3,-15, -3,-23,QPen(Qt::darkBlue,2)));
00050 //  Lines.append(new Line(-13,-15,-13,-23,QPen(Qt::darkBlue,2)));
00051 //  Lines.append(new Line( -3,-23,-13,-23,QPen(Qt::darkBlue,2)));
00052 //  Lines.append(new Line( -3,-15,-13,-15,QPen(Qt::darkBlue,2)));
00053 
00054   Ports.append(new Port( 30,  0));
00055   Ports.append(new Port(-30,  0));
00056 
00057   x1 = -30; y1 = -14;
00058   x2 =  30; y2 =  14;
00059 
00060   tx = x1+4;
00061   ty = y2+4;
00062   Model = "ECVS";
00063   Name  = "ECVS";
00064 
00065   Props.append(new Property("U", "0 V", true,
00066     QObject::tr("voltage in Volts")));
00067 //  Props.append(new Property("Interpolator", "linear", false,
00068 //    QObject::tr("interpolation type")+" [hold, linear, cubic]"));
00069 
00070   rotate();  // fix historical flaw
00071 }
00072 
00073 ecvs::~ecvs()
00074 {
00075 }
00076 
00077 Component* ecvs::newOne()
00078 {
00079   return new ecvs();
00080 }
00081 
00082 Element* ecvs::info(QString& Name, char* &BitmapFile, bool getNewOne)
00083 {
00084   Name = QObject::tr("Externally Controlled Voltage Source");
00085   BitmapFile = (char *) "ecvs";
00086 
00087   if(getNewOne)  return new ecvs();
00088   return 0;
00089 }
00090 
00091 
00092 // -------------------------------------------------------
00093 QString ecvs::netlist()
00094 {
00095   QString s = Model+":"+Name;
00096 
00097   // output all node names
00098   foreach(Port *p1, Ports)
00099     s += " "+p1->Connection->Name;   // node names
00100 
00101   // output all properties
00102   for(Property *p2 = Props.first(); p2 != 0; p2 = Props.next())
00103     s += " "+p2->Name+"=\""+p2->Value+"\"";
00104 
00105   return s + "\n";
00106 }
00107 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines