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

Fixed SPICE devices oddities #641

Merged
merged 2 commits into from
Mar 13, 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
18 changes: 11 additions & 7 deletions qucs/spicecomponents/BJT_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ BJT_SPICE::BJT_SPICE()
Description = QObject::tr("Q(NPN) BJT:\nMultiple line ngspice or Xyce Q model specifications allowed using \"+\" continuation lines.\nLeave continuation lines blank when NOT in use.");
Simulator = spicecompat::simSpice;

x1 = -30; y1 = -30;
x2 = 4; y2 = 30;

tx = x1+4;
ty = y2+4;

Model = "BJT_SPICE";
SpiceModel = "Q";
Name = "Q";
Expand All @@ -49,6 +43,8 @@ BJT_SPICE::BJT_SPICE()
Props.append(new Property("Model_Line 5", "", false,"+ continuation line 4"));

createSymbol();
tx = x1+4;
ty = y2+4;

}

Expand Down Expand Up @@ -97,6 +93,9 @@ void BJT_SPICE::createSymbol()
Ports.append(new Port( 0, 30));
if (Npins >= 4) Ports.append(new Port( 30, 0)); // substrate
if (Npins >= 5) Ports.append(new Port(-30, 20)); // thermal node

x1 = -30; y1 = -30;
x2 = 4; y2 = 30;
}

BJT_SPICE::~BJT_SPICE()
Expand All @@ -105,7 +104,12 @@ BJT_SPICE::~BJT_SPICE()

Component* BJT_SPICE::newOne()
{
return new BJT_SPICE();
auto p = new BJT_SPICE();
p->getProperty("Pins")->Value = getProperty("Pins")->Value;
p->getProperty("Letter")->Value = getProperty("Letter")->Value;
p->getProperty("type")->Value = getProperty("type")->Value;
p->recreate(0);
return p;
}

Element* BJT_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne)
Expand Down
16 changes: 9 additions & 7 deletions qucs/spicecomponents/C_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ C_SPICE::C_SPICE()
Description = QObject::tr("SPICE C:\nMultiple line ngspice or Xyce C specifications allowed using \"+\" continuation lines.\nLeave continuation lines blank when NOT in use.");
Simulator = spicecompat::simSpice;

x1 = -30; y1 = -13;
x2 = 30; y2 = 13;

tx = x1+4;
ty = y2+4;
Model = "C_SPICE";
SpiceModel = "C";
Name = "C";
Expand All @@ -47,6 +42,8 @@ C_SPICE::C_SPICE()
Props.append(new Property("Letter", "C", true,"[C,X,N] SPICE letter"));

createSymbol();
tx = x1+4;
ty = y2+4;

// rotate(); // fix historical flaw
}
Expand All @@ -67,7 +64,8 @@ void C_SPICE::createSymbol()
Ports.append(new Port(-30, 0));

if (Npins >= 3) Ports.append(new Port( 0, -30));

x1 = -30; y1 = -13;
x2 = 30; y2 = 13;
}


Expand All @@ -77,7 +75,11 @@ C_SPICE::~C_SPICE()

Component* C_SPICE::newOne()
{
return new C_SPICE();
auto p = new C_SPICE();
p->getProperty("Pins")->Value = getProperty("Pins")->Value;
p->getProperty("Letter")->Value = getProperty("Letter")->Value;
p->recreate(0);
return p;
}

Element* C_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne)
Expand Down
17 changes: 10 additions & 7 deletions qucs/spicecomponents/DIODE_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ DIODE_SPICE::DIODE_SPICE()
Description = QObject::tr("SPICE D:\nMultiple line ngspice or Xyce D model specifications allowed using \"+\" continuation lines.\nLeave continuation lines blank when NOT in use.");
Simulator = spicecompat::simSpice;

x1 = -30; y1 = -11;
x2 = 30; y2 = 11;

tx = x1+4;
ty = y2+4;

Model = "DIODE_SPICE";
SpiceModel = "D";
Name = "D";
Expand All @@ -48,6 +42,8 @@ DIODE_SPICE::DIODE_SPICE()
Props.append(new Property("Letter", "D", true,"[D,X,N] SPICE letter"));

createSymbol();
tx = x1+4;
ty = y2+4;
}

void DIODE_SPICE::createSymbol()
Expand All @@ -73,6 +69,9 @@ void DIODE_SPICE::createSymbol()

if (Npins >= 3) Ports.append(new Port( 0, -30));

x1 = -30; y1 = -11;
x2 = 30; y2 = 11;

}

DIODE_SPICE::~DIODE_SPICE()
Expand All @@ -81,7 +80,11 @@ DIODE_SPICE::~DIODE_SPICE()

Component* DIODE_SPICE::newOne()
{
return new DIODE_SPICE();
auto p = new DIODE_SPICE();
p->getProperty("Pins")->Value = getProperty("Pins")->Value;
p->getProperty("Letter")->Value = getProperty("Letter")->Value;
p->recreate(0);
return p;
}

Element* DIODE_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne)
Expand Down
13 changes: 9 additions & 4 deletions qucs/spicecomponents/MOS_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ MOS_SPICE::MOS_SPICE()

createSymbol();

x1 = -30; y1 = -30;
x2 = 4; y2 = 30;

tx = x1+4;
ty = y2+4;

Expand All @@ -60,7 +57,12 @@ MOS_SPICE::~MOS_SPICE()

Component* MOS_SPICE::newOne()
{
return new MOS_SPICE();
auto p = new MOS_SPICE();
p->getProperty("Pins")->Value = getProperty("Pins")->Value;
p->getProperty("Letter")->Value = getProperty("Letter")->Value;
p->getProperty("type")->Value = getProperty("type")->Value;
p->recreate(0);
return p;
}

Element* MOS_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne)
Expand Down Expand Up @@ -219,6 +221,9 @@ void MOS_SPICE::createSymbol()
Lines.append(new qucs::Line( -1, 0, -6, -5,QPen(Qt::darkRed,2)));
Lines.append(new qucs::Line( -1, 0, -6, 5,QPen(Qt::darkRed,2)));
}

x1 = -30; y1 = -30;
x2 = 4; y2 = 30;
}

QString MOS_SPICE::spice_netlist(bool)
Expand Down
18 changes: 11 additions & 7 deletions qucs/spicecomponents/R_SPICE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ R_SPICE::R_SPICE()
Description = QObject::tr("SPICE R:\nMultiple line ngspice or Xyce R specifications allowed using \"+\" continuation lines.\nLeave continuation lines blank when NOT in use. ");
Simulator = spicecompat::simSpice;

x1 = -30; y1 = -11;
x2 = 30; y2 = 11;

tx = x1+4;
ty = y2+4;

Model = "R_SPICE";
SpiceModel = "R";
Name = "R";
Expand All @@ -48,6 +42,9 @@ R_SPICE::R_SPICE()

createSymbol();

tx = x1+4;
ty = y2+4;

// rotate(); // fix historical flaw

}
Expand All @@ -71,6 +68,9 @@ void R_SPICE::createSymbol()

if (Npins >= 3) Ports.append(new Port( 0, -30));

x1 = -30; y1 = -11;
x2 = 30; y2 = 11;

}

R_SPICE::~R_SPICE()
Expand All @@ -79,7 +79,11 @@ R_SPICE::~R_SPICE()

Component* R_SPICE::newOne()
{
return new R_SPICE();
auto p = new R_SPICE();
p->getProperty("Pins")->Value = getProperty("Pins")->Value;
p->getProperty("Letter")->Value = getProperty("Letter")->Value;
p->recreate(0);
return p;
}

Element* R_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne)
Expand Down
2 changes: 1 addition & 1 deletion qucs/spicecomponents/R_SPICE.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "components/component.h"

class R_SPICE : public Component {
class R_SPICE : public MultiViewComponent {
public:
R_SPICE();
~R_SPICE();
Expand Down
Loading