Skip to content

Commit

Permalink
Merge pull request #1059 from ra3xdh/fix_ipulse
Browse files Browse the repository at this point in the history
Fix pulsed current source issues
  • Loading branch information
ra3xdh authored Nov 12, 2024
2 parents 6e88b27 + ebb035c commit d6f9010
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 45 deletions.
8 changes: 3 additions & 5 deletions qucs/components/iexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,9 @@ Element* iExp::info(QString& Name, char* &BitmapFile, bool getNewOne)
QString iExp::spice_netlist(bool)
{
QString s = spicecompat::check_refdes(Name,SpiceModel);
for (Port *p1 : Ports) {
QString nam = p1->Connection->Name;
if (nam=="gnd") nam = "0";
s += " "+ nam; // node names
}

s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name);
s += " " + spicecompat::normalize_node_name(Ports.at(0)->Connection->Name);

QString U1= spicecompat::normalize_value(Props.at(0)->Value);
QString U2 = spicecompat::normalize_value(Props.at(1)->Value);
Expand Down
7 changes: 2 additions & 5 deletions qucs/components/ipulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ QString iPulse::spice_netlist(bool)
{
QString s = spicecompat::check_refdes(Name,SpiceModel);

for (Port *p1 : Ports) {
QString nam = p1->Connection->Name;
if (nam=="gnd") nam = "0";
s += " "+ nam; // node names
}
s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name);
s += " " + spicecompat::normalize_node_name(Ports.at(0)->Connection->Name);

double T1,T2, TrVal, TfVal, Pw,fac,Per;
QString unit;
Expand Down
2 changes: 1 addition & 1 deletion qucs/components/irect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ iRect::iRect()
Name = "I";
SpiceModel = "I";

Props.append(new Property("U", "1 mA", true,
Props.append(new Property("I", "1 mA", true,
QObject::tr("current at high pulse")));
Props.append(new Property("TH", "1 ms", true,
QObject::tr("duration of high pulses")));
Expand Down
66 changes: 32 additions & 34 deletions qucs/spicecomponents/iPWL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,38 +92,36 @@ QString iPWL::netlist()

QString iPWL::spice_netlist(bool)
{
QString s = spicecompat::check_refdes(Name,SpiceModel);
for (Port *p1 : Ports) {
QString nam = p1->Connection->Name;
if (nam=="gnd") nam = "0";
s += " "+ nam+" "; // node names
}


QString PWL= Props.at(0)->Value;
QString Line_2= Props.at(1)->Value;
QString Line_3= Props.at(2)->Value;
QString Line_4= Props.at(3)->Value;
QString Line_5= Props.at(4)->Value;
QString Line_6= Props.at(5)->Value;
QString Line_7= Props.at(6)->Value;
QString Line_8= Props.at(7)->Value;
QString Line_9= Props.at(8)->Value;
QString Line_10= Props.at(9)->Value;

s += QString();

if( PWL.length() > 0) s += QStringLiteral("%1").arg(PWL);
if( Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_2);
if( Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_3);
if( Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_4);
if( Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_5);
if( Line_6.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_6);
if( Line_7.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_7);
if( Line_8.length() > 0) s += QStringLiteral("\n%1").arg(Line_8);
if( Line_9.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_9);
if( Line_10.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_10);
s += "\n";

return s;
QString s = spicecompat::check_refdes(Name,SpiceModel);

s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name);
s += " " + spicecompat::normalize_node_name(Ports.at(0)->Connection->Name);


QString PWL= Props.at(0)->Value;
QString Line_2= Props.at(1)->Value;
QString Line_3= Props.at(2)->Value;
QString Line_4= Props.at(3)->Value;
QString Line_5= Props.at(4)->Value;
QString Line_6= Props.at(5)->Value;
QString Line_7= Props.at(6)->Value;
QString Line_8= Props.at(7)->Value;
QString Line_9= Props.at(8)->Value;
QString Line_10= Props.at(9)->Value;

s += " ";

if( PWL.length() > 0) s += QStringLiteral("%1").arg(PWL);
if( Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_2);
if( Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_3);
if( Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_4);
if( Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_5);
if( Line_6.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_6);
if( Line_7.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_7);
if( Line_8.length() > 0) s += QStringLiteral("\n%1").arg(Line_8);
if( Line_9.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_9);
if( Line_10.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_10);
s += "\n";

return s;
}

0 comments on commit d6f9010

Please sign in to comment.