Skip to content

Commit

Permalink
Merge pull request #1218 from ra3xdh/1217_fix
Browse files Browse the repository at this point in the history
Add offset and Td parameters for AC current source
  • Loading branch information
ra3xdh authored Jan 23, 2025
2 parents c98551d + e2f63ad commit 2147756
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions qucs/components/ampere_ac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ Ampere_ac::Ampere_ac()

Props.append(new Property("I", "1 mA", true,
QObject::tr("peak current in Ampere")));
Props.append(new Property("f", "1 GHz", false,
Props.append(new Property("f", "1 kHz", false,
QObject::tr("frequency in Hertz")));
Props.append(new Property("Phase", "0", false,
QObject::tr("initial phase in degrees")));
Props.append(new Property("Theta", "0", false,
QObject::tr("damping factor (transient simulation only)")));
Props.append(new Property("IO", "0", false,
QObject::tr("offset current (SPICE only)")));
Props.append(new Property("TD", "0", false,
QObject::tr("delay time (SPICE only)")));

rotate(); // fix historical flaw
}
Expand Down Expand Up @@ -91,13 +95,18 @@ QString Ampere_ac::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecom
QString amperes = spicecompat::normalize_value(Props.at(0)->Value);
QString freq = spicecompat::normalize_value(Props.at(1)->Value);

QString IO = spicecompat::normalize_value(getProperty("IO")->Value);
QString TD = spicecompat::normalize_value(getProperty("TD")->Value);

QString phase = Props.at(2)->Value;
phase.remove(' ');
if (phase.isEmpty()) phase = "0";

QString theta = Props.at(3)->Value;
theta.remove(' ');
if (theta.isEmpty()) theta="0";
s += QStringLiteral(" DC 0 SIN(0 %1 %2 0 %3 %4) AC %5 ACPHASE %6\n").arg(amperes).arg(freq).arg(theta).arg(phase).arg(amperes).arg(phase);
s += QStringLiteral(" DC %7 SIN(%7 %1 %2 %8 %3 %4) AC %5 ACPHASE %6\n")
.arg(amperes).arg(freq).arg(theta).arg(phase).arg(amperes).arg(phase)
.arg(IO).arg(TD);
return s;
}

0 comments on commit 2147756

Please sign in to comment.