Fixed double .subckt addition in nested Subcircuits

This commit is contained in:
Vadim Kuznetzov 2016-10-09 10:08:26 +03:00
parent d59c4f0a75
commit e6548302a7
4 changed files with 11 additions and 4 deletions

View File

@ -86,7 +86,7 @@ void AbstractSpiceKernel::killThemAll()
* prepared for Xyce simulator. For Ngspice should be false.
* \return Returns true if success, false if netlist preparation fails
*/
bool AbstractSpiceKernel::prepareSpiceNetlist(QTextStream &stream)
bool AbstractSpiceKernel::prepareSpiceNetlist(QTextStream &stream, bool isSubckt)
{
QStringList collect;
QPlainTextEdit *err = new QPlainTextEdit;
@ -96,7 +96,8 @@ bool AbstractSpiceKernel::prepareSpiceNetlist(QTextStream &stream)
return false;
}
delete err;
Sch->clearSignalsAndFileList(); // for proper build of subckts
if (isSubckt) Sch->clearSignals();
else Sch->clearSignalsAndFileList(); // for proper build of subckts
return true; // TODO: Add feature to determine ability of spice simulation
}
@ -197,7 +198,7 @@ void AbstractSpiceKernel::createSubNetlsit(QTextStream &stream, bool lib)
header = QString(".SUBCKT %1 ").arg(misc::properName(f));
QList< QPair<int,QString> > ports;
if(!prepareSpiceNetlist(stream)) {
if(!prepareSpiceNetlist(stream,true)) {
emit finished();
emit errors(QProcess::FailedToStart);
return;

View File

@ -57,7 +57,7 @@ protected:
bool DC_OP_only; // only calculate operating point to show DC bias
Schematic *Sch;
bool prepareSpiceNetlist(QTextStream &stream);
bool prepareSpiceNetlist(QTextStream &stream, bool isSubckt = false);
virtual void startNetlist(QTextStream& stream, bool xyce = false);
virtual void createNetlist(QTextStream& stream, int NumPorts,QStringList& simulations,
QStringList& vars, QStringList &outputs);

View File

@ -283,6 +283,7 @@ public:
bool loadDocument();
void highlightWireLabels (void);
void clearSignalsAndFileList();
void clearSignals();
private:
int saveDocument();

View File

@ -1999,3 +1999,8 @@ void Schematic::clearSignalsAndFileList()
Signals.clear(); // was filled in "giveNodeNames()"
FileList.clear();
}
void Schematic::clearSignals()
{
Signals.clear();
}