From cd309a99ea32fe399e50cf2e563fbd8f359e4a87 Mon Sep 17 00:00:00 2001 From: Vadim Kuznetsov Date: Sat, 24 Feb 2024 09:27:26 +0300 Subject: [PATCH 1/3] Add spiral and loop inductors --- qucs/components/CMakeLists.txt | 4 ++ qucs/components/circularloop.cpp | 77 ++++++++++++++++++++++++++ qucs/components/circularloop.h | 38 +++++++++++++ qucs/components/spiralinductor.cpp | 88 ++++++++++++++++++++++++++++++ qucs/components/spiralinductor.h | 38 +++++++++++++ 5 files changed, 245 insertions(+) create mode 100644 qucs/components/circularloop.cpp create mode 100644 qucs/components/circularloop.h create mode 100644 qucs/components/spiralinductor.cpp create mode 100644 qucs/components/spiralinductor.h diff --git a/qucs/components/CMakeLists.txt b/qucs/components/CMakeLists.txt index 020c0bdb0..2c0967ae5 100644 --- a/qucs/components/CMakeLists.txt +++ b/qucs/components/CMakeLists.txt @@ -59,6 +59,8 @@ indq.cpp capq.cpp circline.cpp taperedline.cpp +circularloop.cpp +spiralinductor.cpp ) SET(COMPONENTS_HDRS @@ -227,6 +229,8 @@ volt_noise.h vprobe.h vpulse.h vrect.h +circularloop.h +spiralinductor.h ) diff --git a/qucs/components/circularloop.cpp b/qucs/components/circularloop.cpp new file mode 100644 index 000000000..20db62e0b --- /dev/null +++ b/qucs/components/circularloop.cpp @@ -0,0 +1,77 @@ +/* +* circularloop.cpp - Circular loop inductor class implementation +* +* copyright (C) 2016 Andres Martinez-Mera +* +* This is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this package; see the file COPYING. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +* Boston, MA 02110-1301, USA. +* +* +*/ + +#include "extsimkernels/spicecompat.h" +#include "circularloop.h" + + +circularloop::circularloop() +{ + Description = QObject::tr("Printed loop inductor"); + + //Loop + Arcs.append(new qucs::Arc(-18, -25, 35, 35, -370, 16*230,QPen(Qt::darkBlue,3))); + + Lines.append(new qucs::Line(-30, 0, -16, 0,QPen(Qt::darkBlue,4))); + Lines.append(new qucs::Line( 16, 0, 30, 0,QPen(Qt::darkBlue,4))); + + Ports.append(new Port(-30, 0)); + Ports.append(new Port( 30, 0)); + + x1 = -30; y1 =-30; + x2 = 30; y2 = 5; + + tx = x1; + ty = y1+40; + Model = "CIRCULARLOOP"; + Name = "CIRCULARLOOP"; + Simulator = spicecompat::simQucsator; + + Props.append(new Property("Subst", "Subst1", true, + QObject::tr("Substrate"))); + Props.append(new Property("W", "25 um", false, + QObject::tr("Width of line"))); + Props.append(new Property("a", "500 um", false, + QObject::tr("Radius"))); + Props.append(new Property("Temp", "26.85", false, + QObject::tr("simulation temperature in degree Celsius"))); + +} + +circularloop::~circularloop() +{ +} + +Component* circularloop::newOne() +{ + return new circularloop(); +} + +Element* circularloop::info(QString& Name, char* &BitmapFile, bool getNewOne) +{ + Name = QObject::tr("Circular loop"); + BitmapFile = (char *) "circularloop"; + + if(getNewOne) return new circularloop(); + return 0; +} diff --git a/qucs/components/circularloop.h b/qucs/components/circularloop.h new file mode 100644 index 000000000..f339aac91 --- /dev/null +++ b/qucs/components/circularloop.h @@ -0,0 +1,38 @@ +/* +* circularloop.cpp - Circular loop inductor class definition +* +* copyright (C) 2016 Andres Martinez-Mera +* +* This is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this package; see the file COPYING. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +* Boston, MA 02110-1301, USA. +* +* +*/ + +#ifndef CIRCULARLOOP_H +#define CIRCULARLOOP_H + +#include "component.h" + + +class circularloop : public Component { +public: + circularloop(); + ~circularloop(); + Component* newOne(); + static Element* info(QString&, char* &, bool getNewOne=false); +}; + +#endif diff --git a/qucs/components/spiralinductor.cpp b/qucs/components/spiralinductor.cpp new file mode 100644 index 000000000..1ca0bfe07 --- /dev/null +++ b/qucs/components/spiralinductor.cpp @@ -0,0 +1,88 @@ +/* +* spiralinductor.cpp - Planar spiral inductor class implementation +* +* copyright (C) 2016 Andres Martinez-Mera +* +* This is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this package; see the file COPYING. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +* Boston, MA 02110-1301, USA. +* +* +*/ + +#include "extsimkernels/spicecompat.h" +#include "spiralinductor.h" + + +spiralinductor::spiralinductor() +{ + Description = QObject::tr("Planar spiral inductor"); + + //Spiral + Arcs.append(new qucs::Arc(-5, 0, 10, 10, -16*90, 16*180,QPen(Qt::darkBlue,3))); + Arcs.append(new qucs::Arc(-10, -10, 20, 20, 16*90, 16*180,QPen(Qt::darkBlue,3))); + Arcs.append(new qucs::Arc(-15, -10, 30, 30, -16*90, 16*180,QPen(Qt::darkBlue,3))); + Arcs.append(new qucs::Arc(-20, -20, 40, 40, 16*90, 16*180,QPen(Qt::darkBlue,3))); + Arcs.append(new qucs::Arc(-20, -20, 40, 40, 0, 16*90,QPen(Qt::darkBlue,3))); + + Lines.append(new qucs::Line(-30, 0, 0, 0,QPen(Qt::black,4))); + Lines.append(new qucs::Line( 20, 0, 30, 0,QPen(Qt::darkBlue,2))); + + Ports.append(new Port(-30, 0)); + Ports.append(new Port( 30, 0)); + + x1 = -30; y1 =-25; + x2 = 30; y2 = 25; + + tx = x1; + ty = y1+50; + Model = "SPIRALIND"; + Name = "SPIRALIND"; + Simulator = spicecompat::simQucsator; + + Props.append(new Property("Subst", "Subst1", true, + QObject::tr("Substrate"))); + Props.append(new Property("Geometry", "Circular", true, + QObject::tr("Spiral type")+ ++ "[Circular, Square, Hexagonal, Octogonal]")); + Props.append(new Property("W", "25 um", false, + QObject::tr("Width of line"))); + Props.append(new Property("Di", "200 um", false, + QObject::tr("Inner diameter"))); + Props.append(new Property("S", "25 um", false, + QObject::tr("Spacing between turns"))); + Props.append(new Property("N", "3", false, + QObject::tr("Number of turns"))); + Props.append(new Property("Temp", "26.85", false, + QObject::tr("simulation temperature in degree Celsius"))); + +} + +spiralinductor::~spiralinductor() +{ +} + +Component* spiralinductor::newOne() +{ + return new spiralinductor(); +} + +Element* spiralinductor::info(QString& Name, char* &BitmapFile, bool getNewOne) +{ + Name = QObject::tr("Spiral inductor"); + BitmapFile = (char *) "spiralinductor"; + + if(getNewOne) return new spiralinductor(); + return 0; +} diff --git a/qucs/components/spiralinductor.h b/qucs/components/spiralinductor.h new file mode 100644 index 000000000..cf1d02b8a --- /dev/null +++ b/qucs/components/spiralinductor.h @@ -0,0 +1,38 @@ +/* +* spiralinductor.h - Planar spiral inductor class definition +* +* copyright (C) 2016 Andres Martinez-Mera +* +* This is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2, or (at your option) +* any later version. +* +* This software is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this package; see the file COPYING. If not, write to +* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +* Boston, MA 02110-1301, USA. +* +* +*/ + +#ifndef SPIRALINDUCTOR_H +#define SPIRALINDUCTOR_H + +#include "component.h" + + +class spiralinductor : public Component { +public: + spiralinductor(); + ~spiralinductor(); + Component* newOne(); + static Element* info(QString&, char* &, bool getNewOne=false); +}; + +#endif From 953d28fce22ac049d47b5dbb3cfe20adf6ad0c2e Mon Sep 17 00:00:00 2001 From: Vadim Kuznetsov Date: Sat, 24 Feb 2024 11:07:46 +0300 Subject: [PATCH 2/3] Add RF device s group --- qucs/components/components.h | 2 ++ qucs/module.cpp | 34 ++++++++++++++++++---------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/qucs/components/components.h b/qucs/components/components.h index a5ea9a9a8..32b0956d5 100644 --- a/qucs/components/components.h +++ b/qucs/components/components.h @@ -184,6 +184,8 @@ #include "comp_2bit.h" #include "comp_4bit.h" #include "hpribin4bit.h" +#include "circularloop.h" +#include "spiralinductor.h" // external simulation components #include "etr_sim.h" diff --git a/qucs/module.cpp b/qucs/module.cpp index 7d7698d0c..da61d87c1 100644 --- a/qucs/module.cpp +++ b/qucs/module.cpp @@ -198,6 +198,8 @@ registerComponent (cat, &val::inf1) REGISTER_COMP_1 (QObject::tr("sources"),val) #define REGISTER_PROBE_1(val) \ REGISTER_COMP_1 (QObject::tr("probes"),val) +#define REGISTER_RF_COMP_1(val) \ + REGISTER_COMP_1 (QObject::tr("RF components"),val) #define REGISTER_TRANS_1(val) \ REGISTER_COMP_1 (QObject::tr("transmission lines"),val) #define REGISTER_NONLINEAR_1(val) \ @@ -277,20 +279,9 @@ void Module::registerModules (void) { REGISTER_LUMPED_1 (symTrafo); REGISTER_LUMPED_1 (Ground); REGISTER_LUMPED_1 (SubCirPort); - REGISTER_LUMPED_1 (dcBlock); - REGISTER_LUMPED_1 (dcFeed); - REGISTER_LUMPED_1 (BiasT); - REGISTER_LUMPED_1 (Attenuator); - REGISTER_LUMPED_1 (Amplifier); - REGISTER_LUMPED_1 (Isolator); - REGISTER_LUMPED_1 (Circulator); REGISTER_LUMPED_1 (Gyrator); - REGISTER_LUMPED_1 (Phaseshifter); - REGISTER_LUMPED_1 (Coupler); - REGISTER_LUMPED_1 (Hybrid); //} - REGISTER_LUMPED_1 (iProbe); REGISTER_LUMPED_1 (vProbe); @@ -303,11 +294,6 @@ void Module::registerModules (void) { REGISTER_LUMPED_1 (Relais); - //if (QucsSettings.DefaultSimulator == spicecompat::simQucsator) { - REGISTER_LUMPED_1 (RFedd); - REGISTER_LUMPED_1 (RFedd2P); - //} - // sources REGISTER_SOURCE_1 (Volt_dc); REGISTER_SOURCE_1 (Ampere_dc); @@ -362,6 +348,22 @@ void Module::registerModules (void) { REGISTER_PROBE_1 (iProbe); REGISTER_PROBE_1 (vProbe); + // RF devices except transmission line + REGISTER_RF_COMP_1 (dcBlock); + REGISTER_RF_COMP_1 (dcFeed); + REGISTER_RF_COMP_1 (circularloop); + REGISTER_RF_COMP_1 (spiralinductor); + REGISTER_RF_COMP_1 (BiasT); + REGISTER_RF_COMP_1 (Attenuator); + REGISTER_RF_COMP_1 (Amplifier); + REGISTER_RF_COMP_1 (Isolator); + REGISTER_RF_COMP_1 (Circulator); + REGISTER_RF_COMP_1 (Phaseshifter); + REGISTER_RF_COMP_1 (Coupler); + REGISTER_RF_COMP_1 (Hybrid); + REGISTER_RF_COMP_1 (RFedd); + REGISTER_RF_COMP_1 (RFedd2P); + // transmission lines //if (QucsSettings.DefaultSimulator == spicecompat::simQucsator) { REGISTER_TRANS_1 (TLine); From d1d1604e5c449be4a0a37b5d37d15d488c99a890 Mon Sep 17 00:00:00 2001 From: Vadim Kuznetsov Date: Sat, 24 Feb 2024 11:19:03 +0300 Subject: [PATCH 3/3] Apply patch for LTL from @dwarning --- qucs/spicecomponents/LTL_SPICE.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qucs/spicecomponents/LTL_SPICE.cpp b/qucs/spicecomponents/LTL_SPICE.cpp index 86873adfb..85a646bd2 100644 --- a/qucs/spicecomponents/LTL_SPICE.cpp +++ b/qucs/spicecomponents/LTL_SPICE.cpp @@ -109,6 +109,18 @@ QString LTL_SPICE::spice_netlist(bool) - s += QString(" Z0=%1 Td=%2 F=%3 NL=%4 IC=%5, %6, %7, %8 \n").arg(Z0).arg(Td).arg(Freq).arg(Nl).arg(V1).arg(I1).arg(V2).arg(I2); + if( Z0.trimmed().length() > 0) { + s += QString(" Z0=%1").arg(Z0); + } + if( Td.trimmed().length() > 0 ) { + s += QString(" Td=%1").arg(Td); + } + if( Freq.trimmed().length() > 0 ) { + s += QString(" F=%1").arg(Freq); + } + if( Nl.trimmed().length() > 0 ) { + s += QString(" NL=%1").arg(Nl); + } + s += QString(" IC=%5, %6, %7, %8 \n").arg(V1).arg(I1).arg(V2).arg(I2); return s; }