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

Enable variables for blue nonlinear devices #838

Merged
merged 4 commits into from
Jul 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
4 changes: 1 addition & 3 deletions qucs/components/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,7 @@ QString Component::form_spice_param_list(QStringList &ignore_list, QStringList &
} else {
nam = Props.at(i)->Name;
}
double val, fac;
misc::str2num(Props.at(i)->Value, val, unit, fac);
val *= fac;
QString val = spicecompat::normalize_value(Props.at(i)->Value);
par_str += QString("%1=%2 ").arg(nam).arg(val);
}

Expand Down
2 changes: 1 addition & 1 deletion qucs/components/equation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Component* Equation::newOne()

Element* Equation::info(QString& Name, char* &BitmapFile, bool getNewOne)
{
Name = QObject::tr("Qucs legacy equation");
Name = QObject::tr("Qucsator equation");
BitmapFile = (char *) "equation";

if(getNewOne) return new Equation();
Expand Down
53 changes: 5 additions & 48 deletions qucs/components/param_sweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ Param_Sweep::Param_Sweep()
QObject::tr("stop value for sweep")));
Props.append(new Property("Points", "20", true,
QObject::tr("number of simulation steps")));
Props.append(new Property("SweepModel","false",false,
"[true,false]"));
}

Param_Sweep::~Param_Sweep()
Expand Down Expand Up @@ -147,26 +145,8 @@ QString Param_Sweep::getNgspiceBeforeSim(QString sim, int lvl)
for(constListIterator=parameter_list.begin(); constListIterator!=parameter_list.end();++constListIterator)
{
QString par = *constListIterator;

bool modelsweep = false; // Find component and its modelstring
bool compfound = false;
bool temper_sweep = false;
QString mod,mod_par;

if (!par.contains('@')) {
QStringList par_lst = par.split('.',qucs::SkipEmptyParts);
if (par_lst.count()>1) {
mod_par = par_lst.at(1);
// Schematic *sch = (Schematic *) QucsMain->DocumentTab->currentPage();
Schematic *sch = getSchematic();
Component *pc = sch->getComponentByName(par_lst.at(0));
if (pc != NULL) {
mod = pc->getSpiceNetlist().section('\n',1,1,QString::SectionSkipEmpty)
.section(' ',1,1,QString::SectionSkipEmpty);
if (!mod.isEmpty()) modelsweep = true;
}
}
}

Schematic *sch = getSchematic();
Component *pc = sch->getComponentByName(getProperty("Param")->Value);
Expand All @@ -175,19 +155,12 @@ QString Param_Sweep::getNgspiceBeforeSim(QString sim, int lvl)

if (step_var == "temp" || step_var == "temper") temper_sweep = true;

if (modelsweep) { // Model parameter sweep
s += QString("altermod %1 %2 = $%3_act%4").arg(mod).arg(mod_par).arg(step_var).arg(nline_char);
if (temper_sweep) {
s += QString("option temp = $%1_act%2").arg(step_var).arg(nline_char);
} else if (compfound) {
s += QString("alter %1 = $%2_act%3").arg(par).arg(step_var).arg(nline_char);
} else {
QString mswp = getProperty("SweepModel")->Value;
if (mswp == "true") {
s += QString("altermod %1 = $%2_act%3").arg(par).arg(step_var).arg(nline_char);
} else if (temper_sweep) {
s += QString("option temp = $%1_act%2").arg(step_var).arg(nline_char);
} else if (compfound) {
s += QString("alter %1 = $%2_act%3").arg(par).arg(step_var).arg(nline_char);
} else {
s += QString("alterparam %1 = $%2_act%3reset%3").arg(par).arg(step_var).arg(nline_char);
}
s += QString("alterparam %1 = $%2_act%3reset%3").arg(par).arg(step_var).arg(nline_char);
}
}
return s;
Expand Down Expand Up @@ -261,19 +234,3 @@ QString Param_Sweep::spice_netlist(bool isXyce)
return s.toLower();
}

// -------------------------------------------------------
QString Param_Sweep::netlist()
{
QString s = Model+":"+Name;

// output all node names
for (Port *p1 : Ports)
s += " "+p1->Connection->Name; // node names

// output all properties
for(unsigned int i=0; i <= Props.count()-2; i++)
if(Props.at(i)->Name != "Symbol")
s += " "+Props.at(i)->Name+"=\""+Props.at(i)->Value+"\"";

return s + '\n';
}
1 change: 0 additions & 1 deletion qucs/components/param_sweep.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class Param_Sweep : public qucs::component::SimulationComponent {

protected:
QString spice_netlist(bool isXyce);
QString netlist();
QString param_split_str=";";
};

Expand Down
1 change: 1 addition & 0 deletions qucs/diagrams/diagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ void Diagram::createAxisLabels() {

QStringList used_kernels, used_simulations;
for (const auto pg: Graphs) {
if (!pg->Var.contains("/")) continue; // Qucsator data
QString kernel_name = pg->Var.section('/', 0, 0);
QString var_name = pg->Var;
auto p = var_name.indexOf('/');
Expand Down
Loading