Skip to content

Commit

Permalink
Merge pull request #825 from ra3xdh/819_fix
Browse files Browse the repository at this point in the history
Allow variables in Vrect parameters
  • Loading branch information
ra3xdh committed Jul 8, 2024
2 parents 002352b + bbf3994 commit 8e5b2c4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions qucs/components/vrect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,18 @@ QString vRect::spice_netlist(bool)
QString nam = p1->Connection->Name;
if (nam=="gnd") nam = "0";
s += " "+ nam; // node names
}

double T, TL, TH, Trval, Tfval, fac;
QString unit;
}

QString U = spicecompat::normalize_value(Props.at(0)->Value); //VH
QString Td = spicecompat::normalize_value(Props.at(5)->Value); // Td
QString Tr = spicecompat::normalize_value(Props.at(3)->Value); // Tr
QString Tf = spicecompat::normalize_value(Props.at(4)->Value); //Tf
QString U0 = spicecompat::normalize_value(getProperty("U0")->Value); //VL
misc::str2num(Props.at(1)->Value,TH,unit,fac); //TH
TH *= fac; // TH = pw
misc::str2num(Props.at(2)->Value,TL,unit,fac);
T = TL*fac+TH;
misc::str2num(Props.at(3)->Value,Trval,unit,fac);
T = Trval*fac+T;
misc::str2num(Props.at(4)->Value,Tfval,unit,fac);
T = Tfval*fac+T;

s += QString(" DC 0 PULSE( %1 %2 %3 %4 %5 %6 %7 ) AC 0\n").arg(U0).arg(U).arg(Td).arg(Tr).arg(Tf).arg(TH).arg(T);
QString TH = spicecompat::normalize_value(getProperty("TH")->Value);
QString TL = spicecompat::normalize_value(getProperty("TL")->Value);

s += QString(" DC 0 PULSE( %1 %2 %3 %4 %5 %6 {(%7)+(%8)+(%9)+(%10)} ) AC 0\n")
.arg(U0).arg(U).arg(Td).arg(Tr).arg(Tf).arg(TH).arg(TH).arg(TL).arg(Tr).arg(Tf);

return s;
}
Expand Down

0 comments on commit 8e5b2c4

Please sign in to comment.