Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/components/mutual2.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                                mutual2.cpp
00003                               --------------
00004     begin                : Sat Aug 20 2005
00005     copyright            : (C) 2005 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
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 
00018 #include "main.h"
00019 #include "mutual2.h"
00020 
00021 #include<QFontMetrics>
00022 
00023 
00024 Mutual2::Mutual2()
00025 {
00026   Description = QObject::tr("three mutual inductors");
00027 
00028   QFont Font(QucsSettings.font); // default application font
00029   // symbol text is smaller (10 pt default)
00030   Font.setPointSize(10); 
00031   // get the small font size; use the screen-compatible metric
00032   QFontMetrics  smallmetrics(Font, 0);
00033 
00034   int w;
00035   QString stmp;
00036 
00037   Arcs.append(new Arc(-16,-58,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00038   Arcs.append(new Arc(-16,-46,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00039   Arcs.append(new Arc(-16,-34,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00040   Arcs.append(new Arc(-16, 46,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00041   Arcs.append(new Arc(-16, 34,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00042   Arcs.append(new Arc(-16, 22,12,12, 16*270,16*180, QPen(Qt::darkBlue,2)));
00043   Arcs.append(new Arc(  4,-18,12,12,  16*90,16*180, QPen(Qt::darkBlue,2)));
00044   Arcs.append(new Arc(  4, -6,12,12,  16*90,16*180, QPen(Qt::darkBlue,2)));
00045   Arcs.append(new Arc(  4,  6,12,12,  16*90,16*180, QPen(Qt::darkBlue,2)));
00046   Lines.append(new Line(-10,-58,-10,-70,QPen(Qt::darkBlue,2)));
00047   Lines.append(new Line(-10,-70,-30,-70,QPen(Qt::darkBlue,2)));
00048   Lines.append(new Line( 10,-18, 10,-30,QPen(Qt::darkBlue,2)));
00049   Lines.append(new Line( 10,-30, 30,-30,QPen(Qt::darkBlue,2)));
00050   Lines.append(new Line(-10, 58,-10, 70,QPen(Qt::darkBlue,2)));
00051   Lines.append(new Line(-10, 70,-30, 70,QPen(Qt::darkBlue,2)));
00052   Lines.append(new Line( 10, 18, 10, 30,QPen(Qt::darkBlue,2)));
00053   Lines.append(new Line( 10, 30, 30, 30,QPen(Qt::darkBlue,2)));
00054   Lines.append(new Line(-10,-10,-30,-10,QPen(Qt::darkBlue,2)));
00055   Lines.append(new Line(-10,-22,-10,-10,QPen(Qt::darkBlue,2)));
00056   Lines.append(new Line(-10, 10,-30, 10,QPen(Qt::darkBlue,2)));
00057   Lines.append(new Line(-10, 10,-10, 22,QPen(Qt::darkBlue,2)));
00058 
00059   stmp = "1"; w = smallmetrics.width(stmp); // compute width to right-align
00060   Texts.append(new Text(-13-w,-61,stmp));
00061   stmp = "2"; w = smallmetrics.width(stmp); // compute width to right-align
00062   Texts.append(new Text(-13-w, 18,stmp));
00063   Texts.append(new Text( 13,-22,"3")); // left-aligned, no need to compute width
00064 
00065   Lines.append(new Line(  0,-57,  0, 57,QPen(Qt::darkBlue,1,Qt::DashLine)));
00066 
00067   Ports.append(new Port(-30,-70));
00068   Ports.append(new Port( 30,-30));
00069   Ports.append(new Port( 30, 30));
00070   Ports.append(new Port(-30, 70));
00071   Ports.append(new Port(-30, 10));
00072   Ports.append(new Port(-30,-10));
00073 
00074   x1 = -33; y1 = -74;
00075   x2 =  33; y2 =  74;
00076 
00077   tx = x1+4;
00078   ty = y2+4;
00079   Model = "MUT2";
00080   Name  = "Tr";
00081 
00082   Props.append(new Property("L1", "1 mH", false,
00083     QObject::tr("inductance of coil 1")));
00084   Props.append(new Property("L2", "1 mH", false,
00085     QObject::tr("inductance of coil 2")));
00086   Props.append(new Property("L3", "1 mH", false,
00087     QObject::tr("inductance of coil 3")));
00088   Props.append(new Property("k12", "0.9", false,
00089     QObject::tr("coupling factor between coil 1 and 2")));
00090   Props.append(new Property("k13", "0.9", false,
00091     QObject::tr("coupling factor between coil 1 and 3")));
00092   Props.append(new Property("k23", "0.9", false,
00093     QObject::tr("coupling factor between coil 2 and 3")));
00094 }
00095 
00096 Mutual2::~Mutual2()
00097 {
00098 }
00099 
00100 Component* Mutual2::newOne()
00101 {
00102   return new Mutual2();
00103 }
00104 
00105 Element* Mutual2::info(QString& Name, char* &BitmapFile, bool getNewOne)
00106 {
00107   Name = QObject::tr("3 Mutual Inductors");
00108   BitmapFile = (char *) "mutual2";
00109 
00110   if(getNewOne)  return new Mutual2();
00111   return 0;
00112 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines