Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loop and spiral inductors #610

Merged
merged 3 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions qucs/components/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ indq.cpp
capq.cpp
circline.cpp
taperedline.cpp
circularloop.cpp
spiralinductor.cpp
)

SET(COMPONENTS_HDRS
Expand Down Expand Up @@ -227,6 +229,8 @@ volt_noise.h
vprobe.h
vpulse.h
vrect.h
circularloop.h
spiralinductor.h
)


Expand Down
77 changes: 77 additions & 0 deletions qucs/components/circularloop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* circularloop.cpp - Circular loop inductor class implementation
*
* copyright (C) 2016 Andres Martinez-Mera <andresmartinezmera@gmail.com>
*
* 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;
}
38 changes: 38 additions & 0 deletions qucs/components/circularloop.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* circularloop.cpp - Circular loop inductor class definition
*
* copyright (C) 2016 Andres Martinez-Mera <andresmartinezmera@gmail.com>
*
* 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
2 changes: 2 additions & 0 deletions qucs/components/components.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
88 changes: 88 additions & 0 deletions qucs/components/spiralinductor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* spiralinductor.cpp - Planar spiral inductor class implementation
*
* copyright (C) 2016 Andres Martinez-Mera <andresmartinezmera@gmail.com>
*
* 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;
}
38 changes: 38 additions & 0 deletions qucs/components/spiralinductor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* spiralinductor.h - Planar spiral inductor class definition
*
* copyright (C) 2016 Andres Martinez-Mera <andresmartinezmera@gmail.com>
*
* 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
34 changes: 18 additions & 16 deletions qucs/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 13 additions & 1 deletion qucs/spicecomponents/LTL_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}