Skip to content

Commit

Permalink
Do not add generic simulations to Sweep Parameter simulation list
Browse files Browse the repository at this point in the history
  • Loading branch information
iwbnwif committed Nov 17, 2024
1 parent 14f603b commit e63feb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
34 changes: 21 additions & 13 deletions qucs/components/componentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ ComponentDialog::ComponentDialog(Component* schematicComponent, Schematic* schem
if (!paramsHiddenBySim["Sim"].contains(component->Model))
{
eqnSimCombo = new QComboBox();
eqnSimCombo->addItems(getSimulationList());
eqnSimCombo->addItems(getSimulationList(true));
editorLayout->addWidget(eqnSimCombo, 2);
}

Expand Down Expand Up @@ -433,7 +433,7 @@ ComponentDialog::ComponentDialog(Component* schematicComponent, Schematic* schem
sweepTypeSpecialLabels[qMakePair(QString("log"),QString("Step"))] = {"Points per decade"};

// Setup the widgets as per the stored type.
sweepParamWidget["Sim"]->setOptions(getSimulationList());
sweepParamWidget["Sim"]->setOptions(getSimulationList(false));
sweepParamWidget["Type"]->setOptions({"lin", "log", "list", "value"});
updateSweepProperty("All");

Expand Down Expand Up @@ -956,14 +956,14 @@ void ComponentDialog::slotEditFile()

// -------------------------------------------------------------------------
// Get a list of simulations in the schematic.
QStringList ComponentDialog::getSimulationList()
QStringList ComponentDialog::getSimulationList(bool includeGeneric)
{
QStringList sim_lst;
Schematic *sch = component->getSchematic();
if (sch == nullptr) {
return sim_lst;
}
sim_lst.append("ALL");

for (size_t i = 0; i < sch->a_DocComps.count(); i++) {
Component *c = sch->a_DocComps.at(i);
if (!c->isSimulation) continue;
Expand All @@ -974,16 +974,24 @@ QStringList ComponentDialog::getSimulationList()
if (c->Model == ".SW" && !c->Props.at(0)->Value.toUpper().startsWith("DC") ) continue;
sim_lst.append(c->Name);
}
QStringList sim_wo_numbers = sim_lst;
for(auto &s: sim_wo_numbers) {
s.remove(QRegularExpression("[0-9]+$"));
}
for(const auto &s: sim_wo_numbers) {
int cnt = sim_wo_numbers.count(s);
if (cnt > 1 && ! sim_lst.contains(s)) {
sim_lst.append(s);
}

if (includeGeneric) {
QStringList sim_wo_numbers = sim_lst;

for(auto &s: sim_wo_numbers) {
s.remove(QRegularExpression("[0-9]+$"));
}

for(const auto &s: sim_wo_numbers) {
int cnt = sim_wo_numbers.count(s);
if (cnt > 1 && ! sim_lst.contains(s)) {
sim_lst.append(s);
}
}

sim_lst.prepend("ALL");
}

return sim_lst;
}

Expand Down
2 changes: 1 addition & 1 deletion qucs/components/componentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private slots:
ParamLineEdit* componentNameWidget;
int tx_Dist, ty_Dist; // remember the text position

QStringList getSimulationList();
QStringList getSimulationList(bool includeGeneric);

void updateSweepProperty(const QString& propertyWidget);
void updateSweepWidgets(const QString& simType);
Expand Down

0 comments on commit e63feb8

Please sign in to comment.