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

Set CLI parameters for each simulator individually #1192

Merged
merged 4 commits into from
Jan 6, 2025
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
3 changes: 0 additions & 3 deletions qucs/components/subcirport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ SubCirPort::SubCirPort()
Props.append(new Property("Type", "analog", false,
QObject::tr("type of the port (for digital simulation only)")
+" [analog, in, out, inout]"));
Props.append(new Property("XSPICE_Type","v",false,"Allowed XSPICE types: [v,i,vd,id,h,g,hd,gd]"));
Props.append(new Property("Bounded","",false,
QObject::tr("Conjugated port for XSPICE differential ports")));

createSymbol();
tx = x1+4;
Expand Down
7 changes: 4 additions & 3 deletions qucs/extsimkernels/externsimdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# include <config.h>
#endif

#include "settings.h"
#include "externsimdialog.h"
#include "simsettingsdialog.h"
#include "main.h"
Expand Down Expand Up @@ -119,15 +120,15 @@ void ExternSimDialog::slotSetSimulator()
} else {
a_ngspice->setSimulatorCmd(QucsSettings.NgspiceExecutable); //rely on $PATH
}
a_ngspice->setSimulatorParameters(QucsSettings.SimParameters);
a_ngspice->setSimulatorParameters(_settings::Get().item<QString>("NgspiceParams"));
}
break;
case spicecompat::simXyce: {
a_xyce->setParallel(false);
connect(a_xyce,SIGNAL(started()),this,SLOT(slotNgspiceStarted()));
connect(a_xyce,SIGNAL(finished()),this,SLOT(slotProcessOutput()));
connect(a_xyce,SIGNAL(errors(QProcess::ProcessError)),this,SLOT(slotNgspiceStartError(QProcess::ProcessError)));
a_xyce->setSimulatorParameters(QucsSettings.SimParameters);
a_xyce->setSimulatorParameters(_settings::Get().item<QString>("XyceParams"));
}
break;
// case spicecompat::simXycePar: {
Expand All @@ -149,7 +150,7 @@ void ExternSimDialog::slotSetSimulator()
connect(a_ngspice,SIGNAL(finished()),this,SLOT(slotProcessOutput()),Qt::UniqueConnection);
connect(a_ngspice,SIGNAL(errors(QProcess::ProcessError)),this,SLOT(slotNgspiceStartError(QProcess::ProcessError)),Qt::UniqueConnection);
a_ngspice->setSimulatorCmd(QucsSettings.SpiceOpusExecutable);
a_ngspice->setSimulatorParameters(QucsSettings.SimParameters);
a_ngspice->setSimulatorParameters(_settings::Get().item<QString>("NgspiceParams"));
}
break;
default: break;
Expand Down
90 changes: 20 additions & 70 deletions qucs/extsimkernels/simsettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,38 @@ SimSettingsDialog::SimSettingsDialog(QWidget *parent) :
a_lblXyce(new QLabel(tr("Xyce executable location"))),
a_lblNgspice(new QLabel(tr("Ngspice executable location"))),
a_lblSpiceOpus(new QLabel(tr("SpiceOpus executable location"))),
//a_lblXycePar(new QLabel(tr("Xyce Parallel executable location (openMPI installed required)"))),
//a_lblNprocs(new QLabel(tr("Number of processors in a system:"))),
a_lblQucsator(new QLabel(tr("Qucsator executable location"))),
//a_lblSimulator(new QLabel(tr("Default simulator"))),
a_lblSimParam(new QLabel(tr("Extra simulator parameters"))),
a_lblNgspiceSimParam(new QLabel(tr("Ngspice CLI parameters"))),
a_lblXyceSimParam(new QLabel(tr("Xyce CLI parameters"))),
a_lblSpopusSimParam(new QLabel(tr("SpiceOpus CLI parameters"))),
a_lblCompatMode(new QLabel(tr("Ngspice compatibility mode"))),
a_cbxCompatMode(new QComboBox),
//a_cbxSimulator(new QComboBox(this)),
a_edtNgspice(new QLineEdit(QucsSettings.NgspiceExecutable)),
a_edtSpiceOpus(new QLineEdit(QucsSettings.SpiceOpusExecutable)),
a_edtXyce(new QLineEdit(QucsSettings.XyceExecutable)),
//a_edtXycePar(new QLineEdit(QucsSettings.XyceParExecutable),
a_edtQucsator(new QLineEdit(QucsSettings.Qucsator)),
//a_spbNprocs(new QSpinBox(this)),
a_edtSimParam(new QLineEdit(QucsSettings.SimParameters)),
a_edtNgspiceSimParam(new QLineEdit()),
a_edtXyceSimParam(new QLineEdit()),
a_edtSpopusSimParam(new QLineEdit()),
a_btnOK(new QPushButton(tr("Apply changes"))),
a_btnCancel(new QPushButton(tr("Cancel"))),
a_btnSetNgspice(new QPushButton(tr("Select ..."))),
a_btnSetSpOpus(new QPushButton(tr("Select ..."))),
a_btnSetXyce(new QPushButton(tr("Select ..."))),
//a_btnSetXycePar(new QPushButton(tr("Select ..."))),
a_btnSetQucsator(new QPushButton(tr("Select ...")))
{
// a_cbxSimulator->addItem("Ngspice", 1);
// a_cbxSimulator->addItem("Xyce", 2);
// a_cbxSimulator->addItem("SpiceOpus", 4);
// a_cbxSimulator->addItem("Qucsator", 8);
//QStringList items;
//items<<"Ngspice"<<"Xyce (Serial)"<<"Xyce (Parallel)"<<"SpiceOpus"<<"Qucsator";
//a_cbxSimulator->addItems(items);
qDebug()<<QucsSettings.DefaultSimulator;
// a_cbxSimulator->setCurrentIndex(QucsSettings.DefaultSimulator);
// if (QucsSettings.DefaultSimulator==spicecompat::simNotSpecified)
// a_cbxSimulator->setCurrentIndex(spicecompat::simNgspice);

// a_spbNprocs->setMinimum(1);
// a_spbNprocs->setMaximum(256);
// a_spbNprocs->setValue(1);
// a_spbNprocs->setValue(QucsSettings.NProcs);
a_edtNgspiceSimParam->setText(_settings::Get().item<QString>("NgspiceParams"));
a_edtXyceSimParam->setText(_settings::Get().item<QString>("XyceParams"));
a_edtSpopusSimParam->setText(_settings::Get().item<QString>("SpopusParams"));


connect(a_btnOK,SIGNAL(clicked()),this,SLOT(slotApply()));
connect(a_btnCancel,SIGNAL(clicked()),this,SLOT(reject()));

connect(a_btnSetNgspice,SIGNAL(clicked()),this,SLOT(slotSetNgspice()));
connect(a_btnSetXyce,SIGNAL(clicked()),this,SLOT(slotSetXyce()));
//connect(a_btnSetXycePar,SIGNAL(clicked()),this,SLOT(slotSetXycePar()));
connect(a_btnSetSpOpus,SIGNAL(clicked()),this,SLOT(slotSetSpiceOpus()));
connect(a_btnSetQucsator,SIGNAL(clicked()),this,SLOT(slotSetQucsator()));

Expand All @@ -86,11 +72,6 @@ SimSettingsDialog::SimSettingsDialog(QWidget *parent) :

QVBoxLayout *top = new QVBoxLayout;

// QHBoxLayout *h8 = new QHBoxLayout;
// h8->addWidget(a_lblSimulator,1);
// h8->addWidget(a_cbxSimulator,3);
// top->addLayout(h8);

QGroupBox *gbp1 = new QGroupBox(this);
gbp1->setTitle(tr("SPICE settings"));
QVBoxLayout *top2 = new QVBoxLayout;
Expand All @@ -104,35 +85,24 @@ SimSettingsDialog::SimSettingsDialog(QWidget *parent) :
h4->addWidget(a_lblCompatMode);
h4->addWidget(a_cbxCompatMode);
top2->addLayout(h4);
top2->addWidget(a_lblNgspiceSimParam);
top2->addWidget(a_edtNgspiceSimParam);

top2->addWidget(a_lblXyce);
QHBoxLayout *h2 = new QHBoxLayout;
h2->addWidget(a_edtXyce,3);
h2->addWidget(a_btnSetXyce,1);
top2->addLayout(h2);

// top2->addWidget(a_lblXycePar);
// QHBoxLayout *h4 = new QHBoxLayout;
// h4->addWidget(a_edtXycePar,3);
// h4->addWidget(a_btnSetXycePar,1);
// top2->addLayout(h4);
//
// QHBoxLayout *h5 = new QHBoxLayout;
// h5->addWidget(a_lblNprocs);
// h5->addWidget(a_spbNprocs);
// top2->addLayout(h5);
top2->addWidget(a_lblXyceSimParam);
top2->addWidget(a_edtXyceSimParam);

top2->addWidget(a_lblSpiceOpus);
QHBoxLayout *h7 = new QHBoxLayout;
h7->addWidget(a_edtSpiceOpus,3);
h7->addWidget(a_btnSetSpOpus,1);
top2->addLayout(h7);


top2->addWidget(a_lblSimParam);
QHBoxLayout *h10 = new QHBoxLayout;
h10->addWidget(a_edtSimParam,4);
top2->addLayout(h10);
top2->addWidget(a_lblSpopusSimParam);
top2->addWidget(a_edtSpopusSimParam);

gbp1->setLayout(top2);
top->addWidget(gbp1);
Expand All @@ -159,42 +129,26 @@ SimSettingsDialog::SimSettingsDialog(QWidget *parent) :
this->setFixedWidth(500);
this->setWindowTitle(tr("Setup simulators executable location"));

#ifndef Q_OS_UNIX
// Only Unix supports Xyce-parallel
// a_edtXycePar->setDisabled(true);
// a_lblXycePar->setDisabled(true);
// a_lblNprocs->setDisabled(true);
// a_spbNprocs->setDisabled(true);
#endif

}


void SimSettingsDialog::slotApply()
{
QucsSettings.NgspiceExecutable = a_edtNgspice->text();
QucsSettings.XyceExecutable = a_edtXyce->text();
//QucsSettings.XyceParExecutable = a_edtXycePar->text();
QucsSettings.SpiceOpusExecutable = a_edtSpiceOpus->text();
QucsSettings.Qucsator = a_edtQucsator->text();
//QucsSettings.NProcs = a_spbNprocs->value();
QucsSettings.SimParameters = a_edtSimParam->text();
// if ((QucsSettings.DefaultSimulator != a_cbxSimulator->currentIndex())&&
// (QucsSettings.DefaultSimulator != spicecompat::simNotSpecified)) {
// QMessageBox::warning(this,tr("Simulator settings"),tr("Default simulator engine was changed!\n"
// "Please restart Qucs to affect changes!"));
// }
// QucsSettings.DefaultSimulator = a_cbxSimulator->currentIndex();
settingsManager& qs = _settings::Get();
qs.setItem<int>("NgspiceCompatMode", a_cbxCompatMode->currentIndex());
qs.setItem<QString>("NgspiceParams", a_edtNgspiceSimParam->text());
qs.setItem<QString>("XyceParams", a_edtXyceSimParam->text());
qs.setItem<QString>("SpopusParams", a_edtSpopusSimParam->text());
accept();
saveApplSettings();
}

void SimSettingsDialog::slotCancel()
{
//if (QucsSettings.DefaultSimulator == spicecompat::simNotSpecified)
//QucsSettings.DefaultSimulator = spicecompat::simQucsator;
reject();
}

Expand All @@ -216,11 +170,7 @@ void SimSettingsDialog::slotSetXyce()

void SimSettingsDialog::slotSetXycePar() // TODO ZERGUD
{
// QString s = QFileDialog::getOpenFileName(this,tr("Select Xyce Parallel executable location"),a_edtXycePar->text(),"All files (*)");
// if (!s.isEmpty()) {
// if (s.endsWith("xmpirun")) s += " -np %p";
// a_edtXycePar->setText(s);
// }

}

void SimSettingsDialog::slotSetSpiceOpus()
Expand Down
15 changes: 6 additions & 9 deletions qucs/extsimkernels/simsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,28 @@ class SimSettingsDialog : public QDialog
QLabel *a_lblXyce;
QLabel *a_lblNgspice;
QLabel *a_lblSpiceOpus;
//QLabel *a_lblXycePar;
//QLabel *a_lblNprocs;
QLabel *a_lblQucsator;
//QLabel *a_lblSimulator;
QLabel *a_lblSimParam;
QLabel *a_lblNgspiceSimParam;
QLabel *a_lblXyceSimParam;
QLabel *a_lblSpopusSimParam;
QLabel *a_lblCompatMode;

QComboBox *a_cbxCompatMode;
//QComboBox *a_cbxSimulator;

QLineEdit *a_edtNgspice;
QLineEdit *a_edtSpiceOpus;
QLineEdit *a_edtXyce;
//QLineEdit *a_edtXycePar;
QLineEdit *a_edtQucsator;
//QSpinBox *a_spbNprocs;
QLineEdit *a_edtSimParam;
QLineEdit *a_edtNgspiceSimParam;
QLineEdit *a_edtXyceSimParam;
QLineEdit *a_edtSpopusSimParam;

QPushButton *a_btnOK;
QPushButton *a_btnCancel;

QPushButton *a_btnSetNgspice;
QPushButton *a_btnSetSpOpus;
QPushButton *a_btnSetXyce;
//QPushButton *a_btnSetXycePar;
QPushButton *a_btnSetQucsator;

public:
Expand Down
2 changes: 0 additions & 2 deletions qucs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ bool loadSettings()
if (QucsSettings.S4Qworkdir == "")
QucsSettings.S4Qworkdir = QDir::toNativeSeparators(QucsSettings.QucsWorkDir.absolutePath()+"/spice4qucs");

QucsSettings.SimParameters = _settings::Get().item<QString>("SimParameters");
QucsSettings.OctaveExecutable = _settings::Get().item<QString>("OctaveExecutable");
QucsSettings.OpenVAFExecutable = _settings::Get().item<QString>("OpenVAFExecutable");

Expand Down Expand Up @@ -209,7 +208,6 @@ bool saveApplSettings()
qs.setItem<QString>("Qucsator",QucsSettings.Qucsator);
qs.setItem<int>("Nprocs",QucsSettings.NProcs);
qs.setItem<QString>("S4Q_workdir",QucsSettings.S4Qworkdir);
qs.setItem<QString>("SimParameters",QucsSettings.SimParameters);
qs.setItem<QString>("OctaveExecutable",QucsSettings.OctaveExecutable);
qs.setItem<QString>("OpenVAFExecutable",QucsSettings.OpenVAFExecutable);
qs.setItem<QString>("QucsHomeDir", QucsSettings.qucsWorkspaceDir.canonicalPath());
Expand Down
1 change: 0 additions & 1 deletion qucs/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ struct tQucsSettings {
QString XyceParExecutable;
QString SpiceOpusExecutable;
QString S4Qworkdir;
QString SimParameters;
unsigned int NProcs; // Number of processors for Xyce
QString OctaveExecutable; // OctaveExecutable location
QString QucsOctave; // OUCS_OCTAVE variable
Expand Down
Loading