From 80d4a57532e50c92d8e33b781df14f00e1d5f95c Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Mon, 16 Dec 2024 12:07:51 +0100 Subject: [PATCH 01/10] New feature CDL netlist export -introduced new parameter for cdl-type netlist export to Component::spice_netlist and all derivatives under components/ Signed-off-by: ThomasZecha --- qucs/components/ac_sim.cpp | 2 +- qucs/components/ac_sim.h | 2 +- qucs/components/ampere_ac.cpp | 2 +- qucs/components/ampere_ac.h | 2 +- qucs/components/ampere_dc.cpp | 2 +- qucs/components/ampere_dc.h | 2 +- qucs/components/biast.cpp | 2 +- qucs/components/biast.h | 2 +- qucs/components/bjt.cpp | 2 +- qucs/components/bjt.h | 2 +- qucs/components/bjtsub.cpp | 2 +- qucs/components/bjtsub.h | 2 +- qucs/components/capacitor.cpp | 2 +- qucs/components/capacitor.h | 2 +- qucs/components/capq.cpp | 2 +- qucs/components/capq.h | 2 +- qucs/components/cccs.cpp | 2 +- qucs/components/cccs.h | 2 +- qucs/components/ccvs.cpp | 2 +- qucs/components/ccvs.h | 2 +- qucs/components/component.cpp | 4 ++-- qucs/components/component.h | 4 ++-- qucs/components/d_flipflop.cpp | 2 +- qucs/components/d_flipflop.h | 2 +- qucs/components/dc_sim.cpp | 2 +- qucs/components/dc_sim.h | 2 +- qucs/components/dcblock.cpp | 2 +- qucs/components/dcblock.h | 2 +- qucs/components/dcfeed.cpp | 2 +- qucs/components/dcfeed.h | 2 +- qucs/components/dff_SR.cpp | 2 +- qucs/components/dff_SR.h | 2 +- qucs/components/digi_source.cpp | 2 +- qucs/components/digi_source.h | 2 +- qucs/components/diode.cpp | 2 +- qucs/components/diode.h | 2 +- qucs/components/eqndefined.cpp | 2 +- qucs/components/eqndefined.h | 2 +- qucs/components/ground.cpp | 2 +- qucs/components/ground.h | 2 +- qucs/components/gyrator.cpp | 2 +- qucs/components/gyrator.h | 2 +- qucs/components/hb_sim.cpp | 2 +- qucs/components/hb_sim.h | 2 +- qucs/components/iexp.cpp | 2 +- qucs/components/iexp.h | 2 +- qucs/components/ifile.cpp | 2 +- qucs/components/ifile.h | 2 +- qucs/components/indq.cpp | 2 +- qucs/components/indq.h | 2 +- qucs/components/inductor.cpp | 2 +- qucs/components/inductor.h | 2 +- qucs/components/iprobe.cpp | 2 +- qucs/components/iprobe.h | 2 +- qucs/components/ipulse.cpp | 2 +- qucs/components/ipulse.h | 2 +- qucs/components/irect.cpp | 2 +- qucs/components/irect.h | 2 +- qucs/components/jfet.cpp | 2 +- qucs/components/jfet.h | 2 +- qucs/components/jkff_SR.cpp | 2 +- qucs/components/jkff_SR.h | 2 +- qucs/components/libcomp.cpp | 2 +- qucs/components/libcomp.h | 2 +- qucs/components/logical_buf.cpp | 2 +- qucs/components/logical_buf.h | 2 +- qucs/components/logical_inv.cpp | 2 +- qucs/components/logical_inv.h | 2 +- qucs/components/mosfet.cpp | 2 +- qucs/components/mosfet.h | 2 +- qucs/components/mosfet_sub.cpp | 2 +- qucs/components/mosfet_sub.h | 2 +- qucs/components/mutual.cpp | 2 +- qucs/components/mutual.h | 2 +- qucs/components/mutual2.cpp | 2 +- qucs/components/mutual2.h | 2 +- qucs/components/mutualx.cpp | 2 +- qucs/components/mutualx.h | 2 +- qucs/components/opamp.cpp | 2 +- qucs/components/opamp.h | 2 +- qucs/components/param_sweep.cpp | 2 +- qucs/components/param_sweep.h | 2 +- qucs/components/potentiometer.cpp | 2 +- qucs/components/potentiometer.h | 2 +- qucs/components/relais.cpp | 2 +- qucs/components/relais.h | 2 +- qucs/components/resistor.cpp | 2 +- qucs/components/resistor.h | 2 +- qucs/components/rlcg.cpp | 2 +- qucs/components/rlcg.h | 2 +- qucs/components/source_ac.cpp | 2 +- qucs/components/source_ac.h | 2 +- qucs/components/sp_sim.cpp | 2 +- qucs/components/sp_sim.h | 2 +- qucs/components/sparamfile.cpp | 2 +- qucs/components/sparamfile.h | 2 +- qucs/components/spicefile.cpp | 2 +- qucs/components/spicefile.h | 2 +- qucs/components/subcircuit.cpp | 2 +- qucs/components/subcircuit.h | 2 +- qucs/components/subcirport.cpp | 2 +- qucs/components/subcirport.h | 2 +- qucs/components/switch.cpp | 2 +- qucs/components/switch.h | 2 +- qucs/components/tff_SR.cpp | 2 +- qucs/components/tff_SR.h | 2 +- qucs/components/tr_sim.cpp | 2 +- qucs/components/tr_sim.h | 2 +- qucs/components/vacomponent.cpp | 2 +- qucs/components/vacomponent.h | 2 +- qucs/components/vccs.cpp | 2 +- qucs/components/vccs.h | 2 +- qucs/components/vcresistor.cpp | 2 +- qucs/components/vcresistor.h | 2 +- qucs/components/vcvs.cpp | 2 +- qucs/components/vcvs.h | 2 +- qucs/components/vexp.cpp | 2 +- qucs/components/vexp.h | 2 +- qucs/components/vfile.cpp | 2 +- qucs/components/vfile.h | 2 +- qucs/components/volt_ac.cpp | 2 +- qucs/components/volt_ac.h | 2 +- qucs/components/volt_dc.cpp | 2 +- qucs/components/volt_dc.h | 2 +- qucs/components/vprobe.cpp | 2 +- qucs/components/vprobe.h | 2 +- qucs/components/vpulse.cpp | 2 +- qucs/components/vpulse.h | 2 +- qucs/components/vrect.cpp | 2 +- qucs/components/vrect.h | 2 +- 130 files changed, 132 insertions(+), 132 deletions(-) diff --git a/qucs/components/ac_sim.cpp b/qucs/components/ac_sim.cpp index 24cceb5cd..a9b9b1fad 100644 --- a/qucs/components/ac_sim.cpp +++ b/qucs/components/ac_sim.cpp @@ -79,7 +79,7 @@ void AC_Sim::recreate(Schematic*) } } -QString AC_Sim::spice_netlist(bool isXyce) +QString AC_Sim::spice_netlist(bool isXyce, bool) { QString s = SpiceModel + " "; QString unit; diff --git a/qucs/components/ac_sim.h b/qucs/components/ac_sim.h index 3ce3b46d6..b3a939e86 100644 --- a/qucs/components/ac_sim.h +++ b/qucs/components/ac_sim.h @@ -28,7 +28,7 @@ class AC_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); void recreate(Schematic*); - QString spice_netlist(bool isXyce=false); + QString spice_netlist(bool isXyce=false, bool isCdl = false); }; #endif diff --git a/qucs/components/ampere_ac.cpp b/qucs/components/ampere_ac.cpp index d56e848cc..9a13754ca 100644 --- a/qucs/components/ampere_ac.cpp +++ b/qucs/components/ampere_ac.cpp @@ -78,7 +78,7 @@ Element* Ampere_ac::info(QString& Name, char* &BitmapFile, bool getNewOne) } -QString Ampere_ac::spice_netlist(bool) +QString Ampere_ac::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/ampere_ac.h b/qucs/components/ampere_ac.h index 2e8b96ff4..86d612c0c 100644 --- a/qucs/components/ampere_ac.h +++ b/qucs/components/ampere_ac.h @@ -28,7 +28,7 @@ class Ampere_ac : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/ampere_dc.cpp b/qucs/components/ampere_dc.cpp index c14d21c20..b3d1ddc40 100644 --- a/qucs/components/ampere_dc.cpp +++ b/qucs/components/ampere_dc.cpp @@ -56,7 +56,7 @@ Ampere_dc::~Ampere_dc() { } -QString Ampere_dc::spice_netlist(bool) +QString Ampere_dc::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/ampere_dc.h b/qucs/components/ampere_dc.h index c349b351c..80f84e03e 100644 --- a/qucs/components/ampere_dc.h +++ b/qucs/components/ampere_dc.h @@ -27,7 +27,7 @@ class Ampere_dc : public Component { ~Ampere_dc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/biast.cpp b/qucs/components/biast.cpp index b3f7735c3..a3b7fc0ba 100644 --- a/qucs/components/biast.cpp +++ b/qucs/components/biast.cpp @@ -80,7 +80,7 @@ Element* BiasT::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString BiasT::spice_netlist(bool isXyce) +QString BiasT::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/biast.h b/qucs/components/biast.h index 45a97749c..1a78a2a66 100644 --- a/qucs/components/biast.h +++ b/qucs/components/biast.h @@ -28,7 +28,7 @@ class BiasT : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/bjt.cpp b/qucs/components/bjt.cpp index b65a425b1..2fe50a258 100644 --- a/qucs/components/bjt.cpp +++ b/qucs/components/bjt.cpp @@ -42,7 +42,7 @@ Component* BJT::newOne() return p; } -QString BJT::spice_netlist(bool) +QString BJT::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; diff --git a/qucs/components/bjt.h b/qucs/components/bjt.h index c035033a2..a508f91f8 100644 --- a/qucs/components/bjt.h +++ b/qucs/components/bjt.h @@ -32,7 +32,7 @@ class BJT : public Basic_BJT { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/bjtsub.cpp b/qucs/components/bjtsub.cpp index c955e222e..5ee2b2aa3 100644 --- a/qucs/components/bjtsub.cpp +++ b/qucs/components/bjtsub.cpp @@ -201,7 +201,7 @@ void BJTsub::createSymbol() x2 = 30; y2 = 30; } -QString BJTsub::spice_netlist(bool) +QString BJTsub::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; diff --git a/qucs/components/bjtsub.h b/qucs/components/bjtsub.h index 02b57ba7c..1073c2414 100644 --- a/qucs/components/bjtsub.h +++ b/qucs/components/bjtsub.h @@ -36,7 +36,7 @@ class BJTsub : public Basic_BJT { static Element* info_pnp(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); void createSymbol(); }; diff --git a/qucs/components/capacitor.cpp b/qucs/components/capacitor.cpp index 14377aa22..776372730 100644 --- a/qucs/components/capacitor.cpp +++ b/qucs/components/capacitor.cpp @@ -53,7 +53,7 @@ Element* Capacitor::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Capacitor::spice_netlist(bool) +QString Capacitor::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/capacitor.h b/qucs/components/capacitor.h index 32881186b..b849fe978 100644 --- a/qucs/components/capacitor.h +++ b/qucs/components/capacitor.h @@ -30,7 +30,7 @@ class Capacitor : public MultiViewComponent { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/capq.cpp b/qucs/components/capq.cpp index cbf32b558..773196844 100644 --- a/qucs/components/capq.cpp +++ b/qucs/components/capq.cpp @@ -91,7 +91,7 @@ Element* CapQ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString CapQ::spice_netlist(bool isXyce) +QString CapQ::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/capq.h b/qucs/components/capq.h index 4a1b3a204..5813aadd7 100644 --- a/qucs/components/capq.h +++ b/qucs/components/capq.h @@ -34,7 +34,7 @@ class CapQ : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/cccs.cpp b/qucs/components/cccs.cpp index 2244d16d3..03b4cbe13 100644 --- a/qucs/components/cccs.cpp +++ b/qucs/components/cccs.cpp @@ -101,7 +101,7 @@ QString CCCS::va_code() return s; } -QString CCCS::spice_netlist(bool) +QString CCCS::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); // spice CCCS consists two sources: output source // and zero value controlling source diff --git a/qucs/components/cccs.h b/qucs/components/cccs.h index 530aa9856..764bf6be6 100644 --- a/qucs/components/cccs.h +++ b/qucs/components/cccs.h @@ -28,7 +28,7 @@ class CCCS : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/ccvs.cpp b/qucs/components/ccvs.cpp index 108bde52b..6924fc5d6 100644 --- a/qucs/components/ccvs.cpp +++ b/qucs/components/ccvs.cpp @@ -102,7 +102,7 @@ QString CCVS::va_code() } // ------------------------------------------------------- -QString CCVS::spice_netlist(bool) +QString CCVS::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); // spice CCVS consists two sources: output source // and zero value controlling source diff --git a/qucs/components/ccvs.h b/qucs/components/ccvs.h index 09b9245df..d3d41a8b6 100644 --- a/qucs/components/ccvs.h +++ b/qucs/components/ccvs.h @@ -28,7 +28,7 @@ class CCVS : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 5ce3ba8da..8643f07f9 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -758,7 +758,7 @@ QString Component::form_spice_param_list(QStringList &ignore_list, QStringList & return par_str; } -QString Component::spice_netlist(bool) { +QString Component::spice_netlist(bool, bool) { return QStringLiteral("\n"); // ignore if not implemented } @@ -1537,7 +1537,7 @@ QString GateComponent::netlist() { return s; } -QString GateComponent::spice_netlist(bool isXyce) { +QString GateComponent::spice_netlist(bool isXyce, bool) { if (isXyce) return {""}; QString s = SpiceModel + Name; diff --git a/qucs/components/component.h b/qucs/components/component.h index 64966355e..a0e9769cd 100644 --- a/qucs/components/component.h +++ b/qucs/components/component.h @@ -114,7 +114,7 @@ class Component : public Element { protected: virtual QString netlist(); - virtual QString spice_netlist(bool isXyce = false); + virtual QString spice_netlist(bool isXyce = false, bool isCdl = false); virtual QString va_code(); virtual QString vhdlCode(int); virtual QString verilogCode(int); @@ -149,7 +149,7 @@ class GateComponent : public MultiViewComponent { public: GateComponent(); QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); diff --git a/qucs/components/d_flipflop.cpp b/qucs/components/d_flipflop.cpp index 2296881de..f1aef1617 100644 --- a/qucs/components/d_flipflop.cpp +++ b/qucs/components/d_flipflop.cpp @@ -120,7 +120,7 @@ Element* D_FlipFlop::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString D_FlipFlop::spice_netlist(bool isXyce) +QString D_FlipFlop::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/d_flipflop.h b/qucs/components/d_flipflop.h index b216b7f3a..e69884a55 100644 --- a/qucs/components/d_flipflop.h +++ b/qucs/components/d_flipflop.h @@ -31,7 +31,7 @@ class D_FlipFlop : public Component { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/dc_sim.cpp b/qucs/components/dc_sim.cpp index 2bcb1855b..19bf45025 100644 --- a/qucs/components/dc_sim.cpp +++ b/qucs/components/dc_sim.cpp @@ -67,7 +67,7 @@ Element* DC_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString DC_Sim::spice_netlist(bool isXyce) +QString DC_Sim::spice_netlist(bool isXyce, bool) { QString s; if ( !isXyce ) { diff --git a/qucs/components/dc_sim.h b/qucs/components/dc_sim.h index 10b16e64e..5b4b0c488 100644 --- a/qucs/components/dc_sim.h +++ b/qucs/components/dc_sim.h @@ -29,7 +29,7 @@ class DC_Sim : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/dcblock.cpp b/qucs/components/dcblock.cpp index b82173448..4934d4743 100644 --- a/qucs/components/dcblock.cpp +++ b/qucs/components/dcblock.cpp @@ -68,7 +68,7 @@ Element* dcBlock::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString dcBlock::spice_netlist(bool isXyce) +QString dcBlock::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/dcblock.h b/qucs/components/dcblock.h index a4493714f..28ab52c8d 100644 --- a/qucs/components/dcblock.h +++ b/qucs/components/dcblock.h @@ -28,7 +28,7 @@ class dcBlock : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/dcfeed.cpp b/qucs/components/dcfeed.cpp index 63b4dceba..271277ae1 100644 --- a/qucs/components/dcfeed.cpp +++ b/qucs/components/dcfeed.cpp @@ -69,7 +69,7 @@ Element* dcFeed::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString dcFeed::spice_netlist(bool isXyce) +QString dcFeed::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/dcfeed.h b/qucs/components/dcfeed.h index 48b75ca24..2b94227e3 100644 --- a/qucs/components/dcfeed.h +++ b/qucs/components/dcfeed.h @@ -28,7 +28,7 @@ class dcFeed : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/dff_SR.cpp b/qucs/components/dff_SR.cpp index c72ca211a..926f88ed0 100644 --- a/qucs/components/dff_SR.cpp +++ b/qucs/components/dff_SR.cpp @@ -175,7 +175,7 @@ QString dff_SR::verilogCode( int ) return l; } -QString dff_SR::spice_netlist(bool isXyce) +QString dff_SR::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/dff_SR.h b/qucs/components/dff_SR.h index 72ae7c113..7ae05e392 100644 --- a/qucs/components/dff_SR.h +++ b/qucs/components/dff_SR.h @@ -24,7 +24,7 @@ class dff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif /* dff_SR_H */ diff --git a/qucs/components/digi_source.cpp b/qucs/components/digi_source.cpp index acf3a975a..ad5719475 100644 --- a/qucs/components/digi_source.cpp +++ b/qucs/components/digi_source.cpp @@ -191,7 +191,7 @@ QString Digi_Source::verilogCode(int NumPorts) return s; } -QString Digi_Source::spice_netlist(bool) +QString Digi_Source::spice_netlist(bool, bool) { QString s = SpiceModel + Name; QString port = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/digi_source.h b/qucs/components/digi_source.h index 23b389d36..0972c3da7 100644 --- a/qucs/components/digi_source.h +++ b/qucs/components/digi_source.h @@ -32,7 +32,7 @@ class Digi_Source : public Component { QString netlist(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/diode.cpp b/qucs/components/diode.cpp index 7e76446ee..87d4d94f5 100644 --- a/qucs/components/diode.cpp +++ b/qucs/components/diode.cpp @@ -99,7 +99,7 @@ Component* Diode::newOne() return new Diode(); } -QString Diode::spice_netlist(bool isXyce) +QString Diode::spice_netlist(bool isXyce, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); // output all node names diff --git a/qucs/components/diode.h b/qucs/components/diode.h index a71b0c2d2..9195f7b8b 100644 --- a/qucs/components/diode.h +++ b/qucs/components/diode.h @@ -29,7 +29,7 @@ class Diode : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); void createSymbol(); }; diff --git a/qucs/components/eqndefined.cpp b/qucs/components/eqndefined.cpp index bd5de38eb..e0334ca25 100644 --- a/qucs/components/eqndefined.cpp +++ b/qucs/components/eqndefined.cpp @@ -96,7 +96,7 @@ QString EqnDefined::netlist() return s+e; } -QString EqnDefined::spice_netlist(bool isXyce) +QString EqnDefined::spice_netlist(bool isXyce, bool) { QString s; diff --git a/qucs/components/eqndefined.h b/qucs/components/eqndefined.h index b70216e50..f5bcfbd03 100644 --- a/qucs/components/eqndefined.h +++ b/qucs/components/eqndefined.h @@ -36,7 +36,7 @@ class EqnDefined : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/ground.cpp b/qucs/components/ground.cpp index 9d3c06124..0c71a5c08 100644 --- a/qucs/components/ground.cpp +++ b/qucs/components/ground.cpp @@ -66,7 +66,7 @@ QString Ground::netlist() return QString(); } -QString Ground::spice_netlist(bool) +QString Ground::spice_netlist(bool, bool) { return QString(); } diff --git a/qucs/components/ground.h b/qucs/components/ground.h index f6e1cf96d..1d1796af1 100644 --- a/qucs/components/ground.h +++ b/qucs/components/ground.h @@ -30,7 +30,7 @@ class Ground : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/gyrator.cpp b/qucs/components/gyrator.cpp index c3625605c..48f3e40e6 100644 --- a/qucs/components/gyrator.cpp +++ b/qucs/components/gyrator.cpp @@ -79,7 +79,7 @@ Element* Gyrator::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Gyrator::spice_netlist(bool) +QString Gyrator::spice_netlist(bool, bool) { QString s; QString R = spicecompat::normalize_value(Props.at(0)->Value); diff --git a/qucs/components/gyrator.h b/qucs/components/gyrator.h index 6e395846e..ff52c0410 100644 --- a/qucs/components/gyrator.h +++ b/qucs/components/gyrator.h @@ -28,7 +28,7 @@ class Gyrator : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/hb_sim.cpp b/qucs/components/hb_sim.cpp index f95abd55b..549f82eb4 100644 --- a/qucs/components/hb_sim.cpp +++ b/qucs/components/hb_sim.cpp @@ -63,7 +63,7 @@ Element* HB_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString HB_Sim::spice_netlist(bool isXyce) +QString HB_Sim::spice_netlist(bool isXyce, bool) { QString s=""; if (isXyce) { // Only in Xyce diff --git a/qucs/components/hb_sim.h b/qucs/components/hb_sim.h index 6508abbaa..b62f3d7c4 100644 --- a/qucs/components/hb_sim.h +++ b/qucs/components/hb_sim.h @@ -28,7 +28,7 @@ class HB_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/iexp.cpp b/qucs/components/iexp.cpp index 90281e64f..f1dab0df3 100644 --- a/qucs/components/iexp.cpp +++ b/qucs/components/iexp.cpp @@ -85,7 +85,7 @@ Element* iExp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iExp::spice_netlist(bool) +QString iExp::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/iexp.h b/qucs/components/iexp.h index 474a97785..e4f3cf973 100644 --- a/qucs/components/iexp.h +++ b/qucs/components/iexp.h @@ -31,7 +31,7 @@ class iExp : public Component { ~iExp(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/ifile.cpp b/qucs/components/ifile.cpp index cce85f493..82363adf4 100644 --- a/qucs/components/ifile.cpp +++ b/qucs/components/ifile.cpp @@ -109,7 +109,7 @@ QString iFile::netlist() return s + "\n"; } -QString iFile::spice_netlist(bool isXyce) +QString iFile::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s = SpiceModel + Name; diff --git a/qucs/components/ifile.h b/qucs/components/ifile.h index 1352e0100..7f6b74281 100644 --- a/qucs/components/ifile.h +++ b/qucs/components/ifile.h @@ -32,7 +32,7 @@ class iFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/indq.cpp b/qucs/components/indq.cpp index 89cabdb32..a5e65d3b4 100644 --- a/qucs/components/indq.cpp +++ b/qucs/components/indq.cpp @@ -92,7 +92,7 @@ Element* IndQ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString IndQ::spice_netlist(bool isXyce) +QString IndQ::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/indq.h b/qucs/components/indq.h index 0b4de80f3..cd27febb1 100644 --- a/qucs/components/indq.h +++ b/qucs/components/indq.h @@ -33,7 +33,7 @@ class IndQ : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/inductor.cpp b/qucs/components/inductor.cpp index a41e4e377..caca0147e 100644 --- a/qucs/components/inductor.cpp +++ b/qucs/components/inductor.cpp @@ -58,7 +58,7 @@ Component* Inductor::newOne() } -QString Inductor::spice_netlist(bool) +QString Inductor::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/inductor.h b/qucs/components/inductor.h index c17c993ee..7426d1988 100644 --- a/qucs/components/inductor.h +++ b/qucs/components/inductor.h @@ -30,7 +30,7 @@ class Inductor : public Component { protected: QString va_code(); void getExtraVANodes(QStringList& nodes); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/iprobe.cpp b/qucs/components/iprobe.cpp index 162875431..62e384781 100644 --- a/qucs/components/iprobe.cpp +++ b/qucs/components/iprobe.cpp @@ -79,7 +79,7 @@ Element* iProbe::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iProbe::spice_netlist(bool) +QString iProbe::spice_netlist(bool, bool) { QString s = QStringLiteral("V%1 %2 %3 DC 0\n").arg(Name).arg(Ports.at(0)->Connection->Name) .arg(Ports.at(1)->Connection->Name); diff --git a/qucs/components/iprobe.h b/qucs/components/iprobe.h index ce49b0682..99cd25b98 100644 --- a/qucs/components/iprobe.h +++ b/qucs/components/iprobe.h @@ -30,7 +30,7 @@ class iProbe : public Component { QString getExpression(bool) { return "";} QString getProbeVariable(bool isXyce = false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/ipulse.cpp b/qucs/components/ipulse.cpp index e553e9222..5f142c245 100644 --- a/qucs/components/ipulse.cpp +++ b/qucs/components/ipulse.cpp @@ -89,7 +89,7 @@ Element* iPulse::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iPulse::spice_netlist(bool) +QString iPulse::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/ipulse.h b/qucs/components/ipulse.h index 443208e1e..4e3cd9cac 100644 --- a/qucs/components/ipulse.h +++ b/qucs/components/ipulse.h @@ -30,7 +30,7 @@ class iPulse : public Component { ~iPulse(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/irect.cpp b/qucs/components/irect.cpp index 4166224b2..f63657157 100644 --- a/qucs/components/irect.cpp +++ b/qucs/components/irect.cpp @@ -80,7 +80,7 @@ iRect::~iRect() { } -QString iRect::spice_netlist(bool) +QString iRect::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/irect.h b/qucs/components/irect.h index bbce4c043..da846c44b 100644 --- a/qucs/components/irect.h +++ b/qucs/components/irect.h @@ -27,7 +27,7 @@ class iRect : public Component { ~iRect(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/jfet.cpp b/qucs/components/jfet.cpp index a49ac7e44..3c729a461 100644 --- a/qucs/components/jfet.cpp +++ b/qucs/components/jfet.cpp @@ -94,7 +94,7 @@ Component* JFET::newOne() return p; } -QString JFET::spice_netlist(bool isXyce) +QString JFET::spice_netlist(bool isXyce, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; diff --git a/qucs/components/jfet.h b/qucs/components/jfet.h index 04917eda3..def3c3864 100644 --- a/qucs/components/jfet.h +++ b/qucs/components/jfet.h @@ -31,7 +31,7 @@ class JFET : public MultiViewComponent { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/jkff_SR.cpp b/qucs/components/jkff_SR.cpp index ebc71ee7d..2b8f37f9c 100644 --- a/qucs/components/jkff_SR.cpp +++ b/qucs/components/jkff_SR.cpp @@ -184,7 +184,7 @@ QString jkff_SR::verilogCode( int ) return l; } -QString jkff_SR::spice_netlist(bool isXyce) +QString jkff_SR::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/jkff_SR.h b/qucs/components/jkff_SR.h index 8a06993b3..32e07c248 100644 --- a/qucs/components/jkff_SR.h +++ b/qucs/components/jkff_SR.h @@ -24,7 +24,7 @@ class jkff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif /* jkff_SR_H */ diff --git a/qucs/components/libcomp.cpp b/qucs/components/libcomp.cpp index eab40cd55..c43c2389a 100644 --- a/qucs/components/libcomp.cpp +++ b/qucs/components/libcomp.cpp @@ -361,7 +361,7 @@ QString LibComp::vhdlCode(int) return s; } -QString LibComp::spice_netlist(bool) +QString LibComp::spice_netlist(bool, bool) { QString s = SpiceModel + Name + " 0 "; // connect ground of subckt to circuit ground for (Port *p1 : Ports) diff --git a/qucs/components/libcomp.h b/qucs/components/libcomp.h index 6237fc3c5..aa3e50f3d 100644 --- a/qucs/components/libcomp.h +++ b/qucs/components/libcomp.h @@ -37,7 +37,7 @@ class LibComp : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/logical_buf.cpp b/qucs/components/logical_buf.cpp index 849ebd158..f6923be51 100644 --- a/qucs/components/logical_buf.cpp +++ b/qucs/components/logical_buf.cpp @@ -135,7 +135,7 @@ Element* Logical_Buf::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Logical_Buf::spice_netlist(bool isXyce) +QString Logical_Buf::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/logical_buf.h b/qucs/components/logical_buf.h index 28d7dee6e..2baa5dfb8 100644 --- a/qucs/components/logical_buf.h +++ b/qucs/components/logical_buf.h @@ -31,7 +31,7 @@ class Logical_Buf : public MultiViewComponent { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); void createSymbol(); }; diff --git a/qucs/components/logical_inv.cpp b/qucs/components/logical_inv.cpp index 5489b34a7..1ca291e03 100644 --- a/qucs/components/logical_inv.cpp +++ b/qucs/components/logical_inv.cpp @@ -152,7 +152,7 @@ Element* Logical_Inv::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Logical_Inv::spice_netlist(bool isXyce) +QString Logical_Inv::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/logical_inv.h b/qucs/components/logical_inv.h index 43f4d4400..0c7e9affe 100644 --- a/qucs/components/logical_inv.h +++ b/qucs/components/logical_inv.h @@ -29,7 +29,7 @@ class Logical_Inv : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/mosfet.cpp b/qucs/components/mosfet.cpp index 8668ba32e..b9fd292a2 100644 --- a/qucs/components/mosfet.cpp +++ b/qucs/components/mosfet.cpp @@ -140,7 +140,7 @@ QString MOSFET::netlist() return s + '\n'; } -QString MOSFET::spice_netlist(bool isXyce) +QString MOSFET::spice_netlist(bool isXyce, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; diff --git a/qucs/components/mosfet.h b/qucs/components/mosfet.h index 77fb721c8..f8e71cdaf 100644 --- a/qucs/components/mosfet.h +++ b/qucs/components/mosfet.h @@ -33,7 +33,7 @@ class MOSFET : public Basic_MOSFET { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/mosfet_sub.cpp b/qucs/components/mosfet_sub.cpp index 841638c8b..5b413ca2a 100644 --- a/qucs/components/mosfet_sub.cpp +++ b/qucs/components/mosfet_sub.cpp @@ -150,7 +150,7 @@ Component* MOSFET_sub::newOne() return p; } -QString MOSFET_sub::spice_netlist(bool isXyce) +QString MOSFET_sub::spice_netlist(bool isXyce, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; diff --git a/qucs/components/mosfet_sub.h b/qucs/components/mosfet_sub.h index f5462f9d5..677b62446 100644 --- a/qucs/components/mosfet_sub.h +++ b/qucs/components/mosfet_sub.h @@ -38,7 +38,7 @@ class MOSFET_sub : public Basic_MOSFET { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/mutual.cpp b/qucs/components/mutual.cpp index 1b6edeb52..76b16eae7 100644 --- a/qucs/components/mutual.cpp +++ b/qucs/components/mutual.cpp @@ -84,7 +84,7 @@ Element* Mutual::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Mutual::spice_netlist(bool isXyce) +QString Mutual::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString l1 = "L" + Name + "_L1"; diff --git a/qucs/components/mutual.h b/qucs/components/mutual.h index 6b7a00e49..8a75b896c 100644 --- a/qucs/components/mutual.h +++ b/qucs/components/mutual.h @@ -28,7 +28,7 @@ class Mutual : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/mutual2.cpp b/qucs/components/mutual2.cpp index d18b20f25..1cb659b43 100644 --- a/qucs/components/mutual2.cpp +++ b/qucs/components/mutual2.cpp @@ -114,7 +114,7 @@ Element* Mutual2::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Mutual2::spice_netlist(bool isXyce) +QString Mutual2::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); Q_UNUSED(isXyce); diff --git a/qucs/components/mutual2.h b/qucs/components/mutual2.h index b09da1e33..1051127d1 100644 --- a/qucs/components/mutual2.h +++ b/qucs/components/mutual2.h @@ -28,7 +28,7 @@ class Mutual2 : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/mutualx.cpp b/qucs/components/mutualx.cpp index 3b5695598..e5f0480be 100644 --- a/qucs/components/mutualx.cpp +++ b/qucs/components/mutualx.cpp @@ -229,7 +229,7 @@ void MutualX::createSymbol() } } -QString MutualX::spice_netlist(bool isXyce) +QString MutualX::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); int coils = getProperty("coils")->Value.toInt(); diff --git a/qucs/components/mutualx.h b/qucs/components/mutualx.h index 4ad877ced..3beb6e7a8 100644 --- a/qucs/components/mutualx.h +++ b/qucs/components/mutualx.h @@ -35,7 +35,7 @@ class MutualX : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/opamp.cpp b/qucs/components/opamp.cpp index 4a58029bf..e3b6bc339 100644 --- a/qucs/components/opamp.cpp +++ b/qucs/components/opamp.cpp @@ -74,7 +74,7 @@ Element* OpAmp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString OpAmp::spice_netlist(bool isXyce) +QString OpAmp::spice_netlist(bool isXyce, bool) { QString in_m = Ports.at(0)->Connection->Name; if (in_m=="gnd") in_m="0"; diff --git a/qucs/components/opamp.h b/qucs/components/opamp.h index 605bcd115..dfceafeae 100644 --- a/qucs/components/opamp.h +++ b/qucs/components/opamp.h @@ -28,7 +28,7 @@ class OpAmp : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/param_sweep.cpp b/qucs/components/param_sweep.cpp index b6010da8c..8e6ef1989 100644 --- a/qucs/components/param_sweep.cpp +++ b/qucs/components/param_sweep.cpp @@ -193,7 +193,7 @@ QString Param_Sweep::getCounterVar() return s; } -QString Param_Sweep::spice_netlist(bool isXyce) +QString Param_Sweep::spice_netlist(bool isXyce, bool) { double start,stop,step,fac,points; QString unit; diff --git a/qucs/components/param_sweep.h b/qucs/components/param_sweep.h index 608964e09..0c4b02a93 100644 --- a/qucs/components/param_sweep.h +++ b/qucs/components/param_sweep.h @@ -34,7 +34,7 @@ class Param_Sweep : public qucs::component::SimulationComponent { QString getCounterVar(); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString param_split_str=";"; }; diff --git a/qucs/components/potentiometer.cpp b/qucs/components/potentiometer.cpp index 7c2a5aa5f..c26b15db0 100644 --- a/qucs/components/potentiometer.cpp +++ b/qucs/components/potentiometer.cpp @@ -111,7 +111,7 @@ void potentiometer::createSymbol() x2 = 40; y2 = 15; } -QString potentiometer::spice_netlist(bool isXyce) +QString potentiometer::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/potentiometer.h b/qucs/components/potentiometer.h index a289ac906..e6f0f642e 100644 --- a/qucs/components/potentiometer.h +++ b/qucs/components/potentiometer.h @@ -22,7 +22,7 @@ class potentiometer : public Component static Element* info(QString&, char* &, bool getNewOne=false); protected: void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif /* potentiometer_H */ diff --git a/qucs/components/relais.cpp b/qucs/components/relais.cpp index 98d3cde99..e6b40c4e9 100644 --- a/qucs/components/relais.cpp +++ b/qucs/components/relais.cpp @@ -85,7 +85,7 @@ Component* Relais::newOne() return new Relais(); } -QString Relais::spice_netlist(bool isXyce) +QString Relais::spice_netlist(bool isXyce, bool) { QString s = Name; QString unit; diff --git a/qucs/components/relais.h b/qucs/components/relais.h index 81645bcb5..3151d84af 100644 --- a/qucs/components/relais.h +++ b/qucs/components/relais.h @@ -27,7 +27,7 @@ class Relais : public Component { ~Relais(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/resistor.cpp b/qucs/components/resistor.cpp index fa477cb35..284f41c28 100644 --- a/qucs/components/resistor.cpp +++ b/qucs/components/resistor.cpp @@ -53,7 +53,7 @@ Component* Resistor::newOne() return new Resistor(Props.back()->Value != "US"); } -QString Resistor::spice_netlist(bool ) +QString Resistor::spice_netlist(bool , bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/resistor.h b/qucs/components/resistor.h index 3a143ae78..836207a4b 100644 --- a/qucs/components/resistor.h +++ b/qucs/components/resistor.h @@ -30,7 +30,7 @@ class Resistor : public MultiViewComponent { static Element* info_us(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); void createSymbol(); }; diff --git a/qucs/components/rlcg.cpp b/qucs/components/rlcg.cpp index ded850ea5..93833a95a 100644 --- a/qucs/components/rlcg.cpp +++ b/qucs/components/rlcg.cpp @@ -93,7 +93,7 @@ Element* RLCG::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString RLCG::spice_netlist(bool isXyce) +QString RLCG::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/rlcg.h b/qucs/components/rlcg.h index 1ea76d06d..fb6fdbe8f 100644 --- a/qucs/components/rlcg.h +++ b/qucs/components/rlcg.h @@ -27,7 +27,7 @@ class RLCG : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/source_ac.cpp b/qucs/components/source_ac.cpp index 913047da5..631ac23a2 100644 --- a/qucs/components/source_ac.cpp +++ b/qucs/components/source_ac.cpp @@ -159,7 +159,7 @@ QString Source_ac::xyce_netlist() return s; } -QString Source_ac::spice_netlist(bool isXyce) +QString Source_ac::spice_netlist(bool isXyce, bool) { if (isXyce) { return xyce_netlist(); diff --git a/qucs/components/source_ac.h b/qucs/components/source_ac.h index bde03b821..25ba1ec7f 100644 --- a/qucs/components/source_ac.h +++ b/qucs/components/source_ac.h @@ -30,7 +30,7 @@ class Source_ac : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString netlist(); }; diff --git a/qucs/components/sp_sim.cpp b/qucs/components/sp_sim.cpp index 0e340a6df..d705151db 100644 --- a/qucs/components/sp_sim.cpp +++ b/qucs/components/sp_sim.cpp @@ -206,7 +206,7 @@ QString SP_Sim::xyce_netlist() return s; } -QString SP_Sim::spice_netlist(bool isXyce) +QString SP_Sim::spice_netlist(bool isXyce, bool) { if (isXyce) { return xyce_netlist(); diff --git a/qucs/components/sp_sim.h b/qucs/components/sp_sim.h index 9a4ff12e1..9698de250 100644 --- a/qucs/components/sp_sim.h +++ b/qucs/components/sp_sim.h @@ -36,7 +36,7 @@ class SP_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); void recreate(Schematic*); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QStringList getExtraVariables(); }; diff --git a/qucs/components/sparamfile.cpp b/qucs/components/sparamfile.cpp index ba92265eb..81083d2fb 100644 --- a/qucs/components/sparamfile.cpp +++ b/qucs/components/sparamfile.cpp @@ -196,7 +196,7 @@ void SParamFile::createSymbol() ty = y1 - 2*metrics.lineSpacing() - 4; } -QString SParamFile::spice_netlist(bool isXyce) +QString SParamFile::spice_netlist(bool isXyce, bool) { QString s; if (isXyce) { diff --git a/qucs/components/sparamfile.h b/qucs/components/sparamfile.h index 0871535b7..254973869 100644 --- a/qucs/components/sparamfile.h +++ b/qucs/components/sparamfile.h @@ -35,7 +35,7 @@ class SParamFile : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/spicefile.cpp b/qucs/components/spicefile.cpp index ef84d255c..dc06fa7bc 100644 --- a/qucs/components/spicefile.cpp +++ b/qucs/components/spicefile.cpp @@ -479,7 +479,7 @@ void SpiceFile::slotExited() } } -QString SpiceFile::spice_netlist(bool) +QString SpiceFile::spice_netlist(bool, bool) { QStringList ports_lst = Props.at(1)->Value.split(","); for (auto & it : ports_lst) { diff --git a/qucs/components/spicefile.h b/qucs/components/spicefile.h index a117719bb..6ac26eab8 100644 --- a/qucs/components/spicefile.h +++ b/qucs/components/spicefile.h @@ -53,7 +53,7 @@ class SpiceFile : public QObject, public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); private slots: void slotGetNetlist(); diff --git a/qucs/components/subcircuit.cpp b/qucs/components/subcircuit.cpp index 1bb0e92d8..ab4c8560d 100644 --- a/qucs/components/subcircuit.cpp +++ b/qucs/components/subcircuit.cpp @@ -219,7 +219,7 @@ QString Subcircuit::netlist() { return s + '\n'; } -QString Subcircuit::spice_netlist(bool) { +QString Subcircuit::spice_netlist(bool, bool) { QString s; QString f = misc::properFileName(Props.at(0)->Value); s += spicecompat::check_refdes(Name, SpiceModel); diff --git a/qucs/components/subcircuit.h b/qucs/components/subcircuit.h index 6c1559626..91bc8e74a 100644 --- a/qucs/components/subcircuit.h +++ b/qucs/components/subcircuit.h @@ -32,7 +32,7 @@ class Subcircuit : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/subcirport.cpp b/qucs/components/subcirport.cpp index 4ce4455ce..9b0bcf5f6 100644 --- a/qucs/components/subcirport.cpp +++ b/qucs/components/subcirport.cpp @@ -108,7 +108,7 @@ QString SubCirPort::netlist() } // ------------------------------------------------------- -QString SubCirPort::spice_netlist(bool) +QString SubCirPort::spice_netlist(bool, bool) { return QString(); } diff --git a/qucs/components/subcirport.h b/qucs/components/subcirport.h index 86e577b52..f6adf78e7 100644 --- a/qucs/components/subcirport.h +++ b/qucs/components/subcirport.h @@ -30,7 +30,7 @@ class SubCirPort : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/switch.cpp b/qucs/components/switch.cpp index b14c083b7..52b02a914 100644 --- a/qucs/components/switch.cpp +++ b/qucs/components/switch.cpp @@ -84,7 +84,7 @@ QString Switch::netlist() return s + '\n'; } -QString Switch::spice_netlist(bool) +QString Switch::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QString port1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/switch.h b/qucs/components/switch.h index 322ad4327..857105087 100644 --- a/qucs/components/switch.h +++ b/qucs/components/switch.h @@ -29,7 +29,7 @@ class Switch : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString netlist(); void createSymbol(); }; diff --git a/qucs/components/tff_SR.cpp b/qucs/components/tff_SR.cpp index 6b01852e9..a54c40036 100644 --- a/qucs/components/tff_SR.cpp +++ b/qucs/components/tff_SR.cpp @@ -175,7 +175,7 @@ QString tff_SR::verilogCode( int ) return l; } -QString tff_SR::spice_netlist(bool isXyce) +QString tff_SR::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/tff_SR.h b/qucs/components/tff_SR.h index 2fc3a0823..b4da9fb53 100644 --- a/qucs/components/tff_SR.h +++ b/qucs/components/tff_SR.h @@ -24,7 +24,7 @@ class tff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif /* tff_SR_H */ diff --git a/qucs/components/tr_sim.cpp b/qucs/components/tr_sim.cpp index 92135280a..7f6c72f06 100644 --- a/qucs/components/tr_sim.cpp +++ b/qucs/components/tr_sim.cpp @@ -91,7 +91,7 @@ Element* TR_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString TR_Sim::spice_netlist(bool isXyce) +QString TR_Sim::spice_netlist(bool isXyce, bool) { QString s = SpiceModel; QString unit; diff --git a/qucs/components/tr_sim.h b/qucs/components/tr_sim.h index 58ca5e661..869394a93 100644 --- a/qucs/components/tr_sim.h +++ b/qucs/components/tr_sim.h @@ -27,7 +27,7 @@ class TR_Sim : public qucs::component::SimulationComponent { ~TR_Sim(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); void recreate(Schematic*); }; diff --git a/qucs/components/vacomponent.cpp b/qucs/components/vacomponent.cpp index 9b7c5d302..38931e7f4 100644 --- a/qucs/components/vacomponent.cpp +++ b/qucs/components/vacomponent.cpp @@ -296,7 +296,7 @@ void vacomponent::createSymbol(QJsonObject json) } -QString vacomponent::spice_netlist(bool isXyce) +QString vacomponent::spice_netlist(bool isXyce, bool) { if (isXyce) return QString(); diff --git a/qucs/components/vacomponent.h b/qucs/components/vacomponent.h index 94794c09e..9ce591163 100644 --- a/qucs/components/vacomponent.h +++ b/qucs/components/vacomponent.h @@ -41,7 +41,7 @@ class vacomponent : public Component protected: void createSymbol(QJsonObject json); void parseJson(QJsonObject json); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; diff --git a/qucs/components/vccs.cpp b/qucs/components/vccs.cpp index 341d52022..af8ca1b13 100644 --- a/qucs/components/vccs.cpp +++ b/qucs/components/vccs.cpp @@ -105,7 +105,7 @@ QString VCCS::va_code() } -QString VCCS::spice_netlist(bool) +QString VCCS::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList seq; // nodes sequence diff --git a/qucs/components/vccs.h b/qucs/components/vccs.h index 4b62d780f..378a19bd7 100644 --- a/qucs/components/vccs.h +++ b/qucs/components/vccs.h @@ -29,7 +29,7 @@ class VCCS : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/vcresistor.cpp b/qucs/components/vcresistor.cpp index af236c06e..87e7ca15e 100644 --- a/qucs/components/vcresistor.cpp +++ b/qucs/components/vcresistor.cpp @@ -109,7 +109,7 @@ QString vcresistor::netlist() return s; } -QString vcresistor::spice_netlist(bool isXyce) +QString vcresistor::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s; diff --git a/qucs/components/vcresistor.h b/qucs/components/vcresistor.h index 33c813c8c..ff7e50c0f 100644 --- a/qucs/components/vcresistor.h +++ b/qucs/components/vcresistor.h @@ -29,7 +29,7 @@ class vcresistor : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/vcvs.cpp b/qucs/components/vcvs.cpp index 1d492a41f..31c80d9f2 100644 --- a/qucs/components/vcvs.cpp +++ b/qucs/components/vcvs.cpp @@ -105,7 +105,7 @@ QString VCVS::va_code() return s; } -QString VCVS::spice_netlist(bool) +QString VCVS::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList seq; // nodes sequence diff --git a/qucs/components/vcvs.h b/qucs/components/vcvs.h index 448d2e539..34a13188b 100644 --- a/qucs/components/vcvs.h +++ b/qucs/components/vcvs.h @@ -29,7 +29,7 @@ class VCVS : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/vexp.cpp b/qucs/components/vexp.cpp index 97635c5dd..772c75138 100644 --- a/qucs/components/vexp.cpp +++ b/qucs/components/vexp.cpp @@ -86,7 +86,7 @@ Element* vExp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString vExp::spice_netlist(bool) +QString vExp::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/components/vexp.h b/qucs/components/vexp.h index 61e99eaca..a19da1eea 100644 --- a/qucs/components/vexp.h +++ b/qucs/components/vexp.h @@ -31,7 +31,7 @@ class vExp : public Component { ~vExp(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/vfile.cpp b/qucs/components/vfile.cpp index e91276bda..bb6ba4bbc 100644 --- a/qucs/components/vfile.cpp +++ b/qucs/components/vfile.cpp @@ -112,7 +112,7 @@ QString vFile::netlist() return s + "\n"; } -QString vFile::spice_netlist(bool isXyce) +QString vFile::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); QString s = SpiceModel + Name; diff --git a/qucs/components/vfile.h b/qucs/components/vfile.h index a1afa850d..91810089c 100644 --- a/qucs/components/vfile.h +++ b/qucs/components/vfile.h @@ -32,7 +32,7 @@ class vFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/volt_ac.cpp b/qucs/components/volt_ac.cpp index 19537692f..e0886124c 100644 --- a/qucs/components/volt_ac.cpp +++ b/qucs/components/volt_ac.cpp @@ -83,7 +83,7 @@ Element* Volt_ac::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Volt_ac::spice_netlist(bool) +QString Volt_ac::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/components/volt_ac.h b/qucs/components/volt_ac.h index b6250b024..10f662cf8 100644 --- a/qucs/components/volt_ac.h +++ b/qucs/components/volt_ac.h @@ -29,7 +29,7 @@ class Volt_ac : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString netlist(); }; diff --git a/qucs/components/volt_dc.cpp b/qucs/components/volt_dc.cpp index c8a84f7a1..d9d961d4f 100644 --- a/qucs/components/volt_dc.cpp +++ b/qucs/components/volt_dc.cpp @@ -59,7 +59,7 @@ Component* Volt_dc::newOne() return new Volt_dc(); } -QString Volt_dc::spice_netlist(bool) +QString Volt_dc::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/components/volt_dc.h b/qucs/components/volt_dc.h index 0a923990f..956ca68d5 100644 --- a/qucs/components/volt_dc.h +++ b/qucs/components/volt_dc.h @@ -27,7 +27,7 @@ class Volt_dc : public Component { ~Volt_dc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/vprobe.cpp b/qucs/components/vprobe.cpp index 70e977613..4d7c5dc7a 100644 --- a/qucs/components/vprobe.cpp +++ b/qucs/components/vprobe.cpp @@ -78,7 +78,7 @@ QString vProbe::getProbeVariable(bool) return Name; } -QString vProbe::spice_netlist(bool) +QString vProbe::spice_netlist(bool, bool) { QString s = QStringLiteral("E%1 %2 0 %3 %4 1.0\nR%1%2 %2 0 1E8\nR%1%3 %3 %4 1E8\n").arg(Name).arg(Name) .arg(Ports.at(0)->Connection->Name).arg(Ports.at(1)->Connection->Name); diff --git a/qucs/components/vprobe.h b/qucs/components/vprobe.h index be29ba5af..dd06826f9 100644 --- a/qucs/components/vprobe.h +++ b/qucs/components/vprobe.h @@ -29,7 +29,7 @@ class vProbe : public Component { static Element* info(QString&, char* &, bool getNewOne=false); QString getProbeVariable(bool isXyce = false); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; #endif diff --git a/qucs/components/vpulse.cpp b/qucs/components/vpulse.cpp index a794bd158..e707e22d9 100644 --- a/qucs/components/vpulse.cpp +++ b/qucs/components/vpulse.cpp @@ -73,7 +73,7 @@ vPulse::~vPulse() { } -QString vPulse::spice_netlist(bool) +QString vPulse::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/vpulse.h b/qucs/components/vpulse.h index fa8cb5cd3..1ecd4ecf7 100644 --- a/qucs/components/vpulse.h +++ b/qucs/components/vpulse.h @@ -30,7 +30,7 @@ class vPulse : public Component { ~vPulse(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/vrect.cpp b/qucs/components/vrect.cpp index 7bfb86105..5ec12728d 100644 --- a/qucs/components/vrect.cpp +++ b/qucs/components/vrect.cpp @@ -74,7 +74,7 @@ vRect::~vRect() { } -QString vRect::spice_netlist(bool) +QString vRect::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/components/vrect.h b/qucs/components/vrect.h index 5d8aa7a3c..cf907080d 100644 --- a/qucs/components/vrect.h +++ b/qucs/components/vrect.h @@ -29,7 +29,7 @@ class vRect : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString netlist(); }; From 47af743871d43a35ea8654cc73961f1f55a9fb0d Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Mon, 16 Dec 2024 12:50:47 +0100 Subject: [PATCH 02/10] New feature CDL netlist export -introduced new parameter for cdl-type netlist export to Component::spice_netlist derivatives under spicecomponents/ Signed-off-by: ThomasZecha --- qucs/spicecomponents/BJT_SPICE.cpp | 2 +- qucs/spicecomponents/BJT_SPICE.h | 2 +- qucs/spicecomponents/C_SPICE.cpp | 2 +- qucs/spicecomponents/C_SPICE.h | 2 +- qucs/spicecomponents/DIODE_SPICE.cpp | 2 +- qucs/spicecomponents/DIODE_SPICE.h | 2 +- qucs/spicecomponents/Icouple.cpp | 2 +- qucs/spicecomponents/Icouple.h | 2 +- qucs/spicecomponents/K_SPICE.cpp | 2 +- qucs/spicecomponents/K_SPICE.h | 2 +- qucs/spicecomponents/LTL_SPICE.cpp | 2 +- qucs/spicecomponents/LTL_SPICE.h | 2 +- qucs/spicecomponents/LTRA_SPICE.cpp | 2 +- qucs/spicecomponents/LTRA_SPICE.h | 2 +- qucs/spicecomponents/L_SPICE.cpp | 2 +- qucs/spicecomponents/L_SPICE.h | 2 +- qucs/spicecomponents/MESFET_SPICE.cpp | 2 +- qucs/spicecomponents/MESFET_SPICE.h | 2 +- qucs/spicecomponents/MOS_SPICE.cpp | 2 +- qucs/spicecomponents/MOS_SPICE.h | 2 +- qucs/spicecomponents/NJF_SPICE.cpp | 2 +- qucs/spicecomponents/NJF_SPICE.h | 2 +- qucs/spicecomponents/NMOS_SPICE.cpp | 2 +- qucs/spicecomponents/NMOS_SPICE.h | 2 +- qucs/spicecomponents/NPN_SPICE.cpp | 2 +- qucs/spicecomponents/NPN_SPICE.h | 2 +- qucs/spicecomponents/PJF_SPICE.cpp | 2 +- qucs/spicecomponents/PJF_SPICE.h | 2 +- qucs/spicecomponents/PMF_MESFET_SPICE.cpp | 2 +- qucs/spicecomponents/PMF_MESFET_SPICE.h | 2 +- qucs/spicecomponents/PMOS_SPICE.cpp | 2 +- qucs/spicecomponents/PMOS_SPICE.h | 2 +- qucs/spicecomponents/PNP_SPICE.cpp | 2 +- qucs/spicecomponents/PNP_SPICE.h | 2 +- qucs/spicecomponents/R_SPICE.cpp | 2 +- qucs/spicecomponents/R_SPICE.h | 2 +- qucs/spicecomponents/S4Q_I.cpp | 2 +- qucs/spicecomponents/S4Q_I.h | 2 +- qucs/spicecomponents/S4Q_Ieqndef.cpp | 2 +- qucs/spicecomponents/S4Q_Ieqndef.h | 2 +- qucs/spicecomponents/S4Q_S.cpp | 2 +- qucs/spicecomponents/S4Q_S.h | 2 +- qucs/spicecomponents/S4Q_V.cpp | 2 +- qucs/spicecomponents/S4Q_V.h | 2 +- qucs/spicecomponents/S4Q_W.cpp | 2 +- qucs/spicecomponents/S4Q_W.h | 2 +- qucs/spicecomponents/SDTF.cpp | 2 +- qucs/spicecomponents/SDTF.h | 2 +- qucs/spicecomponents/UDRCTL_SPICE.cpp | 2 +- qucs/spicecomponents/UDRCTL_SPICE.h | 2 +- qucs/spicecomponents/XAPWL.cpp | 2 +- qucs/spicecomponents/XAPWL.h | 2 +- qucs/spicecomponents/core.cpp | 2 +- qucs/spicecomponents/core.h | 2 +- qucs/spicecomponents/eNL.cpp | 2 +- qucs/spicecomponents/eNL.h | 2 +- qucs/spicecomponents/gNL.cpp | 2 +- qucs/spicecomponents/gNL.h | 2 +- qucs/spicecomponents/iAmpMod.cpp | 2 +- qucs/spicecomponents/iAmpMod.h | 2 +- qucs/spicecomponents/iPWL.cpp | 2 +- qucs/spicecomponents/iPWL.h | 2 +- qucs/spicecomponents/iTRNOISE.cpp | 2 +- qucs/spicecomponents/iTRNOISE.h | 2 +- qucs/spicecomponents/isffm.cpp | 2 +- qucs/spicecomponents/isffm.h | 2 +- qucs/spicecomponents/sp_customsim.cpp | 2 +- qucs/spicecomponents/sp_customsim.h | 2 +- qucs/spicecomponents/sp_disto.cpp | 2 +- qucs/spicecomponents/sp_disto.h | 2 +- qucs/spicecomponents/sp_fourier.cpp | 2 +- qucs/spicecomponents/sp_fourier.h | 2 +- qucs/spicecomponents/sp_noise.cpp | 2 +- qucs/spicecomponents/sp_noise.h | 2 +- qucs/spicecomponents/sp_pz.cpp | 2 +- qucs/spicecomponents/sp_pz.h | 2 +- qucs/spicecomponents/sp_sens.cpp | 2 +- qucs/spicecomponents/sp_sens.h | 2 +- qucs/spicecomponents/sp_sens_ac.cpp | 2 +- qucs/spicecomponents/sp_sens_ac.h | 2 +- qucs/spicecomponents/sp_sens_tr_xyce.cpp | 2 +- qucs/spicecomponents/sp_sens_tr_xyce.h | 2 +- qucs/spicecomponents/sp_sens_xyce.cpp | 2 +- qucs/spicecomponents/sp_sens_xyce.h | 2 +- qucs/spicecomponents/sp_spectrum.cpp | 2 +- qucs/spicecomponents/sp_spectrum.h | 2 +- qucs/spicecomponents/spicegeneric.cpp | 2 +- qucs/spicecomponents/spicegeneric.h | 2 +- qucs/spicecomponents/spicelibcomp.cpp | 2 +- qucs/spicecomponents/spicelibcomp.h | 2 +- qucs/spicecomponents/src_eqndef.cpp | 2 +- qucs/spicecomponents/src_eqndef.h | 2 +- qucs/spicecomponents/vAmpMod.cpp | 2 +- qucs/spicecomponents/vAmpMod.h | 2 +- qucs/spicecomponents/vPWL.cpp | 2 +- qucs/spicecomponents/vPWL.h | 2 +- qucs/spicecomponents/vTRNOISE.cpp | 2 +- qucs/spicecomponents/vTRNOISE.h | 2 +- qucs/spicecomponents/vTRRANDOM.cpp | 2 +- qucs/spicecomponents/vTRRANDOM.h | 2 +- qucs/spicecomponents/volt_ac_SPICE.cpp | 2 +- qucs/spicecomponents/volt_ac_SPICE.h | 2 +- qucs/spicecomponents/vsffm.cpp | 2 +- qucs/spicecomponents/vsffm.h | 2 +- qucs/spicecomponents/xsp_cmlib.cpp | 2 +- qucs/spicecomponents/xsp_cmlib.h | 2 +- qucs/spicecomponents/xsp_codemodel.cpp | 2 +- qucs/spicecomponents/xsp_codemodel.h | 2 +- qucs/spicecomponents/xspicegeneric.cpp | 2 +- qucs/spicecomponents/xspicegeneric.h | 2 +- qucs/spicecomponents/xyce_script.cpp | 2 +- qucs/spicecomponents/xyce_script.h | 2 +- 112 files changed, 112 insertions(+), 112 deletions(-) diff --git a/qucs/spicecomponents/BJT_SPICE.cpp b/qucs/spicecomponents/BJT_SPICE.cpp index 68fda672c..34a21acd7 100644 --- a/qucs/spicecomponents/BJT_SPICE.cpp +++ b/qucs/spicecomponents/BJT_SPICE.cpp @@ -186,7 +186,7 @@ QString BJT_SPICE::netlist() return QString(); } -QString BJT_SPICE::spice_netlist(bool) +QString BJT_SPICE::spice_netlist(bool, bool) { QString ltr =getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); diff --git a/qucs/spicecomponents/BJT_SPICE.h b/qucs/spicecomponents/BJT_SPICE.h index 175a125e1..100b75f4f 100644 --- a/qucs/spicecomponents/BJT_SPICE.h +++ b/qucs/spicecomponents/BJT_SPICE.h @@ -36,7 +36,7 @@ class BJT_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // NPN_SPICE_H diff --git a/qucs/spicecomponents/C_SPICE.cpp b/qucs/spicecomponents/C_SPICE.cpp index c4d3f3c01..a27719d2f 100644 --- a/qucs/spicecomponents/C_SPICE.cpp +++ b/qucs/spicecomponents/C_SPICE.cpp @@ -109,7 +109,7 @@ QString C_SPICE::netlist() return QString(); } -QString C_SPICE::spice_netlist(bool) +QString C_SPICE::spice_netlist(bool, bool) { QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); diff --git a/qucs/spicecomponents/C_SPICE.h b/qucs/spicecomponents/C_SPICE.h index 20ae3f6fb..8987f2cff 100644 --- a/qucs/spicecomponents/C_SPICE.h +++ b/qucs/spicecomponents/C_SPICE.h @@ -33,7 +33,7 @@ class C_SPICE: public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // C_SPICE_H diff --git a/qucs/spicecomponents/DIODE_SPICE.cpp b/qucs/spicecomponents/DIODE_SPICE.cpp index 745d65d01..eb217501e 100644 --- a/qucs/spicecomponents/DIODE_SPICE.cpp +++ b/qucs/spicecomponents/DIODE_SPICE.cpp @@ -114,7 +114,7 @@ QString DIODE_SPICE::netlist() return QString(); } -QString DIODE_SPICE::spice_netlist(bool) +QString DIODE_SPICE::spice_netlist(bool, bool) { QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); diff --git a/qucs/spicecomponents/DIODE_SPICE.h b/qucs/spicecomponents/DIODE_SPICE.h index b8b9af6f2..241fa670f 100644 --- a/qucs/spicecomponents/DIODE_SPICE.h +++ b/qucs/spicecomponents/DIODE_SPICE.h @@ -33,7 +33,7 @@ class DIODE_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // DIODE_SPICE_H diff --git a/qucs/spicecomponents/Icouple.cpp b/qucs/spicecomponents/Icouple.cpp index 68a0f49d6..bec8d5b26 100644 --- a/qucs/spicecomponents/Icouple.cpp +++ b/qucs/spicecomponents/Icouple.cpp @@ -100,7 +100,7 @@ QString Icouple::netlist() return QString(); } -QString Icouple::spice_netlist(bool) +QString Icouple::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/Icouple.h b/qucs/spicecomponents/Icouple.h index ed4411573..e27c8d5d5 100644 --- a/qucs/spicecomponents/Icouple.h +++ b/qucs/spicecomponents/Icouple.h @@ -31,7 +31,7 @@ class Icouple: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // Icouple diff --git a/qucs/spicecomponents/K_SPICE.cpp b/qucs/spicecomponents/K_SPICE.cpp index d07e71cb9..7fd941220 100644 --- a/qucs/spicecomponents/K_SPICE.cpp +++ b/qucs/spicecomponents/K_SPICE.cpp @@ -75,7 +75,7 @@ QString K_SPICE::netlist() return QString(); } -QString K_SPICE::spice_netlist(bool) +QString K_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/K_SPICE.h b/qucs/spicecomponents/K_SPICE.h index 51ce27f44..693ead557 100644 --- a/qucs/spicecomponents/K_SPICE.h +++ b/qucs/spicecomponents/K_SPICE.h @@ -31,7 +31,7 @@ class K_SPICE: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // K_SPICE_H diff --git a/qucs/spicecomponents/LTL_SPICE.cpp b/qucs/spicecomponents/LTL_SPICE.cpp index 77ea1842f..d3a5ed82b 100644 --- a/qucs/spicecomponents/LTL_SPICE.cpp +++ b/qucs/spicecomponents/LTL_SPICE.cpp @@ -88,7 +88,7 @@ QString LTL_SPICE::netlist() return QString(); } -QString LTL_SPICE::spice_netlist(bool) +QString LTL_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/LTL_SPICE.h b/qucs/spicecomponents/LTL_SPICE.h index 23cb9026c..5d23f37a8 100644 --- a/qucs/spicecomponents/LTL_SPICE.h +++ b/qucs/spicecomponents/LTL_SPICE.h @@ -29,7 +29,7 @@ class LTL_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // LTL_SPICE_H diff --git a/qucs/spicecomponents/LTRA_SPICE.cpp b/qucs/spicecomponents/LTRA_SPICE.cpp index e0e9b7137..b4d264d2b 100644 --- a/qucs/spicecomponents/LTRA_SPICE.cpp +++ b/qucs/spicecomponents/LTRA_SPICE.cpp @@ -94,7 +94,7 @@ QString LTRA_SPICE::netlist() return QString(); } -QString LTRA_SPICE::spice_netlist(bool) +QString LTRA_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/LTRA_SPICE.h b/qucs/spicecomponents/LTRA_SPICE.h index 2007c0fd8..81ef706c9 100644 --- a/qucs/spicecomponents/LTRA_SPICE.h +++ b/qucs/spicecomponents/LTRA_SPICE.h @@ -29,7 +29,7 @@ class LTRA_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // LTRA_SPICE_H diff --git a/qucs/spicecomponents/L_SPICE.cpp b/qucs/spicecomponents/L_SPICE.cpp index 6534d3ac3..27471cb30 100644 --- a/qucs/spicecomponents/L_SPICE.cpp +++ b/qucs/spicecomponents/L_SPICE.cpp @@ -83,7 +83,7 @@ QString L_SPICE::netlist() return QString(); } -QString L_SPICE::spice_netlist(bool) +QString L_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/L_SPICE.h b/qucs/spicecomponents/L_SPICE.h index 6400a13c0..596cc6acd 100644 --- a/qucs/spicecomponents/L_SPICE.h +++ b/qucs/spicecomponents/L_SPICE.h @@ -31,7 +31,7 @@ class L_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // L_SPICE_H diff --git a/qucs/spicecomponents/MESFET_SPICE.cpp b/qucs/spicecomponents/MESFET_SPICE.cpp index 207dc38b1..ae329ce61 100644 --- a/qucs/spicecomponents/MESFET_SPICE.cpp +++ b/qucs/spicecomponents/MESFET_SPICE.cpp @@ -86,7 +86,7 @@ QString MESFET_SPICE::netlist() return QString(); } -QString MESFET_SPICE::spice_netlist(bool) +QString MESFET_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/MESFET_SPICE.h b/qucs/spicecomponents/MESFET_SPICE.h index 1781583de..ef6df0778 100644 --- a/qucs/spicecomponents/MESFET_SPICE.h +++ b/qucs/spicecomponents/MESFET_SPICE.h @@ -31,7 +31,7 @@ class MESFET_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // MESFET_SPICE_H diff --git a/qucs/spicecomponents/MOS_SPICE.cpp b/qucs/spicecomponents/MOS_SPICE.cpp index a32f4db95..104ab7270 100644 --- a/qucs/spicecomponents/MOS_SPICE.cpp +++ b/qucs/spicecomponents/MOS_SPICE.cpp @@ -225,7 +225,7 @@ void MOS_SPICE::createSymbol() x2 = 4; y2 = 30; } -QString MOS_SPICE::spice_netlist(bool) +QString MOS_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,Props.at(0)->Value); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/MOS_SPICE.h b/qucs/spicecomponents/MOS_SPICE.h index f3ed82cb8..1f876ce77 100644 --- a/qucs/spicecomponents/MOS_SPICE.h +++ b/qucs/spicecomponents/MOS_SPICE.h @@ -38,7 +38,7 @@ class MOS_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // MOS_SPICE_H diff --git a/qucs/spicecomponents/NJF_SPICE.cpp b/qucs/spicecomponents/NJF_SPICE.cpp index 70cf26db8..b26d4a7b6 100644 --- a/qucs/spicecomponents/NJF_SPICE.cpp +++ b/qucs/spicecomponents/NJF_SPICE.cpp @@ -93,7 +93,7 @@ QString NJF_SPICE::netlist() return QString(); } -QString NJF_SPICE::spice_netlist(bool) +QString NJF_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/NJF_SPICE.h b/qucs/spicecomponents/NJF_SPICE.h index e907933cf..08d79f17a 100644 --- a/qucs/spicecomponents/NJF_SPICE.h +++ b/qucs/spicecomponents/NJF_SPICE.h @@ -31,7 +31,7 @@ class NJF_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // NJF_SPICE_H diff --git a/qucs/spicecomponents/NMOS_SPICE.cpp b/qucs/spicecomponents/NMOS_SPICE.cpp index 302c86dad..c9122279d 100644 --- a/qucs/spicecomponents/NMOS_SPICE.cpp +++ b/qucs/spicecomponents/NMOS_SPICE.cpp @@ -102,7 +102,7 @@ QString NMOS_SPICE::netlist() return QString(); } -QString NMOS_SPICE::spice_netlist(bool) +QString NMOS_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/NMOS_SPICE.h b/qucs/spicecomponents/NMOS_SPICE.h index 745470a4a..2f21aea9c 100644 --- a/qucs/spicecomponents/NMOS_SPICE.h +++ b/qucs/spicecomponents/NMOS_SPICE.h @@ -31,7 +31,7 @@ class NMOS_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // NMOS_SPICE_H diff --git a/qucs/spicecomponents/NPN_SPICE.cpp b/qucs/spicecomponents/NPN_SPICE.cpp index d2dea4ff3..35dd2dca4 100644 --- a/qucs/spicecomponents/NPN_SPICE.cpp +++ b/qucs/spicecomponents/NPN_SPICE.cpp @@ -94,7 +94,7 @@ QString NPN_SPICE::netlist() return QString(); } -QString NPN_SPICE::spice_netlist(bool) +QString NPN_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/NPN_SPICE.h b/qucs/spicecomponents/NPN_SPICE.h index 19b6c8631..97753463a 100644 --- a/qucs/spicecomponents/NPN_SPICE.h +++ b/qucs/spicecomponents/NPN_SPICE.h @@ -31,7 +31,7 @@ class NPN_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // NPN_SPICE_H diff --git a/qucs/spicecomponents/PJF_SPICE.cpp b/qucs/spicecomponents/PJF_SPICE.cpp index 631258300..1e71b65c3 100644 --- a/qucs/spicecomponents/PJF_SPICE.cpp +++ b/qucs/spicecomponents/PJF_SPICE.cpp @@ -93,7 +93,7 @@ QString PJF_SPICE::netlist() return QString(); } -QString PJF_SPICE::spice_netlist(bool) +QString PJF_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/PJF_SPICE.h b/qucs/spicecomponents/PJF_SPICE.h index 327667a0c..6a12dfe34 100644 --- a/qucs/spicecomponents/PJF_SPICE.h +++ b/qucs/spicecomponents/PJF_SPICE.h @@ -31,7 +31,7 @@ class PJF_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // PJF_SPICE_H diff --git a/qucs/spicecomponents/PMF_MESFET_SPICE.cpp b/qucs/spicecomponents/PMF_MESFET_SPICE.cpp index 199975c91..99b7ba490 100644 --- a/qucs/spicecomponents/PMF_MESFET_SPICE.cpp +++ b/qucs/spicecomponents/PMF_MESFET_SPICE.cpp @@ -86,7 +86,7 @@ QString PMF_MESFET_SPICE::netlist() return QString(); } -QString PMF_MESFET_SPICE::spice_netlist(bool) +QString PMF_MESFET_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/PMF_MESFET_SPICE.h b/qucs/spicecomponents/PMF_MESFET_SPICE.h index eab184b00..b6141b074 100644 --- a/qucs/spicecomponents/PMF_MESFET_SPICE.h +++ b/qucs/spicecomponents/PMF_MESFET_SPICE.h @@ -31,7 +31,7 @@ class PMF_MESFET_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // PMF_MESFET_SPICE_H diff --git a/qucs/spicecomponents/PMOS_SPICE.cpp b/qucs/spicecomponents/PMOS_SPICE.cpp index 039d4928f..45fb9d4e3 100644 --- a/qucs/spicecomponents/PMOS_SPICE.cpp +++ b/qucs/spicecomponents/PMOS_SPICE.cpp @@ -102,7 +102,7 @@ QString PMOS_SPICE::netlist() return QString(); } -QString PMOS_SPICE::spice_netlist(bool) +QString PMOS_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/PMOS_SPICE.h b/qucs/spicecomponents/PMOS_SPICE.h index 776dfce25..ecebffd97 100644 --- a/qucs/spicecomponents/PMOS_SPICE.h +++ b/qucs/spicecomponents/PMOS_SPICE.h @@ -31,7 +31,7 @@ class PMOS_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // PMOS_SPICE_H diff --git a/qucs/spicecomponents/PNP_SPICE.cpp b/qucs/spicecomponents/PNP_SPICE.cpp index 01ac56cdc..e09ad409d 100644 --- a/qucs/spicecomponents/PNP_SPICE.cpp +++ b/qucs/spicecomponents/PNP_SPICE.cpp @@ -95,7 +95,7 @@ QString PNP_SPICE::netlist() return QString(); } -QString PNP_SPICE::spice_netlist(bool) +QString PNP_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/PNP_SPICE.h b/qucs/spicecomponents/PNP_SPICE.h index 752cab2b0..c7ba159cf 100644 --- a/qucs/spicecomponents/PNP_SPICE.h +++ b/qucs/spicecomponents/PNP_SPICE.h @@ -31,7 +31,7 @@ class PNP_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // PNP_SPICE_H diff --git a/qucs/spicecomponents/R_SPICE.cpp b/qucs/spicecomponents/R_SPICE.cpp index 18be43c83..5a9db9f85 100644 --- a/qucs/spicecomponents/R_SPICE.cpp +++ b/qucs/spicecomponents/R_SPICE.cpp @@ -113,7 +113,7 @@ QString R_SPICE::netlist() return QString(); } -QString R_SPICE::spice_netlist(bool) +QString R_SPICE::spice_netlist(bool, bool) { QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); diff --git a/qucs/spicecomponents/R_SPICE.h b/qucs/spicecomponents/R_SPICE.h index 1ad0538c3..cbca99def 100644 --- a/qucs/spicecomponents/R_SPICE.h +++ b/qucs/spicecomponents/R_SPICE.h @@ -33,7 +33,7 @@ class R_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // R_SPICE_H diff --git a/qucs/spicecomponents/S4Q_I.cpp b/qucs/spicecomponents/S4Q_I.cpp index 3d8f75173..b8dfa96f5 100644 --- a/qucs/spicecomponents/S4Q_I.cpp +++ b/qucs/spicecomponents/S4Q_I.cpp @@ -77,7 +77,7 @@ Element* S4Q_I::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_I::spice_netlist(bool) +QString S4Q_I::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/S4Q_I.h b/qucs/spicecomponents/S4Q_I.h index 6204faf39..06f5a5373 100644 --- a/qucs/spicecomponents/S4Q_I.h +++ b/qucs/spicecomponents/S4Q_I.h @@ -32,7 +32,7 @@ class S4Q_I : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/S4Q_Ieqndef.cpp b/qucs/spicecomponents/S4Q_Ieqndef.cpp index 0ca34c716..1d2888286 100644 --- a/qucs/spicecomponents/S4Q_Ieqndef.cpp +++ b/qucs/spicecomponents/S4Q_Ieqndef.cpp @@ -86,7 +86,7 @@ QString S4Q_Ieqndef::netlist() return QString(); } -QString S4Q_Ieqndef::spice_netlist(bool) +QString S4Q_Ieqndef::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/S4Q_Ieqndef.h b/qucs/spicecomponents/S4Q_Ieqndef.h index 4bbf23d7d..9a92b1d71 100644 --- a/qucs/spicecomponents/S4Q_Ieqndef.h +++ b/qucs/spicecomponents/S4Q_Ieqndef.h @@ -11,7 +11,7 @@ class S4Q_Ieqndef : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/spicecomponents/S4Q_S.cpp b/qucs/spicecomponents/S4Q_S.cpp index f3228cc59..44050a2fc 100644 --- a/qucs/spicecomponents/S4Q_S.cpp +++ b/qucs/spicecomponents/S4Q_S.cpp @@ -93,7 +93,7 @@ Element* S4Q_S::info(QString& Name, char* &BitmapFile, bool getNewOne) // return QString(); //} -QString S4Q_S::spice_netlist(bool) +QString S4Q_S::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/S4Q_S.h b/qucs/spicecomponents/S4Q_S.h index 350afe38b..20bc3ecfd 100644 --- a/qucs/spicecomponents/S4Q_S.h +++ b/qucs/spicecomponents/S4Q_S.h @@ -32,7 +32,7 @@ class S4Q_S : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/S4Q_V.cpp b/qucs/spicecomponents/S4Q_V.cpp index 2ac060747..4c0a43346 100644 --- a/qucs/spicecomponents/S4Q_V.cpp +++ b/qucs/spicecomponents/S4Q_V.cpp @@ -77,7 +77,7 @@ Element* S4Q_V::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_V::spice_netlist(bool) +QString S4Q_V::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/S4Q_V.h b/qucs/spicecomponents/S4Q_V.h index 2c705eecf..89fb04e3a 100644 --- a/qucs/spicecomponents/S4Q_V.h +++ b/qucs/spicecomponents/S4Q_V.h @@ -32,7 +32,7 @@ class S4Q_V : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/S4Q_W.cpp b/qucs/spicecomponents/S4Q_W.cpp index 2b99a77f1..c170babff 100644 --- a/qucs/spicecomponents/S4Q_W.cpp +++ b/qucs/spicecomponents/S4Q_W.cpp @@ -81,7 +81,7 @@ Element* S4Q_W::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_W::spice_netlist(bool) +QString S4Q_W::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/S4Q_W.h b/qucs/spicecomponents/S4Q_W.h index 7c49d767c..409e07332 100644 --- a/qucs/spicecomponents/S4Q_W.h +++ b/qucs/spicecomponents/S4Q_W.h @@ -32,7 +32,7 @@ class S4Q_W : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/SDTF.cpp b/qucs/spicecomponents/SDTF.cpp index 941099596..7b14c1a4f 100644 --- a/qucs/spicecomponents/SDTF.cpp +++ b/qucs/spicecomponents/SDTF.cpp @@ -83,7 +83,7 @@ QString SDTF::netlist() return QString(); } -QString SDTF::spice_netlist(bool) +QString SDTF::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/SDTF.h b/qucs/spicecomponents/SDTF.h index 14f161ce5..ccdf98df0 100644 --- a/qucs/spicecomponents/SDTF.h +++ b/qucs/spicecomponents/SDTF.h @@ -31,7 +31,7 @@ class SDTF: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // SDTF_H diff --git a/qucs/spicecomponents/UDRCTL_SPICE.cpp b/qucs/spicecomponents/UDRCTL_SPICE.cpp index 49eccd857..86dedbbbe 100644 --- a/qucs/spicecomponents/UDRCTL_SPICE.cpp +++ b/qucs/spicecomponents/UDRCTL_SPICE.cpp @@ -92,7 +92,7 @@ QString UDRCTL_SPICE::netlist() return QString(); } -QString UDRCTL_SPICE::spice_netlist(bool) +QString UDRCTL_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/UDRCTL_SPICE.h b/qucs/spicecomponents/UDRCTL_SPICE.h index 0aa6ba649..98f4fd894 100644 --- a/qucs/spicecomponents/UDRCTL_SPICE.h +++ b/qucs/spicecomponents/UDRCTL_SPICE.h @@ -22,7 +22,7 @@ class UDRCTL_SPICE : public Component { protected: // void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif /* UDRCTL_SPICE_H */ diff --git a/qucs/spicecomponents/XAPWL.cpp b/qucs/spicecomponents/XAPWL.cpp index bb346f2b1..7c846b52d 100644 --- a/qucs/spicecomponents/XAPWL.cpp +++ b/qucs/spicecomponents/XAPWL.cpp @@ -83,7 +83,7 @@ QString XAPWL::netlist() return QString(); } -QString XAPWL::spice_netlist(bool) +QString XAPWL::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/XAPWL.h b/qucs/spicecomponents/XAPWL.h index 8247b6e02..abdaa12a2 100644 --- a/qucs/spicecomponents/XAPWL.h +++ b/qucs/spicecomponents/XAPWL.h @@ -31,7 +31,7 @@ class XAPWL: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // XAPWL_H diff --git a/qucs/spicecomponents/core.cpp b/qucs/spicecomponents/core.cpp index 6b09b29fe..d68f07adb 100644 --- a/qucs/spicecomponents/core.cpp +++ b/qucs/spicecomponents/core.cpp @@ -90,7 +90,7 @@ QString core::netlist() return QString(); } -QString core::spice_netlist(bool) +QString core::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/core.h b/qucs/spicecomponents/core.h index 97ad0403c..eff6996d1 100644 --- a/qucs/spicecomponents/core.h +++ b/qucs/spicecomponents/core.h @@ -31,7 +31,7 @@ class core: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // core_H diff --git a/qucs/spicecomponents/eNL.cpp b/qucs/spicecomponents/eNL.cpp index b4e20db58..949341b16 100644 --- a/qucs/spicecomponents/eNL.cpp +++ b/qucs/spicecomponents/eNL.cpp @@ -82,7 +82,7 @@ QString eNL::netlist() return QString(); } -QString eNL::spice_netlist(bool) +QString eNL::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/eNL.h b/qucs/spicecomponents/eNL.h index c5ec36592..b805c4149 100644 --- a/qucs/spicecomponents/eNL.h +++ b/qucs/spicecomponents/eNL.h @@ -28,7 +28,7 @@ class eNL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // ENL_H diff --git a/qucs/spicecomponents/gNL.cpp b/qucs/spicecomponents/gNL.cpp index 668ab2826..e84f7aacb 100644 --- a/qucs/spicecomponents/gNL.cpp +++ b/qucs/spicecomponents/gNL.cpp @@ -81,7 +81,7 @@ QString gNL::netlist() return QString(); } -QString gNL::spice_netlist(bool) +QString gNL::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/gNL.h b/qucs/spicecomponents/gNL.h index 1b8f2a794..56c2118a7 100644 --- a/qucs/spicecomponents/gNL.h +++ b/qucs/spicecomponents/gNL.h @@ -28,7 +28,7 @@ class gNL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // GNL_H diff --git a/qucs/spicecomponents/iAmpMod.cpp b/qucs/spicecomponents/iAmpMod.cpp index 25b2d4a5f..07d34049b 100644 --- a/qucs/spicecomponents/iAmpMod.cpp +++ b/qucs/spicecomponents/iAmpMod.cpp @@ -89,7 +89,7 @@ QString iAmpMod::netlist() return QString(); } -QString iAmpMod::spice_netlist(bool) +QString iAmpMod::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/iAmpMod.h b/qucs/spicecomponents/iAmpMod.h index eb4b38649..4f0ff819b 100644 --- a/qucs/spicecomponents/iAmpMod.h +++ b/qucs/spicecomponents/iAmpMod.h @@ -31,7 +31,7 @@ class iAmpMod : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // IAMPMOD_H diff --git a/qucs/spicecomponents/iPWL.cpp b/qucs/spicecomponents/iPWL.cpp index a808c8725..6c58b3926 100644 --- a/qucs/spicecomponents/iPWL.cpp +++ b/qucs/spicecomponents/iPWL.cpp @@ -90,7 +90,7 @@ QString iPWL::netlist() return QString(); } -QString iPWL::spice_netlist(bool) +QString iPWL::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/iPWL.h b/qucs/spicecomponents/iPWL.h index ba3b9a48e..3e596dc76 100644 --- a/qucs/spicecomponents/iPWL.h +++ b/qucs/spicecomponents/iPWL.h @@ -31,7 +31,7 @@ class iPWL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // IPWL_H diff --git a/qucs/spicecomponents/iTRNOISE.cpp b/qucs/spicecomponents/iTRNOISE.cpp index a56800ef3..ea4b27224 100644 --- a/qucs/spicecomponents/iTRNOISE.cpp +++ b/qucs/spicecomponents/iTRNOISE.cpp @@ -98,7 +98,7 @@ QString iTRNOISE::netlist() return QString(); } -QString iTRNOISE::spice_netlist(bool) +QString iTRNOISE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/iTRNOISE.h b/qucs/spicecomponents/iTRNOISE.h index deb62f99e..563698a2f 100644 --- a/qucs/spicecomponents/iTRNOISE.h +++ b/qucs/spicecomponents/iTRNOISE.h @@ -31,7 +31,7 @@ class iTRNOISE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // ITRNOISE_H diff --git a/qucs/spicecomponents/isffm.cpp b/qucs/spicecomponents/isffm.cpp index 6415d5eeb..5ac3f2742 100644 --- a/qucs/spicecomponents/isffm.cpp +++ b/qucs/spicecomponents/isffm.cpp @@ -89,7 +89,7 @@ QString iSffm::netlist() return QString(); } -QString iSffm::spice_netlist(bool) +QString iSffm::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/isffm.h b/qucs/spicecomponents/isffm.h index 856f3a220..881272dbd 100644 --- a/qucs/spicecomponents/isffm.h +++ b/qucs/spicecomponents/isffm.h @@ -25,7 +25,7 @@ class iSffm : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // ISFFM_H diff --git a/qucs/spicecomponents/sp_customsim.cpp b/qucs/spicecomponents/sp_customsim.cpp index 8599592da..8a0ea8098 100644 --- a/qucs/spicecomponents/sp_customsim.cpp +++ b/qucs/spicecomponents/sp_customsim.cpp @@ -66,7 +66,7 @@ Element* SpiceCustomSim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceCustomSim::spice_netlist(bool isXyce) +QString SpiceCustomSim::spice_netlist(bool isXyce, bool) { QString s = ""; if (isXyce) return s; diff --git a/qucs/spicecomponents/sp_customsim.h b/qucs/spicecomponents/sp_customsim.h index 90661ddec..b0626fc89 100644 --- a/qucs/spicecomponents/sp_customsim.h +++ b/qucs/spicecomponents/sp_customsim.h @@ -29,7 +29,7 @@ class SpiceCustomSim : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_disto.cpp b/qucs/spicecomponents/sp_disto.cpp index e1047cce3..a53878402 100644 --- a/qucs/spicecomponents/sp_disto.cpp +++ b/qucs/spicecomponents/sp_disto.cpp @@ -61,7 +61,7 @@ Element* SpiceDisto::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceDisto::spice_netlist(bool isXyce) +QString SpiceDisto::spice_netlist(bool isXyce, bool) { QString s; if (!isXyce) { diff --git a/qucs/spicecomponents/sp_disto.h b/qucs/spicecomponents/sp_disto.h index 7340d70f7..74cc69d59 100644 --- a/qucs/spicecomponents/sp_disto.h +++ b/qucs/spicecomponents/sp_disto.h @@ -29,7 +29,7 @@ class SpiceDisto : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_fourier.cpp b/qucs/spicecomponents/sp_fourier.cpp index 52e5e323b..31cdf21b8 100644 --- a/qucs/spicecomponents/sp_fourier.cpp +++ b/qucs/spicecomponents/sp_fourier.cpp @@ -54,7 +54,7 @@ Element* SpiceFourier::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceFourier::spice_netlist(bool isXyce) +QString SpiceFourier::spice_netlist(bool isXyce, bool) { QString s; QString f0 = spicecompat::normalize_value(Props.at(2)->Value); diff --git a/qucs/spicecomponents/sp_fourier.h b/qucs/spicecomponents/sp_fourier.h index 39665200f..b06faef91 100644 --- a/qucs/spicecomponents/sp_fourier.h +++ b/qucs/spicecomponents/sp_fourier.h @@ -29,7 +29,7 @@ class SpiceFourier : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); Qt::GlobalColor color() const override { return Qt::darkRed; } }; diff --git a/qucs/spicecomponents/sp_noise.cpp b/qucs/spicecomponents/sp_noise.cpp index 02a0f3013..888086687 100644 --- a/qucs/spicecomponents/sp_noise.cpp +++ b/qucs/spicecomponents/sp_noise.cpp @@ -64,7 +64,7 @@ Element* SpiceNoise::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceNoise::spice_netlist(bool isXyce) +QString SpiceNoise::spice_netlist(bool isXyce, bool) { QString s; QString fstart = spicecompat::normalize_value(Props.at(1)->Value); // Start freq. diff --git a/qucs/spicecomponents/sp_noise.h b/qucs/spicecomponents/sp_noise.h index 418221b03..d49c37880 100644 --- a/qucs/spicecomponents/sp_noise.h +++ b/qucs/spicecomponents/sp_noise.h @@ -29,7 +29,7 @@ class SpiceNoise : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_pz.cpp b/qucs/spicecomponents/sp_pz.cpp index b52d0774a..9b3159416 100644 --- a/qucs/spicecomponents/sp_pz.cpp +++ b/qucs/spicecomponents/sp_pz.cpp @@ -58,7 +58,7 @@ Element* SpicePZ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpicePZ::spice_netlist(bool isXyce) +QString SpicePZ::spice_netlist(bool isXyce, bool) { QString s; QString out = "spice4qucs." + Name.toLower() + ".cir.pz"; diff --git a/qucs/spicecomponents/sp_pz.h b/qucs/spicecomponents/sp_pz.h index 02bd643be..df959460b 100644 --- a/qucs/spicecomponents/sp_pz.h +++ b/qucs/spicecomponents/sp_pz.h @@ -29,7 +29,7 @@ class SpicePZ : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_sens.cpp b/qucs/spicecomponents/sp_sens.cpp index be044d81b..c0b1ae4bb 100644 --- a/qucs/spicecomponents/sp_sens.cpp +++ b/qucs/spicecomponents/sp_sens.cpp @@ -59,7 +59,7 @@ Element* SpiceSENS::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS::spice_netlist(bool isXyce) +QString SpiceSENS::spice_netlist(bool isXyce, bool) { QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_sens.h b/qucs/spicecomponents/sp_sens.h index a77f0504c..4823bd9b7 100644 --- a/qucs/spicecomponents/sp_sens.h +++ b/qucs/spicecomponents/sp_sens.h @@ -29,7 +29,7 @@ class SpiceSENS : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_sens_ac.cpp b/qucs/spicecomponents/sp_sens_ac.cpp index e6e77fb6e..31a70a524 100644 --- a/qucs/spicecomponents/sp_sens_ac.cpp +++ b/qucs/spicecomponents/sp_sens_ac.cpp @@ -59,7 +59,7 @@ Element* SpiceSENS_AC::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS_AC::spice_netlist(bool isXyce) +QString SpiceSENS_AC::spice_netlist(bool isXyce, bool) { QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_sens_ac.h b/qucs/spicecomponents/sp_sens_ac.h index beb3cd102..cc144f787 100644 --- a/qucs/spicecomponents/sp_sens_ac.h +++ b/qucs/spicecomponents/sp_sens_ac.h @@ -29,7 +29,7 @@ class SpiceSENS_AC : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/sp_sens_tr_xyce.cpp b/qucs/spicecomponents/sp_sens_tr_xyce.cpp index 35f489b4b..b807a2d85 100644 --- a/qucs/spicecomponents/sp_sens_tr_xyce.cpp +++ b/qucs/spicecomponents/sp_sens_tr_xyce.cpp @@ -62,7 +62,7 @@ Element* SpiceSENS_TR_Xyce::info(QString& Name, char* &BitmapFile, bool getNewOn return 0; } -QString SpiceSENS_TR_Xyce::spice_netlist(bool isXyce) +QString SpiceSENS_TR_Xyce::spice_netlist(bool isXyce, bool) { QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_sens_tr_xyce.h b/qucs/spicecomponents/sp_sens_tr_xyce.h index d2d376c65..f5bf25d00 100644 --- a/qucs/spicecomponents/sp_sens_tr_xyce.h +++ b/qucs/spicecomponents/sp_sens_tr_xyce.h @@ -29,7 +29,7 @@ class SpiceSENS_TR_Xyce : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; diff --git a/qucs/spicecomponents/sp_sens_xyce.cpp b/qucs/spicecomponents/sp_sens_xyce.cpp index 6759a6ead..bd3caa995 100644 --- a/qucs/spicecomponents/sp_sens_xyce.cpp +++ b/qucs/spicecomponents/sp_sens_xyce.cpp @@ -60,7 +60,7 @@ Element* SpiceSENS_Xyce::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS_Xyce::spice_netlist(bool isXyce) +QString SpiceSENS_Xyce::spice_netlist(bool isXyce, bool) { QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_sens_xyce.h b/qucs/spicecomponents/sp_sens_xyce.h index b09f5b4af..09bd87464 100644 --- a/qucs/spicecomponents/sp_sens_xyce.h +++ b/qucs/spicecomponents/sp_sens_xyce.h @@ -29,7 +29,7 @@ class SpiceSENS_Xyce : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; diff --git a/qucs/spicecomponents/sp_spectrum.cpp b/qucs/spicecomponents/sp_spectrum.cpp index 9afe1e4c0..6f515c9e5 100644 --- a/qucs/spicecomponents/sp_spectrum.cpp +++ b/qucs/spicecomponents/sp_spectrum.cpp @@ -57,7 +57,7 @@ Element* SpiceFFT::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceFFT::spice_netlist(bool isXyce) +QString SpiceFFT::spice_netlist(bool isXyce, bool) { Q_UNUSED(isXyce); diff --git a/qucs/spicecomponents/sp_spectrum.h b/qucs/spicecomponents/sp_spectrum.h index 0a48f63e4..cf5510745 100644 --- a/qucs/spicecomponents/sp_spectrum.h +++ b/qucs/spicecomponents/sp_spectrum.h @@ -29,7 +29,7 @@ class SpiceFFT : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/spicegeneric.cpp b/qucs/spicecomponents/spicegeneric.cpp index 7de862615..f26c8e950 100644 --- a/qucs/spicecomponents/spicegeneric.cpp +++ b/qucs/spicecomponents/spicegeneric.cpp @@ -134,7 +134,7 @@ QString SpiceGeneric::netlist() return QString(); } -QString SpiceGeneric::spice_netlist(bool) +QString SpiceGeneric::spice_netlist(bool, bool) { // form RefDes from unique device letter and device name QString s = Props.at(1)->Value + Name; diff --git a/qucs/spicecomponents/spicegeneric.h b/qucs/spicecomponents/spicegeneric.h index 69e73418c..6587c437b 100644 --- a/qucs/spicecomponents/spicegeneric.h +++ b/qucs/spicecomponents/spicegeneric.h @@ -37,7 +37,7 @@ class SpiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; diff --git a/qucs/spicecomponents/spicelibcomp.cpp b/qucs/spicecomponents/spicelibcomp.cpp index 46e644bd2..a2f7a4819 100644 --- a/qucs/spicecomponents/spicelibcomp.cpp +++ b/qucs/spicecomponents/spicelibcomp.cpp @@ -218,7 +218,7 @@ int SpiceLibComp::loadSymbol(const QString& DocName) return -8; // field not closed } -QString SpiceLibComp::spice_netlist(bool) +QString SpiceLibComp::spice_netlist(bool, bool) { QString s = QStringLiteral("X%1 ").arg(Name); QString pins = getProperty("PinAssign")->Value; diff --git a/qucs/spicecomponents/spicelibcomp.h b/qucs/spicecomponents/spicelibcomp.h index f3bd932d1..aa63b58fe 100644 --- a/qucs/spicecomponents/spicelibcomp.h +++ b/qucs/spicecomponents/spicelibcomp.h @@ -30,7 +30,7 @@ class SpiceLibComp : public MultiViewComponent { QString getSpiceLibrary(); protected: - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); void createSymbol(); void remakeSymbol(int No, QStringList &pin_names); int loadSymbol(const QString&); diff --git a/qucs/spicecomponents/src_eqndef.cpp b/qucs/spicecomponents/src_eqndef.cpp index e980dd2d6..a16cdd5e3 100644 --- a/qucs/spicecomponents/src_eqndef.cpp +++ b/qucs/spicecomponents/src_eqndef.cpp @@ -67,7 +67,7 @@ QString Src_eqndef::netlist() return QString(); } -QString Src_eqndef::spice_netlist(bool) +QString Src_eqndef::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/src_eqndef.h b/qucs/spicecomponents/src_eqndef.h index 514554cda..c3570663c 100644 --- a/qucs/spicecomponents/src_eqndef.h +++ b/qucs/spicecomponents/src_eqndef.h @@ -11,7 +11,7 @@ class Src_eqndef : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/spicecomponents/vAmpMod.cpp b/qucs/spicecomponents/vAmpMod.cpp index 8bf3b6a47..ffd87fbe5 100644 --- a/qucs/spicecomponents/vAmpMod.cpp +++ b/qucs/spicecomponents/vAmpMod.cpp @@ -91,7 +91,7 @@ QString vAmpMod::netlist() return QString(); } -QString vAmpMod::spice_netlist(bool) +QString vAmpMod::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/vAmpMod.h b/qucs/spicecomponents/vAmpMod.h index fa6472e58..1fbdfc8fb 100644 --- a/qucs/spicecomponents/vAmpMod.h +++ b/qucs/spicecomponents/vAmpMod.h @@ -31,7 +31,7 @@ class vAmpMod : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // VAMPMOD_H diff --git a/qucs/spicecomponents/vPWL.cpp b/qucs/spicecomponents/vPWL.cpp index 5cf66c9ac..b8e1d3f89 100644 --- a/qucs/spicecomponents/vPWL.cpp +++ b/qucs/spicecomponents/vPWL.cpp @@ -89,7 +89,7 @@ QString vPWL::netlist() return QString(); } -QString vPWL::spice_netlist(bool) +QString vPWL::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/vPWL.h b/qucs/spicecomponents/vPWL.h index 710c9fd5c..2077a0d76 100644 --- a/qucs/spicecomponents/vPWL.h +++ b/qucs/spicecomponents/vPWL.h @@ -31,7 +31,7 @@ class vPWL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // VPWL_H diff --git a/qucs/spicecomponents/vTRNOISE.cpp b/qucs/spicecomponents/vTRNOISE.cpp index ed6f84422..f1ffc0edd 100644 --- a/qucs/spicecomponents/vTRNOISE.cpp +++ b/qucs/spicecomponents/vTRNOISE.cpp @@ -94,7 +94,7 @@ QString vTRNOISE::netlist() return QString(); } -QString vTRNOISE::spice_netlist(bool) +QString vTRNOISE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/vTRNOISE.h b/qucs/spicecomponents/vTRNOISE.h index c8890794d..e5cd75679 100644 --- a/qucs/spicecomponents/vTRNOISE.h +++ b/qucs/spicecomponents/vTRNOISE.h @@ -31,7 +31,7 @@ class vTRNOISE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // VTRNOISE_H diff --git a/qucs/spicecomponents/vTRRANDOM.cpp b/qucs/spicecomponents/vTRRANDOM.cpp index 28175706f..06be58508 100644 --- a/qucs/spicecomponents/vTRRANDOM.cpp +++ b/qucs/spicecomponents/vTRRANDOM.cpp @@ -96,7 +96,7 @@ QString vTRRANDOM::netlist() return QString(); } -QString vTRRANDOM::spice_netlist(bool) +QString vTRRANDOM::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/vTRRANDOM.h b/qucs/spicecomponents/vTRRANDOM.h index a89af0ef7..f34ff3406 100644 --- a/qucs/spicecomponents/vTRRANDOM.h +++ b/qucs/spicecomponents/vTRRANDOM.h @@ -31,7 +31,7 @@ class vTRRANDOM : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // VTRRANDOM_H diff --git a/qucs/spicecomponents/volt_ac_SPICE.cpp b/qucs/spicecomponents/volt_ac_SPICE.cpp index 44d212bf7..ed19b4ee8 100644 --- a/qucs/spicecomponents/volt_ac_SPICE.cpp +++ b/qucs/spicecomponents/volt_ac_SPICE.cpp @@ -72,7 +72,7 @@ Element* Vac_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Vac_SPICE::spice_netlist(bool) +QString Vac_SPICE::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/volt_ac_SPICE.h b/qucs/spicecomponents/volt_ac_SPICE.h index 048e6383d..e66e44186 100644 --- a/qucs/spicecomponents/volt_ac_SPICE.h +++ b/qucs/spicecomponents/volt_ac_SPICE.h @@ -28,7 +28,7 @@ class Vac_SPICE : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/vsffm.cpp b/qucs/spicecomponents/vsffm.cpp index e573637a2..d77d73857 100644 --- a/qucs/spicecomponents/vsffm.cpp +++ b/qucs/spicecomponents/vsffm.cpp @@ -89,7 +89,7 @@ QString vSffm::netlist() return QString(); } -QString vSffm::spice_netlist(bool) +QString vSffm::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/spicecomponents/vsffm.h b/qucs/spicecomponents/vsffm.h index de36a9f64..3a8beb87a 100644 --- a/qucs/spicecomponents/vsffm.h +++ b/qucs/spicecomponents/vsffm.h @@ -31,7 +31,7 @@ class vSffm : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif // VSFFM_H diff --git a/qucs/spicecomponents/xsp_cmlib.cpp b/qucs/spicecomponents/xsp_cmlib.cpp index cbef493e4..41b808d30 100644 --- a/qucs/spicecomponents/xsp_cmlib.cpp +++ b/qucs/spicecomponents/xsp_cmlib.cpp @@ -86,7 +86,7 @@ QString XSP_CMlib::getSpiceInit() return s; } -QString XSP_CMlib::spice_netlist() +QString XSP_CMlib::spice_netlist(, bool) { return QString(); } diff --git a/qucs/spicecomponents/xsp_cmlib.h b/qucs/spicecomponents/xsp_cmlib.h index 6931305ac..79227fd11 100644 --- a/qucs/spicecomponents/xsp_cmlib.h +++ b/qucs/spicecomponents/xsp_cmlib.h @@ -32,7 +32,7 @@ class XSP_CMlib : public Component { QString getSpiceInit(); protected: - QString spice_netlist(); + QString spice_netlist(bool, bool isCdl = false); }; diff --git a/qucs/spicecomponents/xsp_codemodel.cpp b/qucs/spicecomponents/xsp_codemodel.cpp index c47dd34be..61f71f8f8 100644 --- a/qucs/spicecomponents/xsp_codemodel.cpp +++ b/qucs/spicecomponents/xsp_codemodel.cpp @@ -69,7 +69,7 @@ Element* XSP_CodeModel::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString XSP_CodeModel::spice_netlist() +QString XSP_CodeModel::spice_netlist(, bool) { return QString(); } diff --git a/qucs/spicecomponents/xsp_codemodel.h b/qucs/spicecomponents/xsp_codemodel.h index df57ea709..63c31c21d 100644 --- a/qucs/spicecomponents/xsp_codemodel.h +++ b/qucs/spicecomponents/xsp_codemodel.h @@ -30,7 +30,7 @@ class XSP_CodeModel : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(); + QString spice_netlist(, bool isCdl = false); }; diff --git a/qucs/spicecomponents/xspicegeneric.cpp b/qucs/spicecomponents/xspicegeneric.cpp index a67c28c2e..7695a410c 100644 --- a/qucs/spicecomponents/xspicegeneric.cpp +++ b/qucs/spicecomponents/xspicegeneric.cpp @@ -145,7 +145,7 @@ QString XspiceGeneric::netlist() return QString(); } -QString XspiceGeneric::spice_netlist(bool) +QString XspiceGeneric::spice_netlist(bool, bool) { QString s = spicecompat::check_refdes(Name,SpiceModel); diff --git a/qucs/spicecomponents/xspicegeneric.h b/qucs/spicecomponents/xspicegeneric.h index 100987a49..b05ca5dad 100644 --- a/qucs/spicecomponents/xspicegeneric.h +++ b/qucs/spicecomponents/xspicegeneric.h @@ -37,7 +37,7 @@ class XspiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce); + QString spice_netlist(bool isXyce, bool isCdl = false); }; diff --git a/qucs/spicecomponents/xyce_script.cpp b/qucs/spicecomponents/xyce_script.cpp index 3e84e5690..940224df5 100644 --- a/qucs/spicecomponents/xyce_script.cpp +++ b/qucs/spicecomponents/xyce_script.cpp @@ -55,7 +55,7 @@ Element* XyceScript::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString XyceScript::spice_netlist(bool isXyce) +QString XyceScript::spice_netlist(bool isXyce, bool) { QString s = ""; if (!isXyce) return s; diff --git a/qucs/spicecomponents/xyce_script.h b/qucs/spicecomponents/xyce_script.h index 52a273455..227b09ea4 100644 --- a/qucs/spicecomponents/xyce_script.h +++ b/qucs/spicecomponents/xyce_script.h @@ -29,7 +29,7 @@ class XyceScript : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; From 62fe9727a683288cbdd15d0a7bc43c35e9d47056 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Mon, 16 Dec 2024 16:16:48 +0100 Subject: [PATCH 03/10] New feature CDL netlist export -Added cdl_netlist() as default to class Component and as implementation to CDL supporting derived components. Besides some port-number checking this implementation is a wrapper for spice_netlist. -Implemented necessary spice_netlist() adjustments to meet CDL requirements. -Improved spice_netlist() derived default parameter 'isXyce' to be explicitly set. -Fixed using of tabs/trailing spaces. Signed-off-by: ThomasZecha --- qucs/components/ampere_dc.cpp | 8 +++++++- qucs/components/ampere_dc.h | 3 ++- qucs/components/biast.h | 2 +- qucs/components/bjt.cpp | 21 +++++++++++++++------ qucs/components/bjt.h | 1 + qucs/components/bjtsub.cpp | 20 ++++++++++++++------ qucs/components/bjtsub.h | 1 + qucs/components/capacitor.cpp | 21 +++++++++++++-------- qucs/components/capacitor.h | 1 + qucs/components/capq.cpp | 1 + qucs/components/capq.h | 2 +- qucs/components/component.cpp | 8 ++++++-- qucs/components/component.h | 3 ++- qucs/components/d_flipflop.h | 2 +- qucs/components/dcblock.cpp | 7 ++++++- qucs/components/dcblock.h | 4 +++- qucs/components/dcfeed.cpp | 6 ++++++ qucs/components/dcfeed.h | 4 +++- qucs/components/dff_SR.h | 2 +- qucs/components/diode.cpp | 18 ++++++++++++------ qucs/components/diode.h | 1 + qucs/components/eqndefined.h | 2 +- qucs/components/gyrator.h | 2 +- qucs/components/hb_sim.h | 2 +- qucs/components/ifile.h | 2 +- qucs/components/indq.cpp | 1 + qucs/components/indq.h | 3 ++- qucs/components/inductor.cpp | 9 +++++++-- qucs/components/inductor.h | 2 ++ qucs/components/jfet.cpp | 12 ++++++++++-- qucs/components/jfet.h | 1 + qucs/components/jkff_SR.h | 2 +- qucs/components/libcomp.cpp | 5 +++++ qucs/components/libcomp.h | 3 ++- qucs/components/logical_buf.h | 2 +- qucs/components/logical_inv.h | 2 +- qucs/components/mosfet.cpp | 14 ++++++++++++-- qucs/components/mosfet.h | 1 + qucs/components/mosfet_sub.cpp | 13 +++++++++++-- qucs/components/mosfet_sub.h | 1 + qucs/components/mutual.cpp | 6 +++--- qucs/components/mutual.h | 3 ++- qucs/components/mutual2.cpp | 1 - qucs/components/mutual2.h | 3 ++- qucs/components/mutualx.cpp | 13 +++++++------ qucs/components/mutualx.h | 2 +- qucs/components/opamp.h | 2 +- qucs/components/param_sweep.h | 2 +- qucs/components/potentiometer.h | 2 +- qucs/components/resistor.cpp | 24 ++++++++++++++++-------- qucs/components/resistor.h | 1 + qucs/components/rlcg.cpp | 4 +++- qucs/components/rlcg.h | 3 ++- qucs/components/source_ac.h | 2 +- qucs/components/sp_sim.h | 2 +- qucs/components/sparamfile.h | 2 +- qucs/components/spicefile.cpp | 5 +++++ qucs/components/spicefile.h | 3 ++- qucs/components/subcircuit.cpp | 5 +++++ qucs/components/subcircuit.h | 3 ++- qucs/components/subcirport.h | 2 +- qucs/components/tff_SR.h | 2 +- qucs/components/vacomponent.h | 2 +- qucs/components/vcresistor.h | 2 +- qucs/components/vfile.h | 2 +- qucs/components/volt_dc.cpp | 12 +++++++++--- qucs/components/volt_dc.h | 3 +++ qucs/components/vprobe.h | 2 +- qucs/spicecomponents/BJT_SPICE.cpp | 8 +++++++- qucs/spicecomponents/BJT_SPICE.h | 5 ++++- qucs/spicecomponents/C_SPICE.cpp | 10 ++++++++++ qucs/spicecomponents/C_SPICE.h | 2 ++ qucs/spicecomponents/DIODE_SPICE.cpp | 12 +++++++++++- qucs/spicecomponents/DIODE_SPICE.h | 2 ++ qucs/spicecomponents/L_SPICE.cpp | 7 ++++++- qucs/spicecomponents/L_SPICE.h | 2 ++ qucs/spicecomponents/MOS_SPICE.cpp | 10 ++++++++++ qucs/spicecomponents/MOS_SPICE.h | 2 ++ qucs/spicecomponents/NJF_SPICE.cpp | 5 +++++ qucs/spicecomponents/NJF_SPICE.h | 2 ++ qucs/spicecomponents/NMOS_SPICE.cpp | 19 ++++++++++++------- qucs/spicecomponents/NMOS_SPICE.h | 2 ++ qucs/spicecomponents/NPN_SPICE.cpp | 21 +++++++++++++-------- qucs/spicecomponents/NPN_SPICE.h | 2 ++ qucs/spicecomponents/PJF_SPICE.cpp | 23 ++++++++++++++--------- qucs/spicecomponents/PJF_SPICE.h | 2 ++ qucs/spicecomponents/PMOS_SPICE.cpp | 19 ++++++++++++------- qucs/spicecomponents/PMOS_SPICE.h | 2 ++ qucs/spicecomponents/PNP_SPICE.cpp | 23 ++++++++++++++--------- qucs/spicecomponents/PNP_SPICE.h | 2 ++ qucs/spicecomponents/R_SPICE.cpp | 10 ++++++++++ qucs/spicecomponents/R_SPICE.h | 2 ++ qucs/spicecomponents/S4Q_I.cpp | 10 +++++++--- qucs/spicecomponents/S4Q_I.h | 3 ++- qucs/spicecomponents/S4Q_V.cpp | 8 ++++++-- qucs/spicecomponents/S4Q_V.h | 3 ++- qucs/spicecomponents/spicegeneric.cpp | 5 +++++ qucs/spicecomponents/spicegeneric.h | 4 ++-- qucs/spicecomponents/spicelibcomp.cpp | 5 +++++ qucs/spicecomponents/spicelibcomp.h | 4 +++- qucs/spicecomponents/xsp_cmlib.cpp | 2 +- qucs/spicecomponents/xsp_cmlib.h | 2 +- qucs/spicecomponents/xsp_codemodel.cpp | 2 +- qucs/spicecomponents/xsp_codemodel.h | 2 +- qucs/spicecomponents/xspicegeneric.h | 2 +- 105 files changed, 422 insertions(+), 154 deletions(-) diff --git a/qucs/components/ampere_dc.cpp b/qucs/components/ampere_dc.cpp index b3d1ddc40..8db3f16ab 100644 --- a/qucs/components/ampere_dc.cpp +++ b/qucs/components/ampere_dc.cpp @@ -47,7 +47,7 @@ Ampere_dc::Ampere_dc() SpiceModel = "I"; Props.append(new Property("I", "1 mA", true, - QObject::tr("current in Ampere"))); + QObject::tr("current in Ampere"))); rotate(); // fix historical flaw } @@ -68,6 +68,12 @@ QString Ampere_dc::spice_netlist(bool, bool) .arg(spicecompat::normalize_value(Props.at(0)->Value)); return s; } + +QString Ampere_dc::cdl_netlist() +{ + return spice_netlist(false, true); +} + Component* Ampere_dc::newOne() { return new Ampere_dc(); diff --git a/qucs/components/ampere_dc.h b/qucs/components/ampere_dc.h index 80f84e03e..2d90a5f5d 100644 --- a/qucs/components/ampere_dc.h +++ b/qucs/components/ampere_dc.h @@ -27,7 +27,8 @@ class Ampere_dc : public Component { ~Ampere_dc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/biast.h b/qucs/components/biast.h index 1a78a2a66..f86e5656f 100644 --- a/qucs/components/biast.h +++ b/qucs/components/biast.h @@ -28,7 +28,7 @@ class BiasT : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/bjt.cpp b/qucs/components/bjt.cpp index 2fe50a258..533f247f6 100644 --- a/qucs/components/bjt.cpp +++ b/qucs/components/bjt.cpp @@ -42,7 +42,7 @@ Component* BJT::newOne() return p; } -QString BJT::spice_netlist(bool, bool) +QString BJT::spice_netlist(bool, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -60,17 +60,26 @@ QString BJT::spice_netlist(bool, bool) QString par_str = form_spice_param_list(spice_incompat,spice_tr); - if (getProperty("UseGlobTemp")->Value == "yes") { - s += QStringLiteral(" QMOD_%1 AREA=%2\n").arg(Name).arg(getProperty("Area")->Value); + if (getProperty("UseGlobTemp")->Value == "yes" || isCdl) { + s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isCdl ? "$EA" : "AREA").arg(getProperty("Area")->Value); } else { - s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) - .arg(getProperty("Temp")->Value); + s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) + .arg(getProperty("Temp")->Value); + } + + if (!isCdl) + { + s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); } - s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); return s; } +QString BJT::cdl_netlist() +{ + return spice_netlist(false, true); +} + // ------------------------------------------------------- Element* BJT::info(QString& Name, char* &BitmapFile, bool getNewOne) { diff --git a/qucs/components/bjt.h b/qucs/components/bjt.h index a508f91f8..6fe626585 100644 --- a/qucs/components/bjt.h +++ b/qucs/components/bjt.h @@ -33,6 +33,7 @@ class BJT : public Basic_BJT { void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/bjtsub.cpp b/qucs/components/bjtsub.cpp index 5ee2b2aa3..591b6790d 100644 --- a/qucs/components/bjtsub.cpp +++ b/qucs/components/bjtsub.cpp @@ -201,7 +201,7 @@ void BJTsub::createSymbol() x2 = 30; y2 = 30; } -QString BJTsub::spice_netlist(bool, bool) +QString BJTsub::spice_netlist(bool, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -219,14 +219,22 @@ QString BJTsub::spice_netlist(bool, bool) QString par_str = form_spice_param_list(spice_incompat,spice_tr); - if (getProperty("UseGlobTemp")->Value == "yes") { - s += QStringLiteral(" QMOD_%1 AREA=%2\n").arg(Name).arg(getProperty("Area")->Value); + if (getProperty("UseGlobTemp")->Value == "yes" || isCdl) { + s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isCdl ? "$EA" : "AREA").arg(getProperty("Area")->Value); } else { - s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) - .arg(getProperty("Temp")->Value); + s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) + .arg(getProperty("Temp")->Value); } - s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); + if (!isCdl) + { + s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); + } return s; } + +QString BJTsub::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/components/bjtsub.h b/qucs/components/bjtsub.h index 1073c2414..07e565ade 100644 --- a/qucs/components/bjtsub.h +++ b/qucs/components/bjtsub.h @@ -37,6 +37,7 @@ class BJTsub : public Basic_BJT { protected: QString spice_netlist(bool isXyce, bool isCdl = false); + virtual QString cdl_netlist(); void createSymbol(); }; diff --git a/qucs/components/capacitor.cpp b/qucs/components/capacitor.cpp index 776372730..29dddc336 100644 --- a/qucs/components/capacitor.cpp +++ b/qucs/components/capacitor.cpp @@ -25,11 +25,11 @@ Capacitor::Capacitor() Description = QObject::tr("capacitor"); Props.append(new Property("C", "1 nF", true, - QObject::tr("capacitance in Farad"))); + QObject::tr("capacitance in Farad"))); Props.append(new Property("V", "", false, - QObject::tr("initial voltage for transient simulation"))); + QObject::tr("initial voltage for transient simulation"))); Props.append(new Property("Symbol", "neutral", false, - QObject::tr("schematic symbol")+" [neutral, polar]")); + QObject::tr("schematic symbol")+" [neutral, polar]")); createSymbol(); tx = x1+4; @@ -53,7 +53,7 @@ Element* Capacitor::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Capacitor::spice_netlist(bool, bool) +QString Capacitor::spice_netlist(bool, bool isCdl /*= false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -64,24 +64,29 @@ QString Capacitor::spice_netlist(bool, bool) s += " "+spicecompat::normalize_value(Props.at(0)->Value) + " "; QString val = Props.at(1)->Value; // add inial voltage if presents val = val.remove(' ').toUpper(); - if (!val.isEmpty()) { + if (!val.isEmpty() && !isCdl) { s += " IC=" + val; } return s+'\n'; } +QString Capacitor::cdl_netlist() +{ + return spice_netlist(false, true); +} + QString Capacitor::va_code() { QString val = vacompat::normalize_value(Props.at(0)->Value); QString plus = Ports.at(0)->Connection->Name; - QString minus = Ports.at(1)->Connection->Name; + QString minus = Ports.at(1)->Connection->Name; QString s = ""; QString Vpm = vacompat::normalize_voltage(plus,minus); if (Vpm.startsWith("(-")) Vpm.remove(1,1); // Make capacitor unipolar, remove starting minus - QString Ipm = vacompat::normalize_current(plus,minus,true); + QString Ipm = vacompat::normalize_current(plus,minus,true); s += QStringLiteral("%1 <+ ddt( %2 * %3 );\n").arg(Ipm).arg(Vpm).arg(val); - + return s; } diff --git a/qucs/components/capacitor.h b/qucs/components/capacitor.h index b849fe978..74fa72bf9 100644 --- a/qucs/components/capacitor.h +++ b/qucs/components/capacitor.h @@ -31,6 +31,7 @@ class Capacitor : public MultiViewComponent { protected: void createSymbol(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); QString va_code(); }; diff --git a/qucs/components/capq.cpp b/qucs/components/capq.cpp index 773196844..20b8a1994 100644 --- a/qucs/components/capq.cpp +++ b/qucs/components/capq.cpp @@ -124,3 +124,4 @@ QString CapQ::spice_netlist(bool isXyce, bool) return s; } + diff --git a/qucs/components/capq.h b/qucs/components/capq.h index 5813aadd7..17c98c0aa 100644 --- a/qucs/components/capq.h +++ b/qucs/components/capq.h @@ -34,7 +34,7 @@ class CapQ : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 8643f07f9..5ccf1182f 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -762,6 +762,10 @@ QString Component::spice_netlist(bool, bool) { return QStringLiteral("\n"); // ignore if not implemented } +QString Component::cdl_netlist() { + return QStringLiteral("\n"); // ignore if not implemented +} + QString Component::va_code() { return QString(); // ignore if not implemented } @@ -787,11 +791,11 @@ QString Component::getNetlist() { return s; } -QString Component::getSpiceNetlist(bool isXyce) { +QString Component::getSpiceNetlist(bool isXyce /* = false */, bool isCdl /* = false */) { QString s; switch (isActive) { case COMP_IS_ACTIVE: - s = spice_netlist(isXyce); + s = isCdl ? cdl_netlist() : spice_netlist(isXyce, false); s.replace(" gnd ", " 0 "); return s; case COMP_IS_OPEN: diff --git a/qucs/components/component.h b/qucs/components/component.h index a0e9769cd..b41a0b2b6 100644 --- a/qucs/components/component.h +++ b/qucs/components/component.h @@ -42,7 +42,7 @@ class Component : public Element { virtual Component* newOne(); virtual void recreate(Schematic*) {}; QString getNetlist(); - QString getSpiceNetlist(bool isXyce = false); + QString getSpiceNetlist(bool isXyce = false, bool isCdl = false); QString getVerilogACode(); virtual QString getExpression(bool isXyce = false); virtual QString getEquations(QString sim, QStringList &dep_vars); @@ -115,6 +115,7 @@ class Component : public Element { protected: virtual QString netlist(); virtual QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); virtual QString va_code(); virtual QString vhdlCode(int); virtual QString verilogCode(int); diff --git a/qucs/components/d_flipflop.h b/qucs/components/d_flipflop.h index e69884a55..50bcea1b3 100644 --- a/qucs/components/d_flipflop.h +++ b/qucs/components/d_flipflop.h @@ -31,7 +31,7 @@ class D_FlipFlop : public Component { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/dcblock.cpp b/qucs/components/dcblock.cpp index 4934d4743..90872be9d 100644 --- a/qucs/components/dcblock.cpp +++ b/qucs/components/dcblock.cpp @@ -47,7 +47,7 @@ dcBlock::dcBlock() SpiceModel = "C"; Props.append(new Property("C", "1 uF", false, - QObject::tr("for transient simulation: capacitance in Farad"))); + QObject::tr("for transient simulation: capacitance in Farad"))); } dcBlock::~dcBlock() @@ -79,3 +79,8 @@ QString dcBlock::spice_netlist(bool isXyce, bool) s = QStringLiteral("%1 %2 %3 %4\n").arg(name, p1, p2, val); return s; } + +QString dcBlock::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/components/dcblock.h b/qucs/components/dcblock.h index 28ab52c8d..9c1ffb0ce 100644 --- a/qucs/components/dcblock.h +++ b/qucs/components/dcblock.h @@ -27,8 +27,10 @@ class dcBlock : public Component { ~dcBlock(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/dcfeed.cpp b/qucs/components/dcfeed.cpp index 271277ae1..1251b4cb0 100644 --- a/qucs/components/dcfeed.cpp +++ b/qucs/components/dcfeed.cpp @@ -80,3 +80,9 @@ QString dcFeed::spice_netlist(bool isXyce, bool) s = QStringLiteral("%1 %2 %3 %4\n").arg(name, p1, p2, val); return s; } + + +QString dcFeed::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/components/dcfeed.h b/qucs/components/dcfeed.h index 2b94227e3..5d0cbff40 100644 --- a/qucs/components/dcfeed.h +++ b/qucs/components/dcfeed.h @@ -27,8 +27,10 @@ class dcFeed : public Component { ~dcFeed(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/dff_SR.h b/qucs/components/dff_SR.h index 7ae05e392..0e1b9be01 100644 --- a/qucs/components/dff_SR.h +++ b/qucs/components/dff_SR.h @@ -24,7 +24,7 @@ class dff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif /* dff_SR_H */ diff --git a/qucs/components/diode.cpp b/qucs/components/diode.cpp index 87d4d94f5..35f10eaac 100644 --- a/qucs/components/diode.cpp +++ b/qucs/components/diode.cpp @@ -99,7 +99,7 @@ Component* Diode::newOne() return new Diode(); } -QString Diode::spice_netlist(bool isXyce, bool) +QString Diode::spice_netlist(bool isXyce, bool cdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); // output all node names @@ -149,15 +149,21 @@ QString Diode::spice_netlist(bool isXyce, bool) .arg(getProperty("Temp")->Value); } - if (isXyce) { - s += QStringLiteral(".MODEL DMOD_%1 D (LEVEL = 2 %2)\n").arg(Name).arg(par_str); - } else { - s += QStringLiteral(".MODEL DMOD_%1 D (%2)\n").arg(Name).arg(par_str); + if (!cdl) + { + if (isXyce) { + s += QStringLiteral(".MODEL DMOD_%1 D (LEVEL = 2 %2)\n").arg(Name).arg(par_str); + } else { + s += QStringLiteral(".MODEL DMOD_%1 D (%2)\n").arg(Name).arg(par_str); + } } - return s; +} +QString Diode::cdl_netlist() +{ + return spice_netlist(false, true); } Element* Diode::info(QString& Name, char* &BitmapFile, bool getNewOne) diff --git a/qucs/components/diode.h b/qucs/components/diode.h index 9195f7b8b..900c9fba3 100644 --- a/qucs/components/diode.h +++ b/qucs/components/diode.h @@ -30,6 +30,7 @@ class Diode : public MultiViewComponent { protected: QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); void createSymbol(); }; diff --git a/qucs/components/eqndefined.h b/qucs/components/eqndefined.h index f5bcfbd03..7b78837e6 100644 --- a/qucs/components/eqndefined.h +++ b/qucs/components/eqndefined.h @@ -36,7 +36,7 @@ class EqnDefined : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString va_code(); }; diff --git a/qucs/components/gyrator.h b/qucs/components/gyrator.h index ff52c0410..e0bfbf06f 100644 --- a/qucs/components/gyrator.h +++ b/qucs/components/gyrator.h @@ -28,7 +28,7 @@ class Gyrator : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/hb_sim.h b/qucs/components/hb_sim.h index b62f3d7c4..72817056a 100644 --- a/qucs/components/hb_sim.h +++ b/qucs/components/hb_sim.h @@ -28,7 +28,7 @@ class HB_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/ifile.h b/qucs/components/ifile.h index 7f6b74281..8741fbb61 100644 --- a/qucs/components/ifile.h +++ b/qucs/components/ifile.h @@ -32,7 +32,7 @@ class iFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/indq.cpp b/qucs/components/indq.cpp index a5e65d3b4..a26c3afc5 100644 --- a/qucs/components/indq.cpp +++ b/qucs/components/indq.cpp @@ -126,3 +126,4 @@ QString IndQ::spice_netlist(bool isXyce, bool) return s; } + diff --git a/qucs/components/indq.h b/qucs/components/indq.h index cd27febb1..ec061c5bb 100644 --- a/qucs/components/indq.h +++ b/qucs/components/indq.h @@ -32,8 +32,9 @@ class IndQ : public Component { ~IndQ(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/inductor.cpp b/qucs/components/inductor.cpp index caca0147e..6a82f8fe7 100644 --- a/qucs/components/inductor.cpp +++ b/qucs/components/inductor.cpp @@ -58,7 +58,7 @@ Component* Inductor::newOne() } -QString Inductor::spice_netlist(bool, bool) +QString Inductor::spice_netlist(bool, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -69,7 +69,7 @@ QString Inductor::spice_netlist(bool, bool) s += " "+spicecompat::normalize_value(Props.at(0)->Value) + " "; QString val = Props.at(1)->Value; // add inial voltage if presents val = val.remove(' ').toUpper(); - if (!val.isEmpty()) { + if (!val.isEmpty() && !isCdl) { s += " IC=" + val; } s += '\n'; @@ -77,6 +77,11 @@ QString Inductor::spice_netlist(bool, bool) return s; } +QString Inductor::cdl_netlist() +{ + return spice_netlist(false, true); +} + QString Inductor::va_code() { QString val = vacompat::normalize_value(Props.at(0)->Value); diff --git a/qucs/components/inductor.h b/qucs/components/inductor.h index 7426d1988..fd3274e3b 100644 --- a/qucs/components/inductor.h +++ b/qucs/components/inductor.h @@ -27,10 +27,12 @@ class Inductor : public Component { ~Inductor(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString va_code(); void getExtraVANodes(QStringList& nodes); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/jfet.cpp b/qucs/components/jfet.cpp index 3c729a461..cb160528e 100644 --- a/qucs/components/jfet.cpp +++ b/qucs/components/jfet.cpp @@ -94,7 +94,7 @@ Component* JFET::newOne() return p; } -QString JFET::spice_netlist(bool isXyce, bool) +QString JFET::spice_netlist(bool isXyce, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -131,11 +131,19 @@ QString JFET::spice_netlist(bool isXyce, bool) .arg(getProperty("Temp")->Value); } - s += QStringLiteral(".MODEL JMOD_%1 %2JF (%3)\n").arg(Name).arg(jfet_type).arg(par_str); + if (!isCdl) + { + s += QStringLiteral(".MODEL JMOD_%1 %2JF (%3)\n").arg(Name).arg(jfet_type).arg(par_str); + } return s; } +QString JFET::cdl_netlist() +{ + return spice_netlist(false, true); +} + // ------------------------------------------------------- Element* JFET::info(QString& Name, char* &BitmapFile, bool getNewOne) { diff --git a/qucs/components/jfet.h b/qucs/components/jfet.h index def3c3864..49550fb4e 100644 --- a/qucs/components/jfet.h +++ b/qucs/components/jfet.h @@ -32,6 +32,7 @@ class JFET : public MultiViewComponent { protected: void createSymbol(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/jkff_SR.h b/qucs/components/jkff_SR.h index 32e07c248..8f3733d32 100644 --- a/qucs/components/jkff_SR.h +++ b/qucs/components/jkff_SR.h @@ -24,7 +24,7 @@ class jkff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif /* jkff_SR_H */ diff --git a/qucs/components/libcomp.cpp b/qucs/components/libcomp.cpp index c43c2389a..ac2e21961 100644 --- a/qucs/components/libcomp.cpp +++ b/qucs/components/libcomp.cpp @@ -378,6 +378,11 @@ QString LibComp::spice_netlist(bool, bool) return s; } +QString LibComp::cdl_netlist() +{ + return spice_netlist(false, true); +} + QStringList LibComp::getAttachedIFS() { QString content; diff --git a/qucs/components/libcomp.h b/qucs/components/libcomp.h index aa3e50f3d..f2b96232e 100644 --- a/qucs/components/libcomp.h +++ b/qucs/components/libcomp.h @@ -37,7 +37,8 @@ class LibComp : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/logical_buf.h b/qucs/components/logical_buf.h index 2baa5dfb8..e75c605e9 100644 --- a/qucs/components/logical_buf.h +++ b/qucs/components/logical_buf.h @@ -31,7 +31,7 @@ class Logical_Buf : public MultiViewComponent { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); void createSymbol(); }; diff --git a/qucs/components/logical_inv.h b/qucs/components/logical_inv.h index 0c7e9affe..45f9a8340 100644 --- a/qucs/components/logical_inv.h +++ b/qucs/components/logical_inv.h @@ -29,7 +29,7 @@ class Logical_Inv : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/mosfet.cpp b/qucs/components/mosfet.cpp index b9fd292a2..c7cf3c91d 100644 --- a/qucs/components/mosfet.cpp +++ b/qucs/components/mosfet.cpp @@ -140,7 +140,7 @@ QString MOSFET::netlist() return s + '\n'; } -QString MOSFET::spice_netlist(bool isXyce, bool) +QString MOSFET::spice_netlist(bool isXyce, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -199,7 +199,17 @@ QString MOSFET::spice_netlist(bool isXyce, bool) s += QStringLiteral(" MMOD_%1 L=%2 W=%3 Ad=%4 As=%5 Pd=%6 Ps=%7 Temp=%8\n") .arg(Name).arg(l).arg(w).arg(ad).arg(as).arg(pd).arg(ps).arg(getProperty("Temp")->Value); } - s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); + + if (!isCdl) + { + s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); + } return s; } + +QString MOSFET::cdl_netlist() +{ + return spice_netlist(false, true); +} + diff --git a/qucs/components/mosfet.h b/qucs/components/mosfet.h index f8e71cdaf..d05b8551c 100644 --- a/qucs/components/mosfet.h +++ b/qucs/components/mosfet.h @@ -34,6 +34,7 @@ class MOSFET : public Basic_MOSFET { void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/mosfet_sub.cpp b/qucs/components/mosfet_sub.cpp index 5b413ca2a..23f85738b 100644 --- a/qucs/components/mosfet_sub.cpp +++ b/qucs/components/mosfet_sub.cpp @@ -150,7 +150,7 @@ Component* MOSFET_sub::newOne() return p; } -QString MOSFET_sub::spice_netlist(bool isXyce, bool) +QString MOSFET_sub::spice_netlist(bool isXyce, bool netlistModel /* = true */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -208,11 +208,20 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool) s += QStringLiteral(" MMOD_%1 L=%2 W=%3 Ad=%4 As=%5 Pd=%6 Ps=%7 Temp=%8\n") .arg(Name).arg(l).arg(w).arg(ad).arg(as).arg(pd).arg(ps).arg(getProperty("Temp")->Value); } - s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); + + if (netlistModel) + { + s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); + } return s; } +QString MOSFET_sub::cdl_netlist() +{ + return spice_netlist(false, false); +} + // ------------------------------------------------------- Element* MOSFET_sub::info(QString& Name, char* &BitmapFile, bool getNewOne) { diff --git a/qucs/components/mosfet_sub.h b/qucs/components/mosfet_sub.h index 677b62446..b01671ce7 100644 --- a/qucs/components/mosfet_sub.h +++ b/qucs/components/mosfet_sub.h @@ -39,6 +39,7 @@ class MOSFET_sub : public Basic_MOSFET { protected: void createSymbol(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/mutual.cpp b/qucs/components/mutual.cpp index 76b16eae7..af518be9e 100644 --- a/qucs/components/mutual.cpp +++ b/qucs/components/mutual.cpp @@ -59,11 +59,11 @@ Mutual::Mutual() SpiceModel = "K"; Props.append(new Property("L1", "1 mH", false, - QObject::tr("inductance of coil 1"))); + QObject::tr("inductance of coil 1"))); Props.append(new Property("L2", "1 mH", false, - QObject::tr("inductance of coil 2"))); + QObject::tr("inductance of coil 2"))); Props.append(new Property("k", "0.9", false, - QObject::tr("coupling factor between coil 1 and 2"))); + QObject::tr("coupling factor between coil 1 and 2"))); } Mutual::~Mutual() diff --git a/qucs/components/mutual.h b/qucs/components/mutual.h index 8a75b896c..de81409d6 100644 --- a/qucs/components/mutual.h +++ b/qucs/components/mutual.h @@ -27,8 +27,9 @@ class Mutual : public Component { ~Mutual(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/mutual2.cpp b/qucs/components/mutual2.cpp index 1cb659b43..9afcd731f 100644 --- a/qucs/components/mutual2.cpp +++ b/qucs/components/mutual2.cpp @@ -147,4 +147,3 @@ QString Mutual2::spice_netlist(bool isXyce, bool) .arg(spicecompat::normalize_value(getProperty("k23")->Value)); return s; } - diff --git a/qucs/components/mutual2.h b/qucs/components/mutual2.h index 1051127d1..15a23c91b 100644 --- a/qucs/components/mutual2.h +++ b/qucs/components/mutual2.h @@ -27,8 +27,9 @@ class Mutual2 : public Component { ~Mutual2(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/mutualx.cpp b/qucs/components/mutualx.cpp index e5f0480be..4ae6cf7b7 100644 --- a/qucs/components/mutualx.cpp +++ b/qucs/components/mutualx.cpp @@ -169,10 +169,10 @@ void MutualX::createSymbol() } else { // add new coils for(int i = 0; i < dCoils; i++) { // add new properties for coils - Props.insert(oldCoils+1, new Property("L"+QString::number(Num-i), - "1 mH", - false, - QObject::tr("inductance of coil") + " " + QString::number(Num-i))); + Props.insert(oldCoils+1, new Property("L"+QString::number(Num-i), + "1 mH", + false, + QObject::tr("inductance of coil") + " " + QString::number(Num-i))); } for(int i = 1,state=1; i < Num; i++) @@ -196,7 +196,7 @@ void MutualX::createSymbol() p1++; } // adjust coupling coeffs names - for(int i = 1,state=1; i < Num; i++) + for(int i = 1,state=1; i < Num; i++) for(int j = i+1; j <= Num; j++,state++) { Props.at(Num+state)->Name = "k" + QString::number(i) + QString::number(j); Props.at(Num+state)->Description = @@ -257,6 +257,7 @@ QString MutualX::spice_netlist(bool isXyce, bool) s += QStringLiteral("%1 %2 %3 %4\n").arg(kij).arg(li).arg(lj).arg(val_k); } } - return s; + return s; } + diff --git a/qucs/components/mutualx.h b/qucs/components/mutualx.h index 3beb6e7a8..e46d06eef 100644 --- a/qucs/components/mutualx.h +++ b/qucs/components/mutualx.h @@ -35,7 +35,7 @@ class MutualX : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/opamp.h b/qucs/components/opamp.h index dfceafeae..d6c60c208 100644 --- a/qucs/components/opamp.h +++ b/qucs/components/opamp.h @@ -28,7 +28,7 @@ class OpAmp : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/param_sweep.h b/qucs/components/param_sweep.h index 0c4b02a93..4781c64b3 100644 --- a/qucs/components/param_sweep.h +++ b/qucs/components/param_sweep.h @@ -34,7 +34,7 @@ class Param_Sweep : public qucs::component::SimulationComponent { QString getCounterVar(); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString param_split_str=";"; }; diff --git a/qucs/components/potentiometer.h b/qucs/components/potentiometer.h index e6f0f642e..70119bc61 100644 --- a/qucs/components/potentiometer.h +++ b/qucs/components/potentiometer.h @@ -22,7 +22,7 @@ class potentiometer : public Component static Element* info(QString&, char* &, bool getNewOne=false); protected: void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif /* potentiometer_H */ diff --git a/qucs/components/resistor.cpp b/qucs/components/resistor.cpp index 284f41c28..554e34bc3 100644 --- a/qucs/components/resistor.cpp +++ b/qucs/components/resistor.cpp @@ -53,7 +53,7 @@ Component* Resistor::newOne() return new Resistor(Props.back()->Value != "US"); } -QString Resistor::spice_netlist(bool , bool) +QString Resistor::spice_netlist(bool, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -66,12 +66,15 @@ QString Resistor::spice_netlist(bool , bool) s += QStringLiteral(" %1").arg(spicecompat::normalize_value(Props.at(0)->Value)); - if (!Tc1.isEmpty()) { - s += " tc1=" + Tc1; - } + if (!isCdl) + { + if (!Tc1.isEmpty()) { + s += " tc1=" + Tc1; + } - if (!Tc2.isEmpty()) { - s += " tc2=" + Tc2; + if (!Tc2.isEmpty()) { + s += " tc2=" + Tc2; + } } s += QStringLiteral(" \n"); @@ -79,6 +82,11 @@ QString Resistor::spice_netlist(bool , bool) return s; } +QString Resistor::cdl_netlist() +{ + return spice_netlist(false, true); +} + QString Resistor::va_code() { QString val = vacompat::normalize_value(Props.at(0)->Value); @@ -88,12 +96,12 @@ QString Resistor::va_code() QString s = ""; QString Vpm = vacompat::normalize_voltage(plus,minus); QString Ipm = vacompat::normalize_current(plus,minus,true); - + if (plus=="gnd") s += QStringLiteral("%1 <+ -(%2/( %3 ));\n").arg(Ipm).arg(Vpm).arg(val); else s+= QStringLiteral("%1 <+ %2/( %3 );\n").arg(Ipm).arg(Vpm).arg(val); s += QStringLiteral("%1 <+ white_noise( 4.0*`P_K*( %2 + 273.15) / ( %3 ), \"thermal\" );\n") .arg(Ipm).arg(valTemp).arg(val); - + return s; } diff --git a/qucs/components/resistor.h b/qucs/components/resistor.h index 836207a4b..4c24b9128 100644 --- a/qucs/components/resistor.h +++ b/qucs/components/resistor.h @@ -31,6 +31,7 @@ class Resistor : public MultiViewComponent { protected: QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); QString va_code(); void createSymbol(); }; diff --git a/qucs/components/rlcg.cpp b/qucs/components/rlcg.cpp index 93833a95a..2c0dffb04 100644 --- a/qucs/components/rlcg.cpp +++ b/qucs/components/rlcg.cpp @@ -106,7 +106,9 @@ QString RLCG::spice_netlist(bool isXyce, bool) QString LEN = spicecompat::normalize_value(getProperty("Length")->Value); QString modname = "mod_" + Name; s += QStringLiteral("O%1 %2 0 %3 0 %4\n").arg(Name).arg(in).arg(out).arg(modname); + s += QStringLiteral(".MODEL %1 LTRA(R=%2 C=%3 L=%4 G=%5 LEN=%6)\n") - .arg(modname).arg(R).arg(C).arg(L).arg(G).arg(LEN); + .arg(modname).arg(R).arg(C).arg(L).arg(G).arg(LEN); return s; } + diff --git a/qucs/components/rlcg.h b/qucs/components/rlcg.h index fb6fdbe8f..3a9cde6ac 100644 --- a/qucs/components/rlcg.h +++ b/qucs/components/rlcg.h @@ -26,8 +26,9 @@ class RLCG : public Component { ~RLCG(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/source_ac.h b/qucs/components/source_ac.h index 25ba1ec7f..17cfbf6df 100644 --- a/qucs/components/source_ac.h +++ b/qucs/components/source_ac.h @@ -30,7 +30,7 @@ class Source_ac : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString netlist(); }; diff --git a/qucs/components/sp_sim.h b/qucs/components/sp_sim.h index 9698de250..ff9e3ecf0 100644 --- a/qucs/components/sp_sim.h +++ b/qucs/components/sp_sim.h @@ -36,7 +36,7 @@ class SP_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); void recreate(Schematic*); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QStringList getExtraVariables(); }; diff --git a/qucs/components/sparamfile.h b/qucs/components/sparamfile.h index 254973869..955937a4e 100644 --- a/qucs/components/sparamfile.h +++ b/qucs/components/sparamfile.h @@ -35,7 +35,7 @@ class SParamFile : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/spicefile.cpp b/qucs/components/spicefile.cpp index dc06fa7bc..36dd1dc0e 100644 --- a/qucs/components/spicefile.cpp +++ b/qucs/components/spicefile.cpp @@ -506,3 +506,8 @@ QString SpiceFile::spice_netlist(bool, bool) s += " " + spicecompat::getSubcktName(getSubcircuitFile()) + "\n"; return s; } + +QString SpiceFile::cdl_netlist() +{ + return spice_netlist(false); +} diff --git a/qucs/components/spicefile.h b/qucs/components/spicefile.h index 6ac26eab8..19b8c3145 100644 --- a/qucs/components/spicefile.h +++ b/qucs/components/spicefile.h @@ -53,7 +53,8 @@ class SpiceFile : public QObject, public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); private slots: void slotGetNetlist(); diff --git a/qucs/components/subcircuit.cpp b/qucs/components/subcircuit.cpp index ab4c8560d..d9b652aaf 100644 --- a/qucs/components/subcircuit.cpp +++ b/qucs/components/subcircuit.cpp @@ -238,6 +238,11 @@ QString Subcircuit::spice_netlist(bool, bool) { return s; } +QString Subcircuit::cdl_netlist() +{ + return spice_netlist(false, true); +} + // ------------------------------------------------------- QString Subcircuit::vhdlCode(int) { QString f = misc::properFileName(Props.at(0)->Value); diff --git a/qucs/components/subcircuit.h b/qucs/components/subcircuit.h index 91bc8e74a..0be677b1e 100644 --- a/qucs/components/subcircuit.h +++ b/qucs/components/subcircuit.h @@ -32,7 +32,8 @@ class Subcircuit : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/subcirport.h b/qucs/components/subcirport.h index f6adf78e7..d7378dbb2 100644 --- a/qucs/components/subcirport.h +++ b/qucs/components/subcirport.h @@ -30,7 +30,7 @@ class SubCirPort : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/tff_SR.h b/qucs/components/tff_SR.h index b4da9fb53..735e65ceb 100644 --- a/qucs/components/tff_SR.h +++ b/qucs/components/tff_SR.h @@ -24,7 +24,7 @@ class tff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif /* tff_SR_H */ diff --git a/qucs/components/vacomponent.h b/qucs/components/vacomponent.h index 9ce591163..baa0283ad 100644 --- a/qucs/components/vacomponent.h +++ b/qucs/components/vacomponent.h @@ -41,7 +41,7 @@ class vacomponent : public Component protected: void createSymbol(QJsonObject json); void parseJson(QJsonObject json); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; diff --git a/qucs/components/vcresistor.h b/qucs/components/vcresistor.h index ff7e50c0f..0cd266d60 100644 --- a/qucs/components/vcresistor.h +++ b/qucs/components/vcresistor.h @@ -29,7 +29,7 @@ class vcresistor : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/vfile.h b/qucs/components/vfile.h index 91810089c..30b7b334e 100644 --- a/qucs/components/vfile.h +++ b/qucs/components/vfile.h @@ -32,7 +32,7 @@ class vFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/volt_dc.cpp b/qucs/components/volt_dc.cpp index d9d961d4f..e66826f1d 100644 --- a/qucs/components/volt_dc.cpp +++ b/qucs/components/volt_dc.cpp @@ -45,7 +45,7 @@ Volt_dc::Volt_dc() SpiceModel = "V"; Props.append(new Property("U", "1 V", true, - QObject::tr("voltage in Volts"))); + QObject::tr("voltage in Volts"))); rotate(); // fix historical flaw } @@ -59,7 +59,7 @@ Component* Volt_dc::newOne() return new Volt_dc(); } -QString Volt_dc::spice_netlist(bool, bool) +QString Volt_dc::spice_netlist(bool, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { @@ -68,10 +68,16 @@ QString Volt_dc::spice_netlist(bool, bool) s += " "+ nam; // node names } - s += QStringLiteral(" DC %1\n").arg(spicecompat::normalize_value(Props.at(0)->Value)); + s += QStringLiteral(" %1%2\n").arg(isCdl ? "" : "DC ").arg(spicecompat::normalize_value(Props.at(0)->Value)); + return s; } +QString Volt_dc::cdl_netlist() +{ + return spice_netlist(false, true); +} + Element* Volt_dc::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("dc Voltage Source"); diff --git a/qucs/components/volt_dc.h b/qucs/components/volt_dc.h index 956ca68d5..1a2bdb37b 100644 --- a/qucs/components/volt_dc.h +++ b/qucs/components/volt_dc.h @@ -27,7 +27,10 @@ class Volt_dc : public Component { ~Volt_dc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + +protected: QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/components/vprobe.h b/qucs/components/vprobe.h index dd06826f9..2bdd461c9 100644 --- a/qucs/components/vprobe.h +++ b/qucs/components/vprobe.h @@ -29,7 +29,7 @@ class vProbe : public Component { static Element* info(QString&, char* &, bool getNewOne=false); QString getProbeVariable(bool isXyce = false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/spicecomponents/BJT_SPICE.cpp b/qucs/spicecomponents/BJT_SPICE.cpp index 34a21acd7..7bf2c79ff 100644 --- a/qucs/spicecomponents/BJT_SPICE.cpp +++ b/qucs/spicecomponents/BJT_SPICE.cpp @@ -195,7 +195,7 @@ QString BJT_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString Q= Props.at(3)->Value; QString Q_Line_2= Props.at(4)->Value; QString Q_Line_3= Props.at(5)->Value; @@ -211,3 +211,9 @@ QString BJT_SPICE::spice_netlist(bool, bool) return s; } + +QString BJT_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} + diff --git a/qucs/spicecomponents/BJT_SPICE.h b/qucs/spicecomponents/BJT_SPICE.h index 100b75f4f..e22de63f0 100644 --- a/qucs/spicecomponents/BJT_SPICE.h +++ b/qucs/spicecomponents/BJT_SPICE.h @@ -18,7 +18,8 @@ * (at your option) any later version. * * * ***************************************************************************/ - #ifndef BJT_SPICE_H + +#ifndef BJT_SPICE_H #define BJT_SPICE_H #include "components/component.h" @@ -33,10 +34,12 @@ class BJT_SPICE : public MultiViewComponent { static Element* infoPNP4(QString&, char* &, bool getNewOne=false); static Element* infoNPN5(QString&, char* &, bool getNewOne=false); static Element* infoPNP5(QString&, char* &, bool getNewOne=false); + protected: void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // NPN_SPICE_H diff --git a/qucs/spicecomponents/C_SPICE.cpp b/qucs/spicecomponents/C_SPICE.cpp index a27719d2f..b1892c664 100644 --- a/qucs/spicecomponents/C_SPICE.cpp +++ b/qucs/spicecomponents/C_SPICE.cpp @@ -133,3 +133,13 @@ QString C_SPICE::spice_netlist(bool, bool) s += "\n"; return s; } + +QString C_SPICE::cdl_netlist() +{ + if (Ports.size() == 2) + { + return spice_netlist(false, true); + } + + return QString(); +} diff --git a/qucs/spicecomponents/C_SPICE.h b/qucs/spicecomponents/C_SPICE.h index 8987f2cff..8e4851a97 100644 --- a/qucs/spicecomponents/C_SPICE.h +++ b/qucs/spicecomponents/C_SPICE.h @@ -30,10 +30,12 @@ class C_SPICE: public MultiViewComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static Element* info_C3(QString&, char* &, bool getNewOne=false); + protected: void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // C_SPICE_H diff --git a/qucs/spicecomponents/DIODE_SPICE.cpp b/qucs/spicecomponents/DIODE_SPICE.cpp index eb217501e..73cd6f2e7 100644 --- a/qucs/spicecomponents/DIODE_SPICE.cpp +++ b/qucs/spicecomponents/DIODE_SPICE.cpp @@ -123,7 +123,7 @@ QString DIODE_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString D= Props.at(0)->Value; QString D_Line_2= Props.at(1)->Value; QString D_Line_3= Props.at(2)->Value; @@ -138,3 +138,13 @@ QString DIODE_SPICE::spice_netlist(bool, bool) s += "\n"; return s; } + +QString DIODE_SPICE::cdl_netlist() +{ + if (Ports.size() == 2) + { + return spice_netlist(false, true); + } + + return QString(); +} diff --git a/qucs/spicecomponents/DIODE_SPICE.h b/qucs/spicecomponents/DIODE_SPICE.h index 241fa670f..d650f2d09 100644 --- a/qucs/spicecomponents/DIODE_SPICE.h +++ b/qucs/spicecomponents/DIODE_SPICE.h @@ -30,10 +30,12 @@ class DIODE_SPICE : public MultiViewComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static Element* info_DIODE3(QString&, char* &, bool getNewOne=false); + protected: void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // DIODE_SPICE_H diff --git a/qucs/spicecomponents/L_SPICE.cpp b/qucs/spicecomponents/L_SPICE.cpp index 27471cb30..3b4cb8912 100644 --- a/qucs/spicecomponents/L_SPICE.cpp +++ b/qucs/spicecomponents/L_SPICE.cpp @@ -91,7 +91,7 @@ QString L_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString L= Props.at(0)->Value; QString L_Line_2= Props.at(1)->Value; QString L_Line_3= Props.at(2)->Value; @@ -107,3 +107,8 @@ QString L_SPICE::spice_netlist(bool, bool) return s; } + +QString L_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/L_SPICE.h b/qucs/spicecomponents/L_SPICE.h index 596cc6acd..cc9de1c46 100644 --- a/qucs/spicecomponents/L_SPICE.h +++ b/qucs/spicecomponents/L_SPICE.h @@ -29,9 +29,11 @@ class L_SPICE : public Component { ~L_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // L_SPICE_H diff --git a/qucs/spicecomponents/MOS_SPICE.cpp b/qucs/spicecomponents/MOS_SPICE.cpp index 104ab7270..60012d299 100644 --- a/qucs/spicecomponents/MOS_SPICE.cpp +++ b/qucs/spicecomponents/MOS_SPICE.cpp @@ -249,3 +249,13 @@ QString MOS_SPICE::spice_netlist(bool, bool) return s; } + +QString MOS_SPICE::cdl_netlist() +{ + if (Ports.size() == 4) + { + return spice_netlist(false, true); + } + + return QString(); +} diff --git a/qucs/spicecomponents/MOS_SPICE.h b/qucs/spicecomponents/MOS_SPICE.h index 1f876ce77..4729986f0 100644 --- a/qucs/spicecomponents/MOS_SPICE.h +++ b/qucs/spicecomponents/MOS_SPICE.h @@ -35,10 +35,12 @@ class MOS_SPICE : public MultiViewComponent { static Element* info_PX3pin(QString&, char* &, bool getNewOne=false); static Element* info_NX4pin(QString&, char* &, bool getNewOne=false); static Element* info_PX4pin(QString&, char* &, bool getNewOne=false); + protected: void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // MOS_SPICE_H diff --git a/qucs/spicecomponents/NJF_SPICE.cpp b/qucs/spicecomponents/NJF_SPICE.cpp index b26d4a7b6..adbd8e7ec 100644 --- a/qucs/spicecomponents/NJF_SPICE.cpp +++ b/qucs/spicecomponents/NJF_SPICE.cpp @@ -117,3 +117,8 @@ QString NJF_SPICE::spice_netlist(bool, bool) return s; } + +QString NJF_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/NJF_SPICE.h b/qucs/spicecomponents/NJF_SPICE.h index 08d79f17a..a69fabdfc 100644 --- a/qucs/spicecomponents/NJF_SPICE.h +++ b/qucs/spicecomponents/NJF_SPICE.h @@ -29,9 +29,11 @@ class NJF_SPICE : public Component { ~NJF_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // NJF_SPICE_H diff --git a/qucs/spicecomponents/NMOS_SPICE.cpp b/qucs/spicecomponents/NMOS_SPICE.cpp index c9122279d..23c9b6baf 100644 --- a/qucs/spicecomponents/NMOS_SPICE.cpp +++ b/qucs/spicecomponents/NMOS_SPICE.cpp @@ -32,7 +32,7 @@ NMOS_SPICE::NMOS_SPICE() Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line(-20, 0,-14, 0,QPen(Qt::darkRed,2))); - + Lines.append(new qucs::Line(-10,-11, 0,-11,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0,-11, 0,-20,QPen(Qt::darkRed,2))); @@ -41,21 +41,21 @@ NMOS_SPICE::NMOS_SPICE() Lines.append(new qucs::Line(-10, 11, 0, 11,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0, 11, 0, 20,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-10, 0, 10, 0,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 10, 0, 20, 0,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-10,-16,-10, -7,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line(-10, 7,-10, 16,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -9, 0, -4, -5,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -9, 0, -4, 5,QPen(Qt::darkRed,2))); - + Lines.append(new qucs::Line(-10, -8,-10, 8,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); - + //Texts.append(new Text(30,12,"NMOS",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port( 0,-30)); //D Ports.append(new Port(-30, 0)); //G Ports.append(new Port( 0, 30)); //S @@ -110,7 +110,7 @@ QString NMOS_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString M= Props.at(0)->Value; QString M_Line_2= Props.at(1)->Value; QString M_Line_3= Props.at(2)->Value; @@ -126,3 +126,8 @@ QString NMOS_SPICE::spice_netlist(bool, bool) return s; } + +QString NMOS_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/NMOS_SPICE.h b/qucs/spicecomponents/NMOS_SPICE.h index 2f21aea9c..e5ab93f09 100644 --- a/qucs/spicecomponents/NMOS_SPICE.h +++ b/qucs/spicecomponents/NMOS_SPICE.h @@ -29,9 +29,11 @@ class NMOS_SPICE : public Component { ~NMOS_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // NMOS_SPICE_H diff --git a/qucs/spicecomponents/NPN_SPICE.cpp b/qucs/spicecomponents/NPN_SPICE.cpp index 35dd2dca4..863957378 100644 --- a/qucs/spicecomponents/NPN_SPICE.cpp +++ b/qucs/spicecomponents/NPN_SPICE.cpp @@ -29,25 +29,25 @@ NPN_SPICE::NPN_SPICE() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-10, -5, 0,-15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line( 0,-15, 0,-20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line(-10, 5, 0, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line( 0, 15, 0, 20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line( -6, 15, 0, 15,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 9, 0, 15,QPen(Qt::darkRed,3))); - + Texts.append(new Text(30,12,"NPN",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port(0, -30)); Ports.append(new Port(-30, 0)); @@ -102,7 +102,7 @@ QString NPN_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString Q= Props.at(0)->Value; QString Q_Line_2= Props.at(1)->Value; QString Q_Line_3= Props.at(2)->Value; @@ -118,3 +118,8 @@ QString NPN_SPICE::spice_netlist(bool, bool) return s; } + +QString NPN_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/NPN_SPICE.h b/qucs/spicecomponents/NPN_SPICE.h index 97753463a..ad1245ff6 100644 --- a/qucs/spicecomponents/NPN_SPICE.h +++ b/qucs/spicecomponents/NPN_SPICE.h @@ -29,9 +29,11 @@ class NPN_SPICE : public Component { ~NPN_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // NPN_SPICE_H diff --git a/qucs/spicecomponents/PJF_SPICE.cpp b/qucs/spicecomponents/PJF_SPICE.cpp index 1e71b65c3..376b0a959 100644 --- a/qucs/spicecomponents/PJF_SPICE.cpp +++ b/qucs/spicecomponents/PJF_SPICE.cpp @@ -29,25 +29,25 @@ PJF_SPICE::PJF_SPICE() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); + Lines.append(new qucs::Line(-10,-10, 0,-10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-10, 0,-20,QPen(Qt::darkRed,3))); - Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); + Lines.append(new qucs::Line(-10, 10, 0, 10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 10, 0, 20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line(-16, -5,-21, 0,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line(-16, 5,-21, 0,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); - + //Texts.append(new Text(30,12,"PJF",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port( 0,-30)); //D Ports.append(new Port(-30, 0)); //G Ports.append(new Port( 0, 30)); //S @@ -101,7 +101,7 @@ QString PJF_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString J= Props.at(0)->Value; QString J_Line_2= Props.at(1)->Value; QString J_Line_3= Props.at(2)->Value; @@ -117,3 +117,8 @@ QString PJF_SPICE::spice_netlist(bool, bool) return s; } + +QString PJF_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/PJF_SPICE.h b/qucs/spicecomponents/PJF_SPICE.h index 6a12dfe34..f8f926c45 100644 --- a/qucs/spicecomponents/PJF_SPICE.h +++ b/qucs/spicecomponents/PJF_SPICE.h @@ -29,9 +29,11 @@ class PJF_SPICE : public Component { ~PJF_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // PJF_SPICE_H diff --git a/qucs/spicecomponents/PMOS_SPICE.cpp b/qucs/spicecomponents/PMOS_SPICE.cpp index 45fb9d4e3..4c408fb64 100644 --- a/qucs/spicecomponents/PMOS_SPICE.cpp +++ b/qucs/spicecomponents/PMOS_SPICE.cpp @@ -32,7 +32,7 @@ PMOS_SPICE::PMOS_SPICE() Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line(-20, 0,-14, 0,QPen(Qt::darkRed,2))); - + Lines.append(new qucs::Line(-10,-11, 0,-11,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0,-11, 0,-20,QPen(Qt::darkRed,2))); @@ -41,21 +41,21 @@ PMOS_SPICE::PMOS_SPICE() Lines.append(new qucs::Line(-10, 11, 0, 11,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0, 11, 0, 20,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-10, 0, 10, 0,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( 10, 0, 20, 0,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-10,-16,-10, -7,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line(-10, 7,-10, 16,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -1, 0, -6, -5,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -1, 0, -6, 5,QPen(Qt::darkRed,2))); - + Lines.append(new qucs::Line(-10, -8,-10, 8,QPen(Qt::darkRed,2))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); - + //Texts.append(new Text(30,12,"PMOS",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port( 0,-30)); //D Ports.append(new Port(-30, 0)); //G Ports.append(new Port( 0, 30)); //S @@ -110,7 +110,7 @@ QString PMOS_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString M= Props.at(0)->Value; QString M_Line_2= Props.at(1)->Value; QString M_Line_3= Props.at(2)->Value; @@ -126,3 +126,8 @@ QString PMOS_SPICE::spice_netlist(bool, bool) return s; } + +QString PMOS_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/PMOS_SPICE.h b/qucs/spicecomponents/PMOS_SPICE.h index ecebffd97..86de3e7b5 100644 --- a/qucs/spicecomponents/PMOS_SPICE.h +++ b/qucs/spicecomponents/PMOS_SPICE.h @@ -29,9 +29,11 @@ class PMOS_SPICE : public Component { ~PMOS_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // PMOS_SPICE_H diff --git a/qucs/spicecomponents/PNP_SPICE.cpp b/qucs/spicecomponents/PNP_SPICE.cpp index e09ad409d..d6e74e1ad 100644 --- a/qucs/spicecomponents/PNP_SPICE.cpp +++ b/qucs/spicecomponents/PNP_SPICE.cpp @@ -29,27 +29,27 @@ PNP_SPICE::PNP_SPICE() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-10, -5, 0,-15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line( 0,-15, 0,-20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line(-10, 5, 0, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line( 0, 15, 0, 20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line( -5, 10, -5, 16,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( -5, 10, 1, 10,QPen(Qt::darkRed,3))); - + Texts.append(new Text(30,12,"PNP",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port( 0,-30)); Ports.append(new Port(-30, 0)); Ports.append(new Port( 0, 30)); @@ -103,7 +103,7 @@ QString PNP_SPICE::spice_netlist(bool, bool) if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString Q= Props.at(0)->Value; QString Q_Line_2= Props.at(1)->Value; QString Q_Line_3= Props.at(2)->Value; @@ -119,3 +119,8 @@ QString PNP_SPICE::spice_netlist(bool, bool) return s; } + +QString PNP_SPICE::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/PNP_SPICE.h b/qucs/spicecomponents/PNP_SPICE.h index c7ba159cf..351149699 100644 --- a/qucs/spicecomponents/PNP_SPICE.h +++ b/qucs/spicecomponents/PNP_SPICE.h @@ -29,9 +29,11 @@ class PNP_SPICE : public Component { ~PNP_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // PNP_SPICE_H diff --git a/qucs/spicecomponents/R_SPICE.cpp b/qucs/spicecomponents/R_SPICE.cpp index 5a9db9f85..1bdc9fc87 100644 --- a/qucs/spicecomponents/R_SPICE.cpp +++ b/qucs/spicecomponents/R_SPICE.cpp @@ -138,3 +138,13 @@ QString R_SPICE::spice_netlist(bool, bool) return s; } + +QString R_SPICE::cdl_netlist() +{ + if (Ports.size() == 2) + { + return spice_netlist(false, true); + } + + return QString(); +} diff --git a/qucs/spicecomponents/R_SPICE.h b/qucs/spicecomponents/R_SPICE.h index cbca99def..a168e0923 100644 --- a/qucs/spicecomponents/R_SPICE.h +++ b/qucs/spicecomponents/R_SPICE.h @@ -30,10 +30,12 @@ class R_SPICE : public MultiViewComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static Element* info_R3(QString&, char* &, bool getNewOne=false); + protected: void createSymbol(); QString netlist(); QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif // R_SPICE_H diff --git a/qucs/spicecomponents/S4Q_I.cpp b/qucs/spicecomponents/S4Q_I.cpp index b8dfa96f5..65db28529 100644 --- a/qucs/spicecomponents/S4Q_I.cpp +++ b/qucs/spicecomponents/S4Q_I.cpp @@ -4,7 +4,6 @@ begin : Thu May 21 2015 copyright : (C) 2015 by Vadim Kuznetsov email : ra3xdh@gmail.com - SPICE Version : Friday Sept 11 2015 copyright : (C) 2015 Mike Brinson email : mbrin72043@yahoo.co.uk @@ -37,8 +36,8 @@ S4Q_I::S4Q_I() Lines.append(new qucs::Line( -8, 0, 8, 0,QPen(Qt::darkRed,3, Qt::SolidLine, Qt::FlatCap))); Lines.append(new qucs::Line( -8, 0, -4, -4,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( -8, 0, -4, 4,QPen(Qt::darkRed,3))); - - Ports.append(new Port( 30, 0)); + + Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); x1 = -30; y1 = -14; @@ -101,3 +100,8 @@ QString S4Q_I::spice_netlist(bool, bool) return s; } + +QString S4Q_I::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/S4Q_I.h b/qucs/spicecomponents/S4Q_I.h index 06f5a5373..d33a0c20c 100644 --- a/qucs/spicecomponents/S4Q_I.h +++ b/qucs/spicecomponents/S4Q_I.h @@ -4,7 +4,6 @@ begin : Thu May 21 2015 copyright : (C) 2015 by Vadim Kuznetsov email : ra3xdh@gmail.com - SPICE Version : Friday Sept 11 2015 copyright : (C) 2015 Mike Brinson email : mbrin72043@yahoo.co.uk @@ -31,8 +30,10 @@ class S4Q_I : public Component { ~S4Q_I(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/spicecomponents/S4Q_V.cpp b/qucs/spicecomponents/S4Q_V.cpp index 4c0a43346..0dd7657eb 100644 --- a/qucs/spicecomponents/S4Q_V.cpp +++ b/qucs/spicecomponents/S4Q_V.cpp @@ -4,7 +4,6 @@ begin : Thu May 21 2015 copyright : (C) 2015 by Vadim Kuznetsov email : ra3xdh@gmail.com - SPICE Version : Friday Sept 11 2015 copyright : (C) 2015 Mike Brinson email : mbrin72043@yahoo.co.uk @@ -33,7 +32,7 @@ S4Q_V::S4Q_V() Lines.append(new qucs::Line(-30, 0,-12, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 30, 0, 12, 0,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line( 18, 5, 18, 11,QPen(Qt::red,2))); Lines.append(new qucs::Line( 21, 8, 15, 8,QPen(Qt::red,2))); Lines.append(new qucs::Line(-18, 5,-18, 11,QPen(Qt::black,2))); @@ -101,3 +100,8 @@ QString S4Q_V::spice_netlist(bool, bool) return s; } + +QString S4Q_V::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/S4Q_V.h b/qucs/spicecomponents/S4Q_V.h index 89fb04e3a..f1acac012 100644 --- a/qucs/spicecomponents/S4Q_V.h +++ b/qucs/spicecomponents/S4Q_V.h @@ -4,7 +4,6 @@ begin : Thu May 21 2015 copyright : (C) 2015 by Vadim Kuznetsov email : ra3xdh@gmail.com - SPICE Version : Friday Sept 11 2015 copyright : (C) 2015 Mike Brinson email : mbrin72043@yahoo.co.uk @@ -31,8 +30,10 @@ class S4Q_V : public Component { ~S4Q_V(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/spicecomponents/spicegeneric.cpp b/qucs/spicecomponents/spicegeneric.cpp index f26c8e950..9104c866e 100644 --- a/qucs/spicecomponents/spicegeneric.cpp +++ b/qucs/spicecomponents/spicegeneric.cpp @@ -147,3 +147,8 @@ QString SpiceGeneric::spice_netlist(bool, bool) return s; } + +QString SpiceGeneric::cdl_netlist() +{ + return spice_netlist(false, true); +} diff --git a/qucs/spicecomponents/spicegeneric.h b/qucs/spicecomponents/spicegeneric.h index 6587c437b..c3daf87fa 100644 --- a/qucs/spicecomponents/spicegeneric.h +++ b/qucs/spicecomponents/spicegeneric.h @@ -37,8 +37,8 @@ class SpiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); - + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); }; #endif diff --git a/qucs/spicecomponents/spicelibcomp.cpp b/qucs/spicecomponents/spicelibcomp.cpp index a2f7a4819..1c279a95a 100644 --- a/qucs/spicecomponents/spicelibcomp.cpp +++ b/qucs/spicecomponents/spicelibcomp.cpp @@ -239,6 +239,11 @@ QString SpiceLibComp::spice_netlist(bool, bool) return s; } +QString SpiceLibComp::cdl_netlist() +{ + return spice_netlist(false, true); +} + QString SpiceLibComp::getSpiceLibrary() { if (isActive != COMP_IS_ACTIVE) return QString(); diff --git a/qucs/spicecomponents/spicelibcomp.h b/qucs/spicecomponents/spicelibcomp.h index aa63b58fe..dd17d0800 100644 --- a/qucs/spicecomponents/spicelibcomp.h +++ b/qucs/spicecomponents/spicelibcomp.h @@ -30,10 +30,12 @@ class SpiceLibComp : public MultiViewComponent { QString getSpiceLibrary(); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString cdl_netlist(); void createSymbol(); void remakeSymbol(int No, QStringList &pin_names); int loadSymbol(const QString&); + private: void removeUnusedPorts(); }; diff --git a/qucs/spicecomponents/xsp_cmlib.cpp b/qucs/spicecomponents/xsp_cmlib.cpp index 41b808d30..bce6117db 100644 --- a/qucs/spicecomponents/xsp_cmlib.cpp +++ b/qucs/spicecomponents/xsp_cmlib.cpp @@ -86,7 +86,7 @@ QString XSP_CMlib::getSpiceInit() return s; } -QString XSP_CMlib::spice_netlist(, bool) +QString XSP_CMlib::spice_netlist(bool, bool) { return QString(); } diff --git a/qucs/spicecomponents/xsp_cmlib.h b/qucs/spicecomponents/xsp_cmlib.h index 79227fd11..4d8d90cab 100644 --- a/qucs/spicecomponents/xsp_cmlib.h +++ b/qucs/spicecomponents/xsp_cmlib.h @@ -32,7 +32,7 @@ class XSP_CMlib : public Component { QString getSpiceInit(); protected: - QString spice_netlist(bool, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; diff --git a/qucs/spicecomponents/xsp_codemodel.cpp b/qucs/spicecomponents/xsp_codemodel.cpp index 61f71f8f8..7c4a15c0d 100644 --- a/qucs/spicecomponents/xsp_codemodel.cpp +++ b/qucs/spicecomponents/xsp_codemodel.cpp @@ -69,7 +69,7 @@ Element* XSP_CodeModel::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString XSP_CodeModel::spice_netlist(, bool) +QString XSP_CodeModel::spice_netlist(bool, bool) { return QString(); } diff --git a/qucs/spicecomponents/xsp_codemodel.h b/qucs/spicecomponents/xsp_codemodel.h index 63c31c21d..ae0d74ec3 100644 --- a/qucs/spicecomponents/xsp_codemodel.h +++ b/qucs/spicecomponents/xsp_codemodel.h @@ -30,7 +30,7 @@ class XSP_CodeModel : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; diff --git a/qucs/spicecomponents/xspicegeneric.h b/qucs/spicecomponents/xspicegeneric.h index b05ca5dad..9b5e878eb 100644 --- a/qucs/spicecomponents/xspicegeneric.h +++ b/qucs/spicecomponents/xspicegeneric.h @@ -37,7 +37,7 @@ class XspiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; From 718d9c37ca874c4baa5c7a7efd2a70cd27a1c1e7 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Tue, 17 Dec 2024 11:00:45 +0100 Subject: [PATCH 04/10] New feature CDL netlist export -Introduced new parameter for cdl-type netlist export to Component::getExpression() and derivatives. It is used for CDL type specific netlist parameter export. Signed-off-by: ThomasZecha --- qucs/components/component.cpp | 2 +- qucs/components/component.h | 2 +- qucs/components/equation.cpp | 9 ++++++--- qucs/components/equation.h | 2 +- qucs/components/iprobe.h | 5 +++-- qucs/components/mosfet_sub.cpp | 6 +++--- qucs/spicecomponents/incl_script.cpp | 4 ++-- qucs/spicecomponents/incl_script.h | 2 +- qucs/spicecomponents/sp_func.cpp | 4 ++-- qucs/spicecomponents/sp_func.h | 2 +- qucs/spicecomponents/sp_globalpar.cpp | 4 ++-- qucs/spicecomponents/sp_globalpar.h | 2 +- qucs/spicecomponents/sp_ic.cpp | 4 ++-- qucs/spicecomponents/sp_ic.h | 2 +- qucs/spicecomponents/sp_nodeset.cpp | 4 ++-- qucs/spicecomponents/sp_nodeset.h | 2 +- qucs/spicecomponents/sp_options.cpp | 4 ++-- qucs/spicecomponents/sp_options.h | 2 +- qucs/spicecomponents/sp_parameter.cpp | 11 +++++++++-- qucs/spicecomponents/sp_parameter.h | 2 +- 20 files changed, 43 insertions(+), 32 deletions(-) diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 5ccf1182f..fef61d458 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -828,7 +828,7 @@ QString Component::getVerilogACode() { } } -QString Component::getExpression(bool) { +QString Component::getExpression(bool, bool) { return QString(); } diff --git a/qucs/components/component.h b/qucs/components/component.h index b41a0b2b6..c805a224f 100644 --- a/qucs/components/component.h +++ b/qucs/components/component.h @@ -44,7 +44,7 @@ class Component : public Element { QString getNetlist(); QString getSpiceNetlist(bool isXyce = false, bool isCdl = false); QString getVerilogACode(); - virtual QString getExpression(bool isXyce = false); + virtual QString getExpression(bool isXyce = false, bool isCdl = false); virtual QString getEquations(QString sim, QStringList &dep_vars); virtual QStringList getExtraVariables(); virtual QString getProbeVariable(bool isXyce = false); diff --git a/qucs/components/equation.cpp b/qucs/components/equation.cpp index b15673331..25bd4daf2 100644 --- a/qucs/components/equation.cpp +++ b/qucs/components/equation.cpp @@ -39,7 +39,7 @@ Equation::Equation() Lines.append(new qucs::Line(-xb, -yb, -xb, yb,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line(-xb, yb, xb+3,yb,QPen(Qt::darkBlue,2))); Texts.append(new Text(-xb+4, -yb-3, QObject::tr("Equation"), - QColor(0,0,0), QFontInfo(f).pixelSize())); + QColor(0,0,0), QFontInfo(f).pixelSize())); x1 = -xb-3; y1 = -yb-5; x2 = xb+9; y2 = yb+3; @@ -51,7 +51,7 @@ Equation::Equation() Props.append(new Property("y", "1", true)); Props.append(new Property("Export", "yes", false, - QObject::tr("put result into dataset")+" [yes, no]")); + QObject::tr("put result into dataset")+" [yes, no]")); } Equation::~Equation() @@ -120,10 +120,13 @@ QString Equation::getVAExpressions() * \brief Equation::getExpression Extract equations that don't contain simulation variables * (voltages/cureents) in .PARAM section of spice netlist * \param isXyce True if Xyce is used. + * \param isCdl True if CDL is used. * \return .PARAM section of spice netlist as a single string. */ -QString Equation::getExpression(bool isXyce) +QString Equation::getExpression(bool isXyce, bool isCdl /* = false */) { + Q_UNUSED(isCdl); + if (isActive != COMP_IS_ACTIVE) return QString(); QStringList ng_vars,ngsims; diff --git a/qucs/components/equation.h b/qucs/components/equation.h index 091e46cc0..e8ff266db 100644 --- a/qucs/components/equation.h +++ b/qucs/components/equation.h @@ -28,7 +28,7 @@ class Equation : public Component { ~Equation(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); QString getEquations(QString sim, QStringList &dep_vars); QString getVAvariables(); QString getVAExpressions(); diff --git a/qucs/components/iprobe.h b/qucs/components/iprobe.h index 99cd25b98..9a7e0dbb5 100644 --- a/qucs/components/iprobe.h +++ b/qucs/components/iprobe.h @@ -27,10 +27,11 @@ class iProbe : public Component { ~iProbe(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool) { return "";} + QString getExpression(bool, bool) { return "";} QString getProbeVariable(bool isXyce = false); + protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(bool isXyce = false, bool isCdl = false); }; #endif diff --git a/qucs/components/mosfet_sub.cpp b/qucs/components/mosfet_sub.cpp index 23f85738b..4e5ef4b7a 100644 --- a/qucs/components/mosfet_sub.cpp +++ b/qucs/components/mosfet_sub.cpp @@ -150,7 +150,7 @@ Component* MOSFET_sub::newOne() return p; } -QString MOSFET_sub::spice_netlist(bool isXyce, bool netlistModel /* = true */) +QString MOSFET_sub::spice_netlist(bool isXyce, bool isCdl /* = false */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -209,7 +209,7 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool netlistModel /* = true */) .arg(Name).arg(l).arg(w).arg(ad).arg(as).arg(pd).arg(ps).arg(getProperty("Temp")->Value); } - if (netlistModel) + if (!isCdl) { s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); } @@ -219,7 +219,7 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool netlistModel /* = true */) QString MOSFET_sub::cdl_netlist() { - return spice_netlist(false, false); + return spice_netlist(false, true); } // ------------------------------------------------------- diff --git a/qucs/spicecomponents/incl_script.cpp b/qucs/spicecomponents/incl_script.cpp index cc589deb3..54f79dadb 100644 --- a/qucs/spicecomponents/incl_script.cpp +++ b/qucs/spicecomponents/incl_script.cpp @@ -77,9 +77,9 @@ Element* InclScript::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString InclScript::getExpression(bool) +QString InclScript::getExpression(bool, bool isCdl /* = false */) { - if (isActive != COMP_IS_ACTIVE) + if (isActive != COMP_IS_ACTIVE || isCdl) return QString(); return Props.at(0)->Value+"\n"; } diff --git a/qucs/spicecomponents/incl_script.h b/qucs/spicecomponents/incl_script.h index 41748c07c..51d9466a4 100644 --- a/qucs/spicecomponents/incl_script.h +++ b/qucs/spicecomponents/incl_script.h @@ -27,7 +27,7 @@ class InclScript : public Component { ~InclScript(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_func.cpp b/qucs/spicecomponents/sp_func.cpp index 24a58f8c7..2fdb764d6 100644 --- a/qucs/spicecomponents/sp_func.cpp +++ b/qucs/spicecomponents/sp_func.cpp @@ -70,9 +70,9 @@ Element* SpiceFunc::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceFunc::getExpression(bool) +QString SpiceFunc::getExpression(bool, bool isCdl /* = false */) { - if (isActive != COMP_IS_ACTIVE) return QString(); + if (isActive != COMP_IS_ACTIVE || isCdl) return QString(); QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_func.h b/qucs/spicecomponents/sp_func.h index f942921e9..b4b3a5b10 100644 --- a/qucs/spicecomponents/sp_func.h +++ b/qucs/spicecomponents/sp_func.h @@ -28,7 +28,7 @@ class SpiceFunc : public Component { ~SpiceFunc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_globalpar.cpp b/qucs/spicecomponents/sp_globalpar.cpp index b83e7a837..efaadb885 100644 --- a/qucs/spicecomponents/sp_globalpar.cpp +++ b/qucs/spicecomponents/sp_globalpar.cpp @@ -70,14 +70,14 @@ Element* SpiceGlobalParam::info(QString& Name, char* &BitmapFile, bool getNewOne } -QString SpiceGlobalParam::getExpression(bool) +QString SpiceGlobalParam::getExpression(bool, bool isCdl /* = false */) { if (isActive != COMP_IS_ACTIVE) return QString(); QString s; s.clear(); for (Property *pp : Props) { - s += QStringLiteral(".GLOBAL_PARAM %1 = %2\n").arg(pp->Name).arg(pp->Value); + s += QStringLiteral(".%1PARAM %2 = %3\n").arg(isCdl ? "" : "GLOBAL_").arg(pp->Name).arg(pp->Value); } return s; } diff --git a/qucs/spicecomponents/sp_globalpar.h b/qucs/spicecomponents/sp_globalpar.h index aee5cbb11..f0e71c61a 100644 --- a/qucs/spicecomponents/sp_globalpar.h +++ b/qucs/spicecomponents/sp_globalpar.h @@ -29,7 +29,7 @@ class SpiceGlobalParam : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static void splitEqn(QString &eqn, QStringList &tokens); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_ic.cpp b/qucs/spicecomponents/sp_ic.cpp index a822ac15f..7b28e43a3 100644 --- a/qucs/spicecomponents/sp_ic.cpp +++ b/qucs/spicecomponents/sp_ic.cpp @@ -69,9 +69,9 @@ Element* SpiceIC::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceIC::getExpression(bool) +QString SpiceIC::getExpression(bool, bool isCdl /* = false */) { - if (isActive != COMP_IS_ACTIVE) return QString(); + if (isActive != COMP_IS_ACTIVE || isCdl) return QString(); QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_ic.h b/qucs/spicecomponents/sp_ic.h index a6b4b6439..82db5a211 100644 --- a/qucs/spicecomponents/sp_ic.h +++ b/qucs/spicecomponents/sp_ic.h @@ -28,7 +28,7 @@ class SpiceIC : public Component { ~SpiceIC(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_nodeset.cpp b/qucs/spicecomponents/sp_nodeset.cpp index 458cadd46..35da1101c 100644 --- a/qucs/spicecomponents/sp_nodeset.cpp +++ b/qucs/spicecomponents/sp_nodeset.cpp @@ -69,9 +69,9 @@ Element* SpiceNodeset::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceNodeset::getExpression(bool) +QString SpiceNodeset::getExpression(bool, bool isCdl /* = false */) { - if (isActive != COMP_IS_ACTIVE) return QString(); + if (isActive != COMP_IS_ACTIVE || isCdl) return QString(); QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_nodeset.h b/qucs/spicecomponents/sp_nodeset.h index cadf0f454..aafa0b7f1 100644 --- a/qucs/spicecomponents/sp_nodeset.h +++ b/qucs/spicecomponents/sp_nodeset.h @@ -28,7 +28,7 @@ class SpiceNodeset : public Component { ~SpiceNodeset(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_options.cpp b/qucs/spicecomponents/sp_options.cpp index 69a4b7a6e..53371feb9 100644 --- a/qucs/spicecomponents/sp_options.cpp +++ b/qucs/spicecomponents/sp_options.cpp @@ -71,9 +71,9 @@ Element* SpiceOptions::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceOptions::getExpression(bool isXyce) +QString SpiceOptions::getExpression(bool isXyce, bool isCdl /* = false */) { - if (isActive != COMP_IS_ACTIVE) return QString(); + if (isActive != COMP_IS_ACTIVE || isCdl) return QString(); QString s; s.clear(); diff --git a/qucs/spicecomponents/sp_options.h b/qucs/spicecomponents/sp_options.h index 05100a5fa..6bccdd289 100644 --- a/qucs/spicecomponents/sp_options.h +++ b/qucs/spicecomponents/sp_options.h @@ -29,7 +29,7 @@ class SpiceOptions : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static void splitEqn(QString &eqn, QStringList &tokens); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } diff --git a/qucs/spicecomponents/sp_parameter.cpp b/qucs/spicecomponents/sp_parameter.cpp index 0ce624646..5c290f7e6 100644 --- a/qucs/spicecomponents/sp_parameter.cpp +++ b/qucs/spicecomponents/sp_parameter.cpp @@ -69,14 +69,21 @@ Element* SpiceParam::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceParam::getExpression(bool) +QString SpiceParam::getExpression(bool, bool isCdl /* = false */) { if (isActive != COMP_IS_ACTIVE) return QString(); QString s; s.clear(); for (Property *pp : Props) { - s += QStringLiteral(".PARAM %1 = %2\n").arg(pp->Name).arg(pp->Value); + if (isCdl) + { + s += QStringLiteral(".PARAM %1=%2\n").arg(pp->Name).arg(pp->Value); + } + else + { + s += QStringLiteral(".PARAM %1 = %2\n").arg(pp->Name).arg(pp->Value); + } } return s; } diff --git a/qucs/spicecomponents/sp_parameter.h b/qucs/spicecomponents/sp_parameter.h index 571614732..a3fba3491 100644 --- a/qucs/spicecomponents/sp_parameter.h +++ b/qucs/spicecomponents/sp_parameter.h @@ -29,7 +29,7 @@ class SpiceParam : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); static void splitEqn(QString &eqn, QStringList &tokens); - QString getExpression(bool isXyce); + QString getExpression(bool isXyce, bool isCdl = false); protected: QString vhdlCode(int) { return QString(); } From d11f8c0af03988453793fb499d60476a06c1ca79 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Tue, 17 Dec 2024 14:34:06 +0100 Subject: [PATCH 05/10] New feature CDL netlist export -Changed Schematic::giveNodeNames() to public to be usable from new class CdlNetlistWriter -Changed AbstractSpiceKernel::collectSpiceLibs() to public static since it don't use any instance member and to be usable from new class CdlNetlistWriter -Added new class CdlNetlistWriter implementing CDL netlist export Signed-off-by: ThomasZecha --- qucs/extsimkernels/CMakeLists.txt | 1 + qucs/extsimkernels/CdlNetlistWriter.cpp | 182 +++++++++++++++++++++++ qucs/extsimkernels/CdlNetlistWriter.h | 43 ++++++ qucs/extsimkernels/abstractspicekernel.h | 2 +- qucs/schematic.h | 2 +- 5 files changed, 228 insertions(+), 2 deletions(-) create mode 100644 qucs/extsimkernels/CdlNetlistWriter.cpp create mode 100644 qucs/extsimkernels/CdlNetlistWriter.h diff --git a/qucs/extsimkernels/CMakeLists.txt b/qucs/extsimkernels/CMakeLists.txt index 4990eae1a..8b06f7866 100755 --- a/qucs/extsimkernels/CMakeLists.txt +++ b/qucs/extsimkernels/CMakeLists.txt @@ -32,6 +32,7 @@ spicecompat.cpp customsimdialog.cpp simsettingsdialog.cpp verilogawriter.cpp +CdlNetlistWriter.cpp s2spice.cpp spicelibcompdialog.cpp #xspice_cmbuilder.cpp diff --git a/qucs/extsimkernels/CdlNetlistWriter.cpp b/qucs/extsimkernels/CdlNetlistWriter.cpp new file mode 100644 index 000000000..ef09e8e74 --- /dev/null +++ b/qucs/extsimkernels/CdlNetlistWriter.cpp @@ -0,0 +1,182 @@ +/* + * CdlNetlistWriter.cpp - Schematic to CDL netlist converter implementation + * + * This file is part of Qucs-s + * + * Qucs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Qucs. If not, see . + * + */ + +#include "CdlNetlistWriter.h" +#include "abstractspicekernel.h" + +#include "schematic.h" + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +CdlNetlistWriter::CdlNetlistWriter(QTextStream& netlistStream, Schematic* schematic) : + a_netlistStream(netlistStream), + a_schematic(schematic) +{ +} + +bool CdlNetlistWriter::write() +{ + a_netlistStream << "* Qucs " << PACKAGE_VERSION << " " << a_schematic->getDocName() << "\n"; + + a_netlistStream << AbstractSpiceKernel::collectSpiceLibs(a_schematic); + + if (prepareNetlist() == -10) + { + return false; + } + + startNetlist(); + + a_netlistStream << ".END\n"; + + return true; +} + +int CdlNetlistWriter::prepareNetlist() +{ + if (a_schematic->getShowBias() > 0) + { + a_schematic->setShowBias(-1); // do not show DC bias anymore + } + + a_schematic->setIsVerilog(false); + a_schematic->setIsAnalog(true); + + bool isTruthTable = false; + int allTypes = 0; + int numPorts = 0; + + // Detect simulation domain (analog/digital) by looking at component types. + for (Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) + { + if (pc->isActive == COMP_IS_OPEN) + { + continue; + } + if (pc->Model.at(0) == '.') + { + if (pc->Model == ".Digi") + { + if (pc->Props.front()->Value != "TimeList") + { + isTruthTable = true; + } + if (pc->Props.back()->Value != "VHDL") + { + a_schematic->setIsVerilog(true); + } + + allTypes |= isDigitalComponent; + a_schematic->setIsAnalog(false); + } + else + { + allTypes |= isAnalogComponent; + } + } + else if (pc->Model == "DigiSource") + { + numPorts++; + } + } + + if ((allTypes & isAnalogComponent) == 0) + { + if (allTypes == 0) + { + // If no simulation exists, assume analog simulation. There may + // be a simulation within a SPICE file. Otherwise Qucsator will + // output an error. + a_schematic->setIsAnalog(true); + allTypes |= isAnalogComponent; + numPorts = -1; + } + else + { + if (!isTruthTable) + { + numPorts = 0; + } + } + } + else + { + numPorts = -1; + a_schematic->setIsAnalog(true); + } + + int countInit = 0; // counts the nodesets to give them unique names + + QStringList collect; + QPlainTextEdit errorText; + + if (!a_schematic->giveNodeNames(&a_netlistStream, countInit, collect, &errorText, numPorts)) + { + fprintf(stderr, "Error giving NodeNames\n"); + return -10; + } + + return numPorts; +} + +void CdlNetlistWriter::startNetlist() +{ + QString s; + + // Parameters, Initial conditions, Options + for (Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) + { + if (pc->isEquation) + { + s = pc->getExpression(false, true); + a_netlistStream << s; + } + } + + // global net 0 is always ground + a_netlistStream << ".GLOBAL 0:G\n"; + + // Components + for (Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) + { + if (a_schematic->getIsAnalog() && !pc->isSimulation && !pc->isEquation) + { + s = pc->getSpiceNetlist(false, true); + a_netlistStream << s; + } + } + + //TODO: Clarification of whether models should be exported + // Modelcards + /*for (Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) + { + if (pc->SpiceModel==".MODEL") + { + s = pc->getSpiceModel(); + a_netlistStream << s; + } + }*/ +} + + diff --git a/qucs/extsimkernels/CdlNetlistWriter.h b/qucs/extsimkernels/CdlNetlistWriter.h new file mode 100644 index 000000000..c4f54dac4 --- /dev/null +++ b/qucs/extsimkernels/CdlNetlistWriter.h @@ -0,0 +1,43 @@ +/* + * CdlNetlistWriter.h - Schematic to CDL netlist converter declaration + * + * This file is part of Qucs-s + * + * Qucs is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Qucs. If not, see . + * + */ + +#ifndef CDL_NETLIST_WRITER_H +#define CDL_NETLIST_WRITER_H + +class QTextStream; +class Schematic; + +class CdlNetlistWriter +{ +public: + CdlNetlistWriter(QTextStream& netlistStream, Schematic* schematic); + ~CdlNetlistWriter() {}; + + bool write(); + +private: + int prepareNetlist(); + void startNetlist(); + + QTextStream& a_netlistStream; + Schematic* a_schematic; +}; + +#endif // CDL_NETLIST_WRITER_H diff --git a/qucs/extsimkernels/abstractspicekernel.h b/qucs/extsimkernels/abstractspicekernel.h index 6807fc98c..6ac0ad821 100644 --- a/qucs/extsimkernels/abstractspicekernel.h +++ b/qucs/extsimkernels/abstractspicekernel.h @@ -83,7 +83,6 @@ class AbstractSpiceKernel : public QObject bool checkGround(); bool checkSimulations(); bool checkDCSimulation(); - QString collectSpiceLibs(Schematic* sch); public: @@ -130,6 +129,7 @@ class AbstractSpiceKernel : public QObject virtual void SaveNetlist(QString filename); virtual bool waitEndOfSimulation(); void setConsole(QPlainTextEdit *console) { a_console = console; } + static QString collectSpiceLibs(Schematic* sch); signals: void started(); diff --git a/qucs/schematic.h b/qucs/schematic.h index a52aa8121..95daa0414 100644 --- a/qucs/schematic.h +++ b/qucs/schematic.h @@ -515,6 +515,7 @@ protected slots: bool getIsAnalog() const { return a_isAnalog; } void setIsVerilog(bool value) { a_isVerilog = value; } bool getIsVerilog() const { return a_isVerilog; } + bool giveNodeNames(QTextStream *, int&, QStringList&, QPlainTextEdit*, int); private: int saveDocument(); @@ -540,7 +541,6 @@ protected slots: void throughAllNodes(bool, QStringList&, int&); void propagateNode(QStringList&, int&, Node*); void collectDigitalSignals(void); - bool giveNodeNames(QTextStream *, int&, QStringList&, QPlainTextEdit*, int); void beginNetlistDigital(QTextStream &); void endNetlistDigital(QTextStream &); bool throughAllComps(QTextStream *, int&, QStringList&, QPlainTextEdit *, int); From f2fd2fe20400c112785ea2ffd50e7895c31b7fdd Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Tue, 17 Dec 2024 15:14:58 +0100 Subject: [PATCH 06/10] New feature CDL netlist export -integrated CdlNetlistWriter in application GUI Signed-off-by: ThomasZecha --- qucs/qucs.cpp | 58 ++++++++++++++++++++++++++++++++++++++++++++++ qucs/qucs.h | 4 +++- qucs/qucs_init.cpp | 6 +++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index 0cc0954db..584035413 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -83,6 +83,7 @@ #include "qucslib_common.h" #include "misc.h" #include "extsimkernels/verilogawriter.h" +#include "extsimkernels/CdlNetlistWriter.h" #include "extsimkernels/simsettingsdialog.h" //#include "extsimkernels/codemodelgen.h" #include "symbolwidget.h" @@ -3500,6 +3501,63 @@ void QucsApp::slotSaveNetlist() } } +void QucsApp::slotSaveCdlNetlist() +{ + if (!isTextDocument(DocumentTab->currentWidget())) + { + Schematic* schematic = dynamic_cast(DocumentTab->currentWidget()); + Q_ASSERT(schematic != nullptr); + +#ifdef NETLIST_CDL_TO_CONSOLEa // for fast testing purposes + QString netlistString; + { + QTextStream netlistStream(&netlistString); + CdlNetlistWriter cdlWriter(netlistStream, schematic); + if (!cdlWriter.write()) + { + QMessageBox::critical( + this, + tr("Save CDL netlist"), + tr("Save CDL netlist failed!"), + QMessageBox::Ok); + } + printf("\nCDL netlist:\n%s\n", netlistString.toUtf8().constData()); + Content->refresh(); + } +#else + QFileInfo inf(schematic->getDocName()); + QString filename = QFileDialog::getSaveFileName( + this, + tr("Save CDL netlist"), + inf.path() + QDir::separator() + "netlist.cdl", + "CDL netlist (*.cdl)"); + + if (filename.isEmpty()) + { + return; + } + + QFile netlistFile(filename); + if (netlistFile.open(QIODevice::WriteOnly)) + { + QTextStream netlistStream(&netlistFile); + CdlNetlistWriter cdlWriter(netlistStream, schematic); + if (!cdlWriter.write()) + { + QMessageBox::critical( + this, + tr("Save CDL netlist"), + tr("Save CDL netlist failed!"), + QMessageBox::Ok); + } + netlistFile.close(); + Content->refresh(); + } +#endif + + } +} + void QucsApp::slotAfterSpiceSimulation(ExternSimDialog *SimDlg) { Schematic *sch = (Schematic*)DocumentTab->currentWidget(); diff --git a/qucs/qucs.h b/qucs/qucs.h index f6ce01d1b..7e9f73194 100644 --- a/qucs/qucs.h +++ b/qucs/qucs.h @@ -191,6 +191,7 @@ private slots: void slotFileChanged(bool); void slotSimSettings(); void slotSaveNetlist(); + void slotSaveCdlNetlist(); void slotAfterSpiceSimulation(ExternSimDialog *SimDlg); void slotBuildVAModule(); /*void slotBuildXSPICEIfs(int mode = 0); @@ -223,7 +224,8 @@ private slots: *fileSaveAll, *fileClose, *fileExamples, *fileSettings, *filePrint, *fileQuit, *projNew, *projOpen, *projDel, *projClose, *applSettings, *refreshSchPath, *editCut, *editCopy, *magAll, *magSel, *magOne, *magMinus, *filePrintFit, *tune, - *symEdit, *intoH, *popH, *simulate, *save_netlist, *dpl_sch, *undo, *redo, *dcbias; + *symEdit, *intoH, *popH, *simulate, *save_netlist, *dpl_sch, *undo, *redo, *dcbias, + *saveCdlNetlist; QAction *exportAsImage; diff --git a/qucs/qucs_init.cpp b/qucs/qucs_init.cpp index e500ee187..ea6531fde 100644 --- a/qucs/qucs_init.cpp +++ b/qucs/qucs_init.cpp @@ -577,6 +577,11 @@ void QucsApp::initActions() save_netlist->setWhatsThis(tr("Save netlist to file")); connect(save_netlist, SIGNAL(triggered()), SLOT(slotSaveNetlist())); + saveCdlNetlist = new QAction(tr("Save CDL netlist"), this); + saveCdlNetlist->setStatusTip(tr("Save CDL netlist")); + saveCdlNetlist->setWhatsThis(tr("Save CDL netlist to file")); + Q_ASSERT(connect(saveCdlNetlist, SIGNAL(triggered()), SLOT(slotSaveCdlNetlist()))); + setMarker = new QAction(QIcon((":/bitmaps/svg/marker.svg")), tr("Set Marker on Graph"), this); setMarker->setShortcut(Qt::CTRL|Qt::Key_B); setMarker->setStatusTip(tr("Sets a marker on a diagram's graph")); @@ -796,6 +801,7 @@ void QucsApp::initMenuBar() simMenu->addAction(showMsg); simMenu->addAction(showNet); simMenu->addAction(save_netlist); + simMenu->addAction(saveCdlNetlist); simMenu->addAction(simSettings); From 8fb529553175c3d5c9d059a8dc143fc74c7d6c04 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Tue, 17 Dec 2024 18:20:48 +0100 Subject: [PATCH 07/10] Fix compiler warnings -Fixed compiler warnings regarding missing virtual destructor Signed-off-by: ThomasZecha --- qucs/element.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qucs/element.h b/qucs/element.h index d37a5349c..70908eb60 100644 --- a/qucs/element.h +++ b/qucs/element.h @@ -48,6 +48,7 @@ namespace qucs { // otherwise conflict with class DrawingPrimitive { public: + virtual ~DrawingPrimitive() {} virtual void draw([[maybe_unused]] QPainter* painter) const {}; virtual QBrush brushHint() const { return Qt::NoBrush; } virtual QPen penHint() const { return Qt::NoPen; } @@ -56,6 +57,7 @@ class DrawingPrimitive { struct Line : DrawingPrimitive { Line(double _x1, double _y1, double _x2, double _y2, QPen _style) : x1(_x1), y1(_y1), x2(_x2), y2(_y2), style(_style) {}; + virtual ~Line() {} double x1, y1, x2, y2; QPen style; void draw(QPainter* painter) const override; @@ -66,6 +68,7 @@ struct Arc : DrawingPrimitive { Arc(double _x, double _y, double _w, double _h, int _angle, int _arclen, QPen _style) : x(_x), y(_y), w(_w), h(_h), angle(_angle), arclen(_arclen), style(_style) {}; + virtual ~Arc() {} double x, y, w, h; int angle, arclen; QPen style; @@ -128,6 +131,7 @@ struct Text : qucs::DrawingPrimitive { double _Size = 10.0, double _mCos=1.0, double _mSin=0.0) : x(_x), y(_y), s(_s), Color(_Color), Size(_Size), mSin(_mSin), mCos(_mCos) { over = under = false; }; + virtual ~Text() {} double x, y; QString s; QColor Color; From ad319b3f0cf6ad54ba9bcd88380e0221762ae5f2 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Wed, 18 Dec 2024 09:59:39 +0100 Subject: [PATCH 08/10] Fixed wrong usage of Q_ASSERT -Fixed wrong usage of Q_ASSERT testing connect() result Signed-off-by: ThomasZecha --- qucs/qucs_init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qucs/qucs_init.cpp b/qucs/qucs_init.cpp index ea6531fde..d90e638c1 100644 --- a/qucs/qucs_init.cpp +++ b/qucs/qucs_init.cpp @@ -580,7 +580,7 @@ void QucsApp::initActions() saveCdlNetlist = new QAction(tr("Save CDL netlist"), this); saveCdlNetlist->setStatusTip(tr("Save CDL netlist")); saveCdlNetlist->setWhatsThis(tr("Save CDL netlist to file")); - Q_ASSERT(connect(saveCdlNetlist, SIGNAL(triggered()), SLOT(slotSaveCdlNetlist()))); + connect(saveCdlNetlist, SIGNAL(triggered()), SLOT(slotSaveCdlNetlist())); setMarker = new QAction(QIcon((":/bitmaps/svg/marker.svg")), tr("Set Marker on Graph"), this); setMarker->setShortcut(Qt::CTRL|Qt::Key_B); From 909f02340dd3ac42932a6e640881dee468bbc605 Mon Sep 17 00:00:00 2001 From: ThomasZecha Date: Mon, 30 Dec 2024 16:48:05 +0100 Subject: [PATCH 09/10] New feature CDL netlist export -introduced new type spicecompat::SpiceDialect to distinguish SPICE, Xyce and CDL -adapt dependent components accordingly Signed-off-by: ThomasZecha --- qucs/components/ac_sim.cpp | 4 +- qucs/components/ac_sim.h | 2 +- qucs/components/ampere_ac.cpp | 4 +- qucs/components/ampere_ac.h | 2 +- qucs/components/ampere_dc.cpp | 6 ++- qucs/components/ampere_dc.h | 2 +- qucs/components/biast.cpp | 5 +- qucs/components/biast.h | 2 +- qucs/components/bjt.cpp | 12 +++-- qucs/components/bjt.h | 2 +- qucs/components/bjtsub.cpp | 12 +++-- qucs/components/bjtsub.h | 2 +- qucs/components/capacitor.cpp | 6 +-- qucs/components/capacitor.h | 2 +- qucs/components/capq.cpp | 5 +- qucs/components/capq.h | 2 +- qucs/components/cccs.cpp | 20 ++++---- qucs/components/cccs.h | 2 +- qucs/components/ccvs.cpp | 18 ++++--- qucs/components/ccvs.h | 2 +- qucs/components/component.cpp | 13 +++-- qucs/components/component.h | 6 +-- qucs/components/d_flipflop.cpp | 4 +- qucs/components/d_flipflop.h | 2 +- qucs/components/dc_sim.cpp | 4 +- qucs/components/dc_sim.h | 2 +- qucs/components/dcblock.cpp | 7 +-- qucs/components/dcblock.h | 2 +- qucs/components/dcfeed.cpp | 7 +-- qucs/components/dcfeed.h | 2 +- qucs/components/dff_SR.cpp | 16 +++--- qucs/components/dff_SR.h | 2 +- qucs/components/digi_source.cpp | 10 ++-- qucs/components/digi_source.h | 2 +- qucs/components/diode.cpp | 10 ++-- qucs/components/diode.h | 2 +- qucs/components/eqndefined.cpp | 20 ++++---- qucs/components/eqndefined.h | 2 +- qucs/components/ground.cpp | 4 +- qucs/components/ground.h | 2 +- qucs/components/gyrator.cpp | 4 +- qucs/components/gyrator.h | 2 +- qucs/components/hb_sim.cpp | 4 +- qucs/components/hb_sim.h | 2 +- qucs/components/iexp.cpp | 20 ++++---- qucs/components/iexp.h | 2 +- qucs/components/ifile.cpp | 5 +- qucs/components/ifile.h | 2 +- qucs/components/indq.cpp | 5 +- qucs/components/indq.h | 2 +- qucs/components/inductor.cpp | 6 +-- qucs/components/inductor.h | 2 +- qucs/components/iprobe.cpp | 4 +- qucs/components/iprobe.h | 2 +- qucs/components/ipulse.cpp | 6 ++- qucs/components/ipulse.h | 2 +- qucs/components/irect.cpp | 16 +++--- qucs/components/irect.h | 2 +- qucs/components/jfet.cpp | 8 +-- qucs/components/jfet.h | 2 +- qucs/components/jkff_SR.cpp | 4 +- qucs/components/jkff_SR.h | 2 +- qucs/components/libcomp.cpp | 6 ++- qucs/components/libcomp.h | 2 +- qucs/components/logical_buf.cpp | 4 +- qucs/components/logical_buf.h | 2 +- qucs/components/logical_inv.cpp | 4 +- qucs/components/logical_inv.h | 2 +- qucs/components/mosfet.cpp | 8 +-- qucs/components/mosfet.h | 2 +- qucs/components/mosfet_sub.cpp | 8 +-- qucs/components/mosfet_sub.h | 2 +- qucs/components/mutual.cpp | 5 +- qucs/components/mutual.h | 2 +- qucs/components/mutual2.cpp | 6 +-- qucs/components/mutual2.h | 2 +- qucs/components/mutualx.cpp | 5 +- qucs/components/mutualx.h | 2 +- qucs/components/opamp.cpp | 4 +- qucs/components/opamp.h | 2 +- qucs/components/param_sweep.cpp | 12 ++--- qucs/components/param_sweep.h | 2 +- qucs/components/potentiometer.cpp | 5 +- qucs/components/potentiometer.h | 2 +- qucs/components/relais.cpp | 4 +- qucs/components/relais.h | 2 +- qucs/components/resistor.cpp | 6 +-- qucs/components/resistor.h | 2 +- qucs/components/rlcg.cpp | 5 +- qucs/components/rlcg.h | 2 +- qucs/components/source_ac.cpp | 4 +- qucs/components/source_ac.h | 2 +- qucs/components/sp_sim.cpp | 4 +- qucs/components/sp_sim.h | 2 +- qucs/components/sparamfile.cpp | 4 +- qucs/components/sparamfile.h | 2 +- qucs/components/spicefile.cpp | 6 ++- qucs/components/spicefile.h | 2 +- qucs/components/subcircuit.cpp | 7 ++- qucs/components/subcircuit.h | 2 +- qucs/components/subcirport.cpp | 4 +- qucs/components/subcirport.h | 2 +- qucs/components/switch.cpp | 4 +- qucs/components/switch.h | 2 +- qucs/components/tff_SR.cpp | 4 +- qucs/components/tff_SR.h | 2 +- qucs/components/tr_sim.cpp | 6 +-- qucs/components/tr_sim.h | 2 +- qucs/components/vacomponent.cpp | 4 +- qucs/components/vacomponent.h | 2 +- qucs/components/vccs.cpp | 22 ++++---- qucs/components/vccs.h | 2 +- qucs/components/vcresistor.cpp | 5 +- qucs/components/vcresistor.h | 2 +- qucs/components/vcvs.cpp | 21 ++++---- qucs/components/vcvs.h | 2 +- qucs/components/vexp.cpp | 16 +++--- qucs/components/vexp.h | 2 +- qucs/components/vfile.cpp | 5 +- qucs/components/vfile.h | 2 +- qucs/components/volt_ac.cpp | 4 +- qucs/components/volt_ac.h | 2 +- qucs/components/volt_dc.cpp | 6 +-- qucs/components/volt_dc.h | 2 +- qucs/components/vprobe.cpp | 6 ++- qucs/components/vprobe.h | 2 +- qucs/components/vpulse.cpp | 6 ++- qucs/components/vpulse.h | 2 +- qucs/components/vrect.cpp | 4 +- qucs/components/vrect.h | 2 +- qucs/extsimkernels/CdlNetlistWriter.cpp | 2 +- qucs/extsimkernels/abstractspicekernel.cpp | 12 +++-- qucs/extsimkernels/abstractspicekernel.h | 2 +- qucs/extsimkernels/spicecompat.h | 2 + qucs/extsimkernels/xyce.cpp | 6 +-- qucs/spicecomponents/BJT_SPICE.cpp | 6 ++- qucs/spicecomponents/BJT_SPICE.h | 2 +- qucs/spicecomponents/C_SPICE.cpp | 8 ++- qucs/spicecomponents/C_SPICE.h | 2 +- qucs/spicecomponents/DIODE_SPICE.cpp | 8 ++- qucs/spicecomponents/DIODE_SPICE.h | 2 +- qucs/spicecomponents/Icouple.cpp | 45 ++++++++-------- qucs/spicecomponents/Icouple.h | 2 +- qucs/spicecomponents/K_SPICE.cpp | 31 ++++++----- qucs/spicecomponents/K_SPICE.h | 2 +- qucs/spicecomponents/LTL_SPICE.cpp | 60 +++++++++++----------- qucs/spicecomponents/LTL_SPICE.h | 2 +- qucs/spicecomponents/LTRA_SPICE.cpp | 26 +++++----- qucs/spicecomponents/LTRA_SPICE.h | 2 +- qucs/spicecomponents/L_SPICE.cpp | 6 ++- qucs/spicecomponents/L_SPICE.h | 2 +- qucs/spicecomponents/MESFET_SPICE.cpp | 14 ++--- qucs/spicecomponents/MESFET_SPICE.h | 2 +- qucs/spicecomponents/MOS_SPICE.cpp | 8 +-- qucs/spicecomponents/MOS_SPICE.h | 2 +- qucs/spicecomponents/NJF_SPICE.cpp | 22 ++++---- qucs/spicecomponents/NJF_SPICE.h | 2 +- qucs/spicecomponents/NMOS_SPICE.cpp | 6 ++- qucs/spicecomponents/NMOS_SPICE.h | 2 +- qucs/spicecomponents/NPN_SPICE.cpp | 6 ++- qucs/spicecomponents/NPN_SPICE.h | 2 +- qucs/spicecomponents/PJF_SPICE.cpp | 6 ++- qucs/spicecomponents/PJF_SPICE.h | 2 +- qucs/spicecomponents/PMF_MESFET_SPICE.cpp | 12 +++-- qucs/spicecomponents/PMF_MESFET_SPICE.h | 2 +- qucs/spicecomponents/PMOS_SPICE.cpp | 6 ++- qucs/spicecomponents/PMOS_SPICE.h | 2 +- qucs/spicecomponents/PNP_SPICE.cpp | 6 ++- qucs/spicecomponents/PNP_SPICE.h | 2 +- qucs/spicecomponents/R_SPICE.cpp | 6 ++- qucs/spicecomponents/R_SPICE.h | 2 +- qucs/spicecomponents/S4Q_I.cpp | 6 ++- qucs/spicecomponents/S4Q_I.h | 2 +- qucs/spicecomponents/S4Q_Ieqndef.cpp | 16 +++--- qucs/spicecomponents/S4Q_Ieqndef.h | 2 +- qucs/spicecomponents/S4Q_S.cpp | 8 +-- qucs/spicecomponents/S4Q_S.h | 2 +- qucs/spicecomponents/S4Q_V.cpp | 6 ++- qucs/spicecomponents/S4Q_V.h | 2 +- qucs/spicecomponents/S4Q_W.cpp | 4 +- qucs/spicecomponents/S4Q_W.h | 4 +- qucs/spicecomponents/SDTF.cpp | 33 ++++++------ qucs/spicecomponents/SDTF.h | 2 +- qucs/spicecomponents/UDRCTL_SPICE.cpp | 18 +++---- qucs/spicecomponents/UDRCTL_SPICE.h | 10 ++-- qucs/spicecomponents/XAPWL.cpp | 35 ++++++------- qucs/spicecomponents/XAPWL.h | 2 +- qucs/spicecomponents/core.cpp | 46 ++++++++--------- qucs/spicecomponents/core.h | 2 +- qucs/spicecomponents/eNL.cpp | 16 +++--- qucs/spicecomponents/eNL.h | 2 +- qucs/spicecomponents/gNL.cpp | 23 +++++---- qucs/spicecomponents/gNL.h | 18 +++---- qucs/spicecomponents/iAmpMod.cpp | 20 ++++---- qucs/spicecomponents/iAmpMod.h | 2 +- qucs/spicecomponents/iPWL.cpp | 8 +-- qucs/spicecomponents/iPWL.h | 2 +- qucs/spicecomponents/iTRNOISE.cpp | 20 ++++---- qucs/spicecomponents/iTRNOISE.h | 2 +- qucs/spicecomponents/isffm.cpp | 23 +++++---- qucs/spicecomponents/isffm.h | 2 +- qucs/spicecomponents/sp_customsim.cpp | 4 +- qucs/spicecomponents/sp_customsim.h | 2 +- qucs/spicecomponents/sp_disto.cpp | 4 +- qucs/spicecomponents/sp_disto.h | 2 +- qucs/spicecomponents/sp_fourier.cpp | 4 +- qucs/spicecomponents/sp_fourier.h | 2 +- qucs/spicecomponents/sp_noise.cpp | 4 +- qucs/spicecomponents/sp_noise.h | 2 +- qucs/spicecomponents/sp_pz.cpp | 4 +- qucs/spicecomponents/sp_pz.h | 2 +- qucs/spicecomponents/sp_sens.cpp | 4 +- qucs/spicecomponents/sp_sens.h | 2 +- qucs/spicecomponents/sp_sens_ac.cpp | 4 +- qucs/spicecomponents/sp_sens_ac.h | 2 +- qucs/spicecomponents/sp_sens_tr_xyce.cpp | 4 +- qucs/spicecomponents/sp_sens_tr_xyce.h | 2 +- qucs/spicecomponents/sp_sens_xyce.cpp | 4 +- qucs/spicecomponents/sp_sens_xyce.h | 2 +- qucs/spicecomponents/sp_spectrum.cpp | 4 +- qucs/spicecomponents/sp_spectrum.h | 2 +- qucs/spicecomponents/spicegeneric.cpp | 6 ++- qucs/spicecomponents/spicegeneric.h | 2 +- qucs/spicecomponents/spicelibcomp.cpp | 6 ++- qucs/spicecomponents/spicelibcomp.h | 2 +- qucs/spicecomponents/src_eqndef.cpp | 8 +-- qucs/spicecomponents/src_eqndef.h | 2 +- qucs/spicecomponents/vAmpMod.cpp | 6 +-- qucs/spicecomponents/vAmpMod.h | 3 +- qucs/spicecomponents/vPWL.cpp | 48 ++++++++--------- qucs/spicecomponents/vPWL.h | 2 +- qucs/spicecomponents/vTRNOISE.cpp | 4 +- qucs/spicecomponents/vTRNOISE.h | 2 +- qucs/spicecomponents/vTRRANDOM.cpp | 14 ++--- qucs/spicecomponents/vTRRANDOM.h | 2 +- qucs/spicecomponents/volt_ac_SPICE.cpp | 4 +- qucs/spicecomponents/volt_ac_SPICE.h | 2 +- qucs/spicecomponents/vsffm.cpp | 15 +++--- qucs/spicecomponents/vsffm.h | 2 +- qucs/spicecomponents/xsp_cmlib.cpp | 4 +- qucs/spicecomponents/xsp_cmlib.h | 2 +- qucs/spicecomponents/xsp_codemodel.cpp | 4 +- qucs/spicecomponents/xsp_codemodel.h | 2 +- qucs/spicecomponents/xspicegeneric.cpp | 6 ++- qucs/spicecomponents/xspicegeneric.h | 2 +- qucs/spicecomponents/xyce_script.cpp | 4 +- qucs/spicecomponents/xyce_script.h | 2 +- 247 files changed, 836 insertions(+), 687 deletions(-) diff --git a/qucs/components/ac_sim.cpp b/qucs/components/ac_sim.cpp index a9b9b1fad..e0eb31db6 100644 --- a/qucs/components/ac_sim.cpp +++ b/qucs/components/ac_sim.cpp @@ -79,7 +79,7 @@ void AC_Sim::recreate(Schematic*) } } -QString AC_Sim::spice_netlist(bool isXyce, bool) +QString AC_Sim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = SpiceModel + " "; QString unit; @@ -100,7 +100,7 @@ QString AC_Sim::spice_netlist(bool isXyce, bool) QString fstart = spicecompat::normalize_value(Props.at(1)->Value); // Start freq. QString fstop = spicecompat::normalize_value(Props.at(2)->Value); // Stop freq. s += QStringLiteral("%1 %2 \n").arg(fstart).arg(fstop); - if (!isXyce) s.remove(0,1); + if (dialect != spicecompat::SPICEXyce) s.remove(0,1); return s.toLower(); } diff --git a/qucs/components/ac_sim.h b/qucs/components/ac_sim.h index b3a939e86..3699b8fef 100644 --- a/qucs/components/ac_sim.h +++ b/qucs/components/ac_sim.h @@ -28,7 +28,7 @@ class AC_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); void recreate(Schematic*); - QString spice_netlist(bool isXyce=false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/ampere_ac.cpp b/qucs/components/ampere_ac.cpp index 9a13754ca..697aca2c6 100644 --- a/qucs/components/ampere_ac.cpp +++ b/qucs/components/ampere_ac.cpp @@ -78,8 +78,10 @@ Element* Ampere_ac::info(QString& Name, char* &BitmapFile, bool getNewOne) } -QString Ampere_ac::spice_netlist(bool, bool) +QString Ampere_ac::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString plus = spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); diff --git a/qucs/components/ampere_ac.h b/qucs/components/ampere_ac.h index 86d612c0c..67713489d 100644 --- a/qucs/components/ampere_ac.h +++ b/qucs/components/ampere_ac.h @@ -28,7 +28,7 @@ class Ampere_ac : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/ampere_dc.cpp b/qucs/components/ampere_dc.cpp index 8db3f16ab..b3a6458be 100644 --- a/qucs/components/ampere_dc.cpp +++ b/qucs/components/ampere_dc.cpp @@ -56,8 +56,10 @@ Ampere_dc::~Ampere_dc() { } -QString Ampere_dc::spice_netlist(bool, bool) +QString Ampere_dc::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString plus = Ports.at(1)->Connection->Name; @@ -71,7 +73,7 @@ QString Ampere_dc::spice_netlist(bool, bool) QString Ampere_dc::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } Component* Ampere_dc::newOne() diff --git a/qucs/components/ampere_dc.h b/qucs/components/ampere_dc.h index 2d90a5f5d..2d1736809 100644 --- a/qucs/components/ampere_dc.h +++ b/qucs/components/ampere_dc.h @@ -27,7 +27,7 @@ class Ampere_dc : public Component { ~Ampere_dc(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/biast.cpp b/qucs/components/biast.cpp index a3b7fc0ba..ff1a21ce2 100644 --- a/qucs/components/biast.cpp +++ b/qucs/components/biast.cpp @@ -80,9 +80,10 @@ Element* BiasT::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString BiasT::spice_netlist(bool isXyce, bool) +QString BiasT::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString L = spicecompat::normalize_value(getProperty("L")->Value); QString C = spicecompat::normalize_value(getProperty("C")->Value); diff --git a/qucs/components/biast.h b/qucs/components/biast.h index f86e5656f..587626708 100644 --- a/qucs/components/biast.h +++ b/qucs/components/biast.h @@ -28,7 +28,7 @@ class BiasT : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/bjt.cpp b/qucs/components/bjt.cpp index 533f247f6..9d32738cf 100644 --- a/qucs/components/bjt.cpp +++ b/qucs/components/bjt.cpp @@ -42,7 +42,7 @@ Component* BJT::newOne() return p; } -QString BJT::spice_netlist(bool, bool isCdl /* = false */) +QString BJT::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -60,14 +60,16 @@ QString BJT::spice_netlist(bool, bool isCdl /* = false */) QString par_str = form_spice_param_list(spice_incompat,spice_tr); - if (getProperty("UseGlobTemp")->Value == "yes" || isCdl) { - s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isCdl ? "$EA" : "AREA").arg(getProperty("Area")->Value); + const bool isDialectCDL(dialect == spicecompat::CDL); + + if (getProperty("UseGlobTemp")->Value == "yes" || isDialectCDL) { + s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isDialectCDL ? "$EA" : "AREA").arg(getProperty("Area")->Value); } else { s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) .arg(getProperty("Temp")->Value); } - if (!isCdl) + if (!isDialectCDL) { s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); } @@ -77,7 +79,7 @@ QString BJT::spice_netlist(bool, bool isCdl /* = false */) QString BJT::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } // ------------------------------------------------------- diff --git a/qucs/components/bjt.h b/qucs/components/bjt.h index 6fe626585..2be3cf90b 100644 --- a/qucs/components/bjt.h +++ b/qucs/components/bjt.h @@ -32,7 +32,7 @@ class BJT : public Basic_BJT { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/bjtsub.cpp b/qucs/components/bjtsub.cpp index 591b6790d..5a1947d3c 100644 --- a/qucs/components/bjtsub.cpp +++ b/qucs/components/bjtsub.cpp @@ -201,7 +201,7 @@ void BJTsub::createSymbol() x2 = 30; y2 = 30; } -QString BJTsub::spice_netlist(bool, bool isCdl /* = false */) +QString BJTsub::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -219,14 +219,16 @@ QString BJTsub::spice_netlist(bool, bool isCdl /* = false */) QString par_str = form_spice_param_list(spice_incompat,spice_tr); - if (getProperty("UseGlobTemp")->Value == "yes" || isCdl) { - s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isCdl ? "$EA" : "AREA").arg(getProperty("Area")->Value); + const bool isDialectCDL(dialect == spicecompat::CDL); + + if (getProperty("UseGlobTemp")->Value == "yes" || isDialectCDL) { + s += QStringLiteral(" QMOD_%1 %2=%3\n").arg(Name).arg(isDialectCDL ? "$EA" : "AREA").arg(getProperty("Area")->Value); } else { s += QStringLiteral(" QMOD_%1 AREA=%2 TEMP=%3\n").arg(Name).arg(getProperty("Area")->Value) .arg(getProperty("Temp")->Value); } - if (!isCdl) + if (!isDialectCDL) { s += QStringLiteral(".MODEL QMOD_%1 %2 (%3)\n").arg(Name).arg(getProperty("Type")->Value).arg(par_str); } @@ -236,5 +238,5 @@ QString BJTsub::spice_netlist(bool, bool isCdl /* = false */) QString BJTsub::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/components/bjtsub.h b/qucs/components/bjtsub.h index 07e565ade..29699261c 100644 --- a/qucs/components/bjtsub.h +++ b/qucs/components/bjtsub.h @@ -36,7 +36,7 @@ class BJTsub : public Basic_BJT { static Element* info_pnp(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); void createSymbol(); }; diff --git a/qucs/components/capacitor.cpp b/qucs/components/capacitor.cpp index 29dddc336..38cdb20b4 100644 --- a/qucs/components/capacitor.cpp +++ b/qucs/components/capacitor.cpp @@ -53,7 +53,7 @@ Element* Capacitor::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Capacitor::spice_netlist(bool, bool isCdl /*= false */) +QString Capacitor::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -64,7 +64,7 @@ QString Capacitor::spice_netlist(bool, bool isCdl /*= false */) s += " "+spicecompat::normalize_value(Props.at(0)->Value) + " "; QString val = Props.at(1)->Value; // add inial voltage if presents val = val.remove(' ').toUpper(); - if (!val.isEmpty() && !isCdl) { + if (!val.isEmpty() && dialect != spicecompat::CDL) { s += " IC=" + val; } @@ -73,7 +73,7 @@ QString Capacitor::spice_netlist(bool, bool isCdl /*= false */) QString Capacitor::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } QString Capacitor::va_code() diff --git a/qucs/components/capacitor.h b/qucs/components/capacitor.h index 74fa72bf9..58176f4b2 100644 --- a/qucs/components/capacitor.h +++ b/qucs/components/capacitor.h @@ -30,7 +30,7 @@ class Capacitor : public MultiViewComponent { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); QString va_code(); }; diff --git a/qucs/components/capq.cpp b/qucs/components/capq.cpp index 20b8a1994..787937dca 100644 --- a/qucs/components/capq.cpp +++ b/qucs/components/capq.cpp @@ -91,9 +91,10 @@ Element* CapQ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString CapQ::spice_netlist(bool isXyce, bool) +QString CapQ::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString pin1 = Ports.at(0)->Connection->Name; pin1 = spicecompat::normalize_node_name(pin1); diff --git a/qucs/components/capq.h b/qucs/components/capq.h index 17c98c0aa..b65e331e6 100644 --- a/qucs/components/capq.h +++ b/qucs/components/capq.h @@ -34,7 +34,7 @@ class CapQ : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/cccs.cpp b/qucs/components/cccs.cpp index 03b4cbe13..25f1424f3 100644 --- a/qucs/components/cccs.cpp +++ b/qucs/components/cccs.cpp @@ -82,27 +82,29 @@ Element* CCCS::info(QString& Name, char* &BitmapFile, bool getNewOne) } QString CCCS::va_code() -{ - - QString Gain = vacompat::normalize_value(Props.at(0)->Value); - QString P1 = Ports.at(0)->Connection->Name; +{ + + QString Gain = vacompat::normalize_value(Props.at(0)->Value); + QString P1 = Ports.at(0)->Connection->Name; QString P4 = Ports.at(1)->Connection->Name; QString P3 = Ports.at(2)->Connection->Name; QString P2 = Ports.at(3)->Connection->Name; QString s = ""; - + QString Vpm = vacompat::normalize_voltage(P1,P2); - QString Ipm = vacompat::normalize_current(P1,P2,true); + QString Ipm = vacompat::normalize_current(P1,P2,true); s += QStringLiteral(" %1 <+ %2 * 1e3;\n").arg(Ipm).arg(Vpm); QString Vpm2 = vacompat::normalize_voltage(P4,P3); - QString Ipm2 = vacompat::normalize_current(P4,P3,true); + QString Ipm2 = vacompat::normalize_current(P4,P3,true); s += QStringLiteral("%1 <+ %2 * 1e-9;\n").arg(Ipm2).arg(Vpm2); s += QStringLiteral("%1 <+ %2 * 1e3 * %3 ;\n").arg(Ipm2).arg(Vpm).arg(Gain); - + return s; } -QString CCCS::spice_netlist(bool, bool) +QString CCCS::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); // spice CCCS consists two sources: output source // and zero value controlling source QString val = spicecompat::normalize_value(Props.at(0)->Value); diff --git a/qucs/components/cccs.h b/qucs/components/cccs.h index 764bf6be6..fc2621ce1 100644 --- a/qucs/components/cccs.h +++ b/qucs/components/cccs.h @@ -28,7 +28,7 @@ class CCCS : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/components/ccvs.cpp b/qucs/components/ccvs.cpp index 6924fc5d6..424d1a254 100644 --- a/qucs/components/ccvs.cpp +++ b/qucs/components/ccvs.cpp @@ -59,7 +59,7 @@ CCVS::CCVS() SpiceModel = "H"; Props.append(new Property("G", "1 Ohm", true, - QObject::tr("forward transfer factor"))); + QObject::tr("forward transfer factor"))); Props.append(new Property("T", "0", false, QObject::tr("delay time (Qucsator only)"))); } @@ -82,28 +82,30 @@ Element* CCVS::info(QString& Name, char* &BitmapFile, bool getNewOne) } QString CCVS::va_code() -{ +{ QString Gain = vacompat::normalize_value(Props.at(0)->Value); - QString P1 = Ports.at(0)->Connection->Name; + QString P1 = Ports.at(0)->Connection->Name; QString P4 = Ports.at(1)->Connection->Name; QString P3 = Ports.at(2)->Connection->Name; QString P2 = Ports.at(3)->Connection->Name; QString s = ""; - + QString Vpm = vacompat::normalize_voltage(P1,P2); - QString Ipm = vacompat::normalize_current(P1,P2,true); + QString Ipm = vacompat::normalize_current(P1,P2,true); s += QStringLiteral(" %1 <+ %2 * 1e3;\n").arg(Ipm).arg(Vpm); QString Vpm2 = vacompat::normalize_voltage(P3,P4); - QString Ipm2 = vacompat::normalize_current(P3,P4,true); + QString Ipm2 = vacompat::normalize_current(P3,P4,true); s += QStringLiteral("%1 <+ -(%2 * 1e3);\n").arg(Ipm2).arg(Vpm2); s += QStringLiteral("%1 <+ -(%2 * 1e6* %3) ;\n").arg(Ipm2).arg(Vpm).arg(Gain); - + return s; } // ------------------------------------------------------- -QString CCVS::spice_netlist(bool, bool) +QString CCVS::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); // spice CCVS consists two sources: output source // and zero value controlling source QString val = spicecompat::normalize_value(Props.at(0)->Value); diff --git a/qucs/components/ccvs.h b/qucs/components/ccvs.h index d3d41a8b6..92a540c1b 100644 --- a/qucs/components/ccvs.h +++ b/qucs/components/ccvs.h @@ -28,7 +28,7 @@ class CCVS : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index fef61d458..63bb8e4eb 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -758,7 +758,7 @@ QString Component::form_spice_param_list(QStringList &ignore_list, QStringList & return par_str; } -QString Component::spice_netlist(bool, bool) { +QString Component::spice_netlist(spicecompat::SpiceDialect) { return QStringLiteral("\n"); // ignore if not implemented } @@ -791,11 +791,11 @@ QString Component::getNetlist() { return s; } -QString Component::getSpiceNetlist(bool isXyce /* = false */, bool isCdl /* = false */) { +QString Component::getSpiceNetlist(spicecompat::SpiceDialect dialect /* = SPICEDefault */) { QString s; switch (isActive) { case COMP_IS_ACTIVE: - s = isCdl ? cdl_netlist() : spice_netlist(isXyce, false); + s = dialect == spicecompat::CDL ? cdl_netlist() : spice_netlist(dialect); s.replace(" gnd ", " 0 "); return s; case COMP_IS_OPEN: @@ -1541,8 +1541,11 @@ QString GateComponent::netlist() { return s; } -QString GateComponent::spice_netlist(bool isXyce, bool) { - if (isXyce) return {""}; +QString GateComponent::spice_netlist(spicecompat::SpiceDialect dialect) { + if (dialect == spicecompat::SPICEXyce) + { + return QString(); + } QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/component.h b/qucs/components/component.h index c805a224f..cf553ae07 100644 --- a/qucs/components/component.h +++ b/qucs/components/component.h @@ -42,7 +42,7 @@ class Component : public Element { virtual Component* newOne(); virtual void recreate(Schematic*) {}; QString getNetlist(); - QString getSpiceNetlist(bool isXyce = false, bool isCdl = false); + QString getSpiceNetlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString getVerilogACode(); virtual QString getExpression(bool isXyce = false, bool isCdl = false); virtual QString getEquations(QString sim, QStringList &dep_vars); @@ -114,7 +114,7 @@ class Component : public Element { protected: virtual QString netlist(); - virtual QString spice_netlist(bool isXyce = false, bool isCdl = false); + virtual QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); virtual QString va_code(); virtual QString vhdlCode(int); @@ -150,7 +150,7 @@ class GateComponent : public MultiViewComponent { public: GateComponent(); QString netlist(); - QString spice_netlist(bool isXyce, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString vhdlCode(int); QString verilogCode(int); diff --git a/qucs/components/d_flipflop.cpp b/qucs/components/d_flipflop.cpp index f1aef1617..47520fc02 100644 --- a/qucs/components/d_flipflop.cpp +++ b/qucs/components/d_flipflop.cpp @@ -120,9 +120,9 @@ Element* D_FlipFlop::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString D_FlipFlop::spice_netlist(bool isXyce, bool) +QString D_FlipFlop::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/d_flipflop.h b/qucs/components/d_flipflop.h index 50bcea1b3..6370ae384 100644 --- a/qucs/components/d_flipflop.h +++ b/qucs/components/d_flipflop.h @@ -31,7 +31,7 @@ class D_FlipFlop : public Component { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/dc_sim.cpp b/qucs/components/dc_sim.cpp index 19bf45025..d5ebb3580 100644 --- a/qucs/components/dc_sim.cpp +++ b/qucs/components/dc_sim.cpp @@ -67,10 +67,10 @@ Element* DC_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString DC_Sim::spice_netlist(bool isXyce, bool) +QString DC_Sim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; - if ( !isXyce ) { + if (dialect != spicecompat::SPICEXyce) { s += "op\n"; } diff --git a/qucs/components/dc_sim.h b/qucs/components/dc_sim.h index 5b4b0c488..c08bb78f0 100644 --- a/qucs/components/dc_sim.h +++ b/qucs/components/dc_sim.h @@ -29,7 +29,7 @@ class DC_Sim : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/dcblock.cpp b/qucs/components/dcblock.cpp index 90872be9d..a3df15287 100644 --- a/qucs/components/dcblock.cpp +++ b/qucs/components/dcblock.cpp @@ -68,9 +68,10 @@ Element* dcBlock::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString dcBlock::spice_netlist(bool isXyce, bool) +QString dcBlock::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); QString p2 = spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); QString val = spicecompat::normalize_value(getProperty("C")->Value); @@ -82,5 +83,5 @@ QString dcBlock::spice_netlist(bool isXyce, bool) QString dcBlock::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/components/dcblock.h b/qucs/components/dcblock.h index 9c1ffb0ce..eb27a3270 100644 --- a/qucs/components/dcblock.h +++ b/qucs/components/dcblock.h @@ -29,7 +29,7 @@ class dcBlock : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/dcfeed.cpp b/qucs/components/dcfeed.cpp index 1251b4cb0..8288db167 100644 --- a/qucs/components/dcfeed.cpp +++ b/qucs/components/dcfeed.cpp @@ -69,9 +69,10 @@ Element* dcFeed::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString dcFeed::spice_netlist(bool isXyce, bool) +QString dcFeed::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); QString p2 = spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); QString val = spicecompat::normalize_value(getProperty("L")->Value); @@ -84,5 +85,5 @@ QString dcFeed::spice_netlist(bool isXyce, bool) QString dcFeed::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/components/dcfeed.h b/qucs/components/dcfeed.h index 5d0cbff40..8ef741dbf 100644 --- a/qucs/components/dcfeed.h +++ b/qucs/components/dcfeed.h @@ -29,7 +29,7 @@ class dcFeed : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/dff_SR.cpp b/qucs/components/dff_SR.cpp index 926f88ed0..c550a5204 100644 --- a/qucs/components/dff_SR.cpp +++ b/qucs/components/dff_SR.cpp @@ -13,7 +13,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * */ #include "dff_SR.h" #include "node.h" @@ -46,7 +46,7 @@ Component * dff_SR::newOne() dff_SR * p = new dff_SR(); p->Props.front()->Value = Props.front()->Value; - p->recreate(0); + p->recreate(0); return p; } @@ -85,7 +85,7 @@ void dff_SR::createSymbol() Texts.append(new Text( 15.5, 12, "Q", Qt::darkBlue, 12.0)); Texts.last()->over=true; Texts.append(new Text( -4, 24, "R", Qt::darkBlue, 12.0)); - + Ports.append(new Port(0, -60)); // S Ports.append(new Port(-50,-20)); // D Ports.append(new Port(-50, 20)); // CLK @@ -121,7 +121,7 @@ QString dff_SR::vhdlCode( int ) " state := '0';\n"+ " elsif ("+CLK+" = '1' and "+CLK+"'event) then\n"+ " state := "+D+";\n"+ - " end if;\n"+ + " end if;\n"+ " "+Q+" <= state"+td+ " "+QB+" <= not state"+td+ " end process;\n"; @@ -132,9 +132,9 @@ QString dff_SR::verilogCode( int ) { QString td = Props.at(2)->Value; // delay time if(!misc::Verilog_Delay(td, Name)) return td; // time does not have VHDL format - + QString l = ""; - + QString S = Ports.at(0)->Connection->Name; QString D = Ports.at(1)->Connection->Name; QString CLK = Ports.at(2)->Connection->Name; @@ -175,9 +175,9 @@ QString dff_SR::verilogCode( int ) return l; } -QString dff_SR::spice_netlist(bool isXyce, bool) +QString dff_SR::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/dff_SR.h b/qucs/components/dff_SR.h index 0e1b9be01..004780523 100644 --- a/qucs/components/dff_SR.h +++ b/qucs/components/dff_SR.h @@ -24,7 +24,7 @@ class dff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif /* dff_SR_H */ diff --git a/qucs/components/digi_source.cpp b/qucs/components/digi_source.cpp index ad5719475..075525241 100644 --- a/qucs/components/digi_source.cpp +++ b/qucs/components/digi_source.cpp @@ -88,7 +88,7 @@ QString Digi_Source::netlist() // output node names s += " "+Ports.first()->Connection->Name; - + // output all properties // first property not needed auto pp = Props.begin(); @@ -134,7 +134,7 @@ QString Digi_Source::vhdlCode(int NumPorts) else { // truth table simulation State = '0'; int Num = Props.at(0)->Value.toInt() - 1; - + s += Out + State + "';"; // first value for signal s += " wait for "+QString::number(1 << Num)+" ns;\n"; State ^= 1; @@ -179,7 +179,7 @@ QString Digi_Source::verilogCode(int NumPorts) } } else { // truth table simulation - int Num = Props.front()->Value.toInt() - 1; + int Num = Props.front()->Value.toInt() - 1; s += " always begin\n"; s += " " + r + " = 0;\n"; s += " #"+ QString::number(1 << Num) + ";\n"; @@ -191,8 +191,10 @@ QString Digi_Source::verilogCode(int NumPorts) return s; } -QString Digi_Source::spice_netlist(bool, bool) +QString Digi_Source::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = SpiceModel + Name; QString port = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); s += " " + port + " 0 "; // node names diff --git a/qucs/components/digi_source.h b/qucs/components/digi_source.h index 0972c3da7..1cae314fc 100644 --- a/qucs/components/digi_source.h +++ b/qucs/components/digi_source.h @@ -32,7 +32,7 @@ class Digi_Source : public Component { QString netlist(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/diode.cpp b/qucs/components/diode.cpp index 35f10eaac..327f395dc 100644 --- a/qucs/components/diode.cpp +++ b/qucs/components/diode.cpp @@ -99,7 +99,7 @@ Component* Diode::newOne() return new Diode(); } -QString Diode::spice_netlist(bool isXyce, bool cdl /* = false */) +QString Diode::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); // output all node names @@ -113,7 +113,7 @@ QString Diode::spice_netlist(bool isXyce, bool cdl /* = false */) } QStringList spice_incompat,spice_tr; - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { spice_tr<<"Tbv"<<"Tbv1"<<"Trs"<<"Trs1"; // parameters that need conversion of names spice_incompat<<"Ttt1"<<"Ttt2"<<"Tm1"<<"Tm2"<<"Cp"<<"Isr" <<"Nr"<<"Ffe"<<"Temp"<<"Area"<<"Symbol"<<"UseGlobTemp"; // spice-incompatible parameters @@ -149,9 +149,9 @@ QString Diode::spice_netlist(bool isXyce, bool cdl /* = false */) .arg(getProperty("Temp")->Value); } - if (!cdl) + if (dialect != spicecompat::CDL) { - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { s += QStringLiteral(".MODEL DMOD_%1 D (LEVEL = 2 %2)\n").arg(Name).arg(par_str); } else { s += QStringLiteral(".MODEL DMOD_%1 D (%2)\n").arg(Name).arg(par_str); @@ -163,7 +163,7 @@ QString Diode::spice_netlist(bool isXyce, bool cdl /* = false */) QString Diode::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } Element* Diode::info(QString& Name, char* &BitmapFile, bool getNewOne) diff --git a/qucs/components/diode.h b/qucs/components/diode.h index 900c9fba3..898b5a6dc 100644 --- a/qucs/components/diode.h +++ b/qucs/components/diode.h @@ -29,7 +29,7 @@ class Diode : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); void createSymbol(); }; diff --git a/qucs/components/eqndefined.cpp b/qucs/components/eqndefined.cpp index e0334ca25..a813ee7b1 100644 --- a/qucs/components/eqndefined.cpp +++ b/qucs/components/eqndefined.cpp @@ -96,8 +96,8 @@ QString EqnDefined::netlist() return s+e; } -QString EqnDefined::spice_netlist(bool isXyce, bool) -{ +QString EqnDefined::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) +{ QString s; QList used_currents; @@ -123,7 +123,7 @@ QString EqnDefined::spice_netlist(bool isXyce, bool) Ieqn.replace("^","**"); QStringList Itokens; spicecompat::splitEqn(Ieqn,Itokens); - spicecompat::convert_functions(Itokens,isXyce); + spicecompat::convert_functions(Itokens, dialect == spicecompat::SPICEXyce); subsVoltages(Itokens,Nbranch); subsCurrents(Itokens); QString plus = Ports.at(2*i)->Connection->Name; @@ -137,11 +137,11 @@ QString EqnDefined::spice_netlist(bool isXyce, bool) QString Qeqn = Props.at(2*(i+1)+1)->Value; // parse charge equation only for Xyce if (Qeqn!="0") { - //if (isXyce) { + //if (dialect == spicecompat::SPICEXyce) { Qeqn.replace("^","**"); QStringList Qtokens; spicecompat::splitEqn(Qeqn,Qtokens); - spicecompat::convert_functions(Qtokens,isXyce); + spicecompat::convert_functions(Qtokens, dialect == spicecompat::SPICEXyce); subsVoltages(Qtokens,Nbranch); subsCurrents(Qtokens); s += QStringLiteral("G%1Q%2 %3 %4 n%1Q%2 %4 1.0\n").arg(Name).arg(i).arg(plus).arg(minus); @@ -182,7 +182,7 @@ QString EqnDefined::va_code() vacompat::convert_functions(Qtokens); subsVoltages(Qtokens,Nbranch); if (plus=="gnd") s += QStringLiteral("%1 <+ -ddt( %2 );\n").arg(Ipm).arg(Qtokens.join("")); - else s += QStringLiteral("%1 <+ ddt( %2 );\n").arg(Ipm).arg(Qtokens.join("")); + else s += QStringLiteral("%1 <+ ddt( %2 );\n").arg(Ipm).arg(Qtokens.join("")); } } } else { @@ -252,13 +252,13 @@ void EqnDefined::subsCurrents(QStringList &tokens) // ------------------------------------------------------- void EqnDefined::createSymbol() -{ +{ QFont Font(QucsSettings.font); // default application font // symbol text is smaller (10 pt default) //Font.setPointSizeF(Font.pointSizeF()/1.2); // symbol text size proportional to default font size Font.setPointSize(10); // symbol text size fixed at 10 pt // get the small font size; use the screen-compatible metric - QFontMetrics smallmetrics(Font, 0); + QFontMetrics smallmetrics(Font, 0); int fHeight = smallmetrics.lineSpacing(); QString tmp; int i, PortDistance = 60; @@ -277,9 +277,9 @@ void EqnDefined::createSymbol() if (NumProps < Num) { for(i = NumProps; i < Num; i++) { Props.append(new Property("I"+QString::number(i+1), "0", false, - QObject::tr("current equation") + " " +QString::number(i+1))); + QObject::tr("current equation") + " " +QString::number(i+1))); Props.append(new Property("Q"+QString::number(i+1), "0", false, - QObject::tr("charge equation") + " " +QString::number(i+1))); + QObject::tr("charge equation") + " " +QString::number(i+1))); } } else { for(i = Num; i < NumProps; i++) { diff --git a/qucs/components/eqndefined.h b/qucs/components/eqndefined.h index 7b78837e6..6470f72ff 100644 --- a/qucs/components/eqndefined.h +++ b/qucs/components/eqndefined.h @@ -36,7 +36,7 @@ class EqnDefined : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/components/ground.cpp b/qucs/components/ground.cpp index 0c71a5c08..58a0c6674 100644 --- a/qucs/components/ground.cpp +++ b/qucs/components/ground.cpp @@ -66,7 +66,9 @@ QString Ground::netlist() return QString(); } -QString Ground::spice_netlist(bool, bool) +QString Ground::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + return QString(); } diff --git a/qucs/components/ground.h b/qucs/components/ground.h index 1d1796af1..fc46a9b1f 100644 --- a/qucs/components/ground.h +++ b/qucs/components/ground.h @@ -30,7 +30,7 @@ class Ground : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/gyrator.cpp b/qucs/components/gyrator.cpp index 48f3e40e6..0a4125c78 100644 --- a/qucs/components/gyrator.cpp +++ b/qucs/components/gyrator.cpp @@ -79,8 +79,10 @@ Element* Gyrator::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Gyrator::spice_netlist(bool, bool) +QString Gyrator::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s; QString R = spicecompat::normalize_value(Props.at(0)->Value); QString n1 = Ports.at(0)->Connection->Name; diff --git a/qucs/components/gyrator.h b/qucs/components/gyrator.h index e0bfbf06f..8e0c802c6 100644 --- a/qucs/components/gyrator.h +++ b/qucs/components/gyrator.h @@ -28,7 +28,7 @@ class Gyrator : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/hb_sim.cpp b/qucs/components/hb_sim.cpp index 549f82eb4..d8b4c9ae7 100644 --- a/qucs/components/hb_sim.cpp +++ b/qucs/components/hb_sim.cpp @@ -63,10 +63,10 @@ Element* HB_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString HB_Sim::spice_netlist(bool isXyce, bool) +QString HB_Sim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s=""; - if (isXyce) { // Only in Xyce + if (dialect == spicecompat::SPICEXyce) { // Only in Xyce s += QStringLiteral(".options hbint numfreq=%1 STARTUPPERIODS=2\n").arg(Props.at(1)->Value); QStringList freqs = Props.at(0)->Value.split(QRegularExpression("\\s+(?=[0-9])")); // split frequencyes list by space before digit diff --git a/qucs/components/hb_sim.h b/qucs/components/hb_sim.h index 72817056a..8108f920d 100644 --- a/qucs/components/hb_sim.h +++ b/qucs/components/hb_sim.h @@ -28,7 +28,7 @@ class HB_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/iexp.cpp b/qucs/components/iexp.cpp index f1dab0df3..b5a868ed4 100644 --- a/qucs/components/iexp.cpp +++ b/qucs/components/iexp.cpp @@ -85,19 +85,21 @@ Element* iExp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iExp::spice_netlist(bool, bool) +QString iExp::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); - s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); - s += " " + spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); + s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); + s += " " + spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); - QString U1= spicecompat::normalize_value(Props.at(0)->Value); - QString U2 = spicecompat::normalize_value(Props.at(1)->Value); - QString T1 = spicecompat::normalize_value(Props.at(2)->Value); - QString T2 = spicecompat::normalize_value(Props.at(3)->Value); - QString Tr = spicecompat::normalize_value(Props.at(4)->Value); - QString Tf = spicecompat::normalize_value(Props.at(5)->Value); + QString U1 = spicecompat::normalize_value(Props.at(0)->Value); + QString U2 = spicecompat::normalize_value(Props.at(1)->Value); + QString T1 = spicecompat::normalize_value(Props.at(2)->Value); + QString T2 = spicecompat::normalize_value(Props.at(3)->Value); + QString Tr = spicecompat::normalize_value(Props.at(4)->Value); + QString Tf = spicecompat::normalize_value(Props.at(5)->Value); s += QStringLiteral(" DC 0 EXP(%1 %2 %3 %4 %5 %6) AC 0\n").arg(U1).arg(U2).arg(T1).arg(Tr).arg(T2).arg(Tf); return s; diff --git a/qucs/components/iexp.h b/qucs/components/iexp.h index e4f3cf973..a79e84c53 100644 --- a/qucs/components/iexp.h +++ b/qucs/components/iexp.h @@ -31,7 +31,7 @@ class iExp : public Component { ~iExp(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/ifile.cpp b/qucs/components/ifile.cpp index 82363adf4..91fdeeea6 100644 --- a/qucs/components/ifile.cpp +++ b/qucs/components/ifile.cpp @@ -109,9 +109,10 @@ QString iFile::netlist() return s + "\n"; } -QString iFile::spice_netlist(bool isXyce, bool) +QString iFile::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s = SpiceModel + Name; QString modname = "mod_" + Model + Name; QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/ifile.h b/qucs/components/ifile.h index 8741fbb61..567a4053b 100644 --- a/qucs/components/ifile.h +++ b/qucs/components/ifile.h @@ -32,7 +32,7 @@ class iFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/indq.cpp b/qucs/components/indq.cpp index a26c3afc5..e426ff298 100644 --- a/qucs/components/indq.cpp +++ b/qucs/components/indq.cpp @@ -92,9 +92,10 @@ Element* IndQ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString IndQ::spice_netlist(bool isXyce, bool) +QString IndQ::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString pin1 = Ports.at(0)->Connection->Name; pin1 = spicecompat::normalize_node_name(pin1); diff --git a/qucs/components/indq.h b/qucs/components/indq.h index ec061c5bb..06c872efb 100644 --- a/qucs/components/indq.h +++ b/qucs/components/indq.h @@ -34,7 +34,7 @@ class IndQ : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/inductor.cpp b/qucs/components/inductor.cpp index 6a82f8fe7..e3db8f642 100644 --- a/qucs/components/inductor.cpp +++ b/qucs/components/inductor.cpp @@ -58,7 +58,7 @@ Component* Inductor::newOne() } -QString Inductor::spice_netlist(bool, bool isCdl /* = false */) +QString Inductor::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -69,7 +69,7 @@ QString Inductor::spice_netlist(bool, bool isCdl /* = false */) s += " "+spicecompat::normalize_value(Props.at(0)->Value) + " "; QString val = Props.at(1)->Value; // add inial voltage if presents val = val.remove(' ').toUpper(); - if (!val.isEmpty() && !isCdl) { + if (!val.isEmpty() && dialect != spicecompat::CDL) { s += " IC=" + val; } s += '\n'; @@ -79,7 +79,7 @@ QString Inductor::spice_netlist(bool, bool isCdl /* = false */) QString Inductor::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } QString Inductor::va_code() diff --git a/qucs/components/inductor.h b/qucs/components/inductor.h index fd3274e3b..5b72db88e 100644 --- a/qucs/components/inductor.h +++ b/qucs/components/inductor.h @@ -31,7 +31,7 @@ class Inductor : public Component { protected: QString va_code(); void getExtraVANodes(QStringList& nodes); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/iprobe.cpp b/qucs/components/iprobe.cpp index 62e384781..17b9864ee 100644 --- a/qucs/components/iprobe.cpp +++ b/qucs/components/iprobe.cpp @@ -79,8 +79,10 @@ Element* iProbe::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iProbe::spice_netlist(bool, bool) +QString iProbe::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = QStringLiteral("V%1 %2 %3 DC 0\n").arg(Name).arg(Ports.at(0)->Connection->Name) .arg(Ports.at(1)->Connection->Name); return s; diff --git a/qucs/components/iprobe.h b/qucs/components/iprobe.h index 9a7e0dbb5..5ebfd45f3 100644 --- a/qucs/components/iprobe.h +++ b/qucs/components/iprobe.h @@ -31,7 +31,7 @@ class iProbe : public Component { QString getProbeVariable(bool isXyce = false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/ipulse.cpp b/qucs/components/ipulse.cpp index 5f142c245..2564096dc 100644 --- a/qucs/components/ipulse.cpp +++ b/qucs/components/ipulse.cpp @@ -89,8 +89,10 @@ Element* iPulse::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString iPulse::spice_netlist(bool, bool) +QString iPulse::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); @@ -101,7 +103,7 @@ QString iPulse::spice_netlist(bool, bool) QString VL = spicecompat::normalize_value(Props.at(0)->Value); // VL QString VH = spicecompat::normalize_value(Props.at(1)->Value); // VH - QString Tr = spicecompat::normalize_value(Props.at(4)->Value); // Tr + QString Tr = spicecompat::normalize_value(Props.at(4)->Value); // Tr QString Tf = spicecompat::normalize_value(Props.at(5)->Value); // Tf misc::str2num(Props.at(2)->Value,T1,unit,fac); // Td diff --git a/qucs/components/ipulse.h b/qucs/components/ipulse.h index 4e3cd9cac..0b5eaa068 100644 --- a/qucs/components/ipulse.h +++ b/qucs/components/ipulse.h @@ -30,7 +30,7 @@ class iPulse : public Component { ~iPulse(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/irect.cpp b/qucs/components/irect.cpp index f63657157..fc9d4301d 100644 --- a/qucs/components/irect.cpp +++ b/qucs/components/irect.cpp @@ -80,15 +80,17 @@ iRect::~iRect() { } -QString iRect::spice_netlist(bool, bool) +QString iRect::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam; // node names - } + } double T, TL, TH, Trval, Tfval, fac; QString unit; @@ -101,11 +103,11 @@ QString iRect::spice_netlist(bool, bool) TH *= fac; // TH = pw misc::str2num(Props.at(2)->Value,TL,unit,fac); T = TL*fac+TH; - misc::str2num(Props.at(3)->Value,Trval,unit,fac); - T = Trval*fac+T; - misc::str2num(Props.at(4)->Value,Tfval,unit,fac); - T = Tfval*fac+T; - + misc::str2num(Props.at(3)->Value,Trval,unit,fac); + T = Trval*fac+T; + misc::str2num(Props.at(4)->Value,Tfval,unit,fac); + T = Tfval*fac+T; + s += QStringLiteral(" DC 0 PULSE( 0 -%1 %2 %3 %4 %5 %6) AC 0\n").arg(U).arg(Td).arg(Tr).arg(Tf).arg(TH).arg(T); return s; diff --git a/qucs/components/irect.h b/qucs/components/irect.h index da846c44b..1f74621cc 100644 --- a/qucs/components/irect.h +++ b/qucs/components/irect.h @@ -27,7 +27,7 @@ class iRect : public Component { ~iRect(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/jfet.cpp b/qucs/components/jfet.cpp index cb160528e..5e1e17e03 100644 --- a/qucs/components/jfet.cpp +++ b/qucs/components/jfet.cpp @@ -94,7 +94,7 @@ Component* JFET::newOne() return p; } -QString JFET::spice_netlist(bool isXyce, bool isCdl /* = false */) +QString JFET::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -108,7 +108,7 @@ QString JFET::spice_netlist(bool isXyce, bool isCdl /* = false */) QStringList spice_incompat,spice_tr; - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { spice_incompat<<"Type"<<"Area"<<"Temp"<<"Ffe"<<"N" <<"Isr"<<"Nr"<<"M"<<"Xti"<<"Betatce"<<"Vt0tc"<<"UseGLobTemp"; // spice-incompatible parameters @@ -131,7 +131,7 @@ QString JFET::spice_netlist(bool isXyce, bool isCdl /* = false */) .arg(getProperty("Temp")->Value); } - if (!isCdl) + if (dialect != spicecompat::CDL) { s += QStringLiteral(".MODEL JMOD_%1 %2JF (%3)\n").arg(Name).arg(jfet_type).arg(par_str); } @@ -141,7 +141,7 @@ QString JFET::spice_netlist(bool isXyce, bool isCdl /* = false */) QString JFET::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } // ------------------------------------------------------- diff --git a/qucs/components/jfet.h b/qucs/components/jfet.h index 49550fb4e..a0ff03df1 100644 --- a/qucs/components/jfet.h +++ b/qucs/components/jfet.h @@ -31,7 +31,7 @@ class JFET : public MultiViewComponent { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/jkff_SR.cpp b/qucs/components/jkff_SR.cpp index 2b8f37f9c..7d9f40d8f 100644 --- a/qucs/components/jkff_SR.cpp +++ b/qucs/components/jkff_SR.cpp @@ -184,9 +184,9 @@ QString jkff_SR::verilogCode( int ) return l; } -QString jkff_SR::spice_netlist(bool isXyce, bool) +QString jkff_SR::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/jkff_SR.h b/qucs/components/jkff_SR.h index 8f3733d32..dd7dd9b55 100644 --- a/qucs/components/jkff_SR.h +++ b/qucs/components/jkff_SR.h @@ -24,7 +24,7 @@ class jkff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif /* jkff_SR_H */ diff --git a/qucs/components/libcomp.cpp b/qucs/components/libcomp.cpp index ac2e21961..12b2fc073 100644 --- a/qucs/components/libcomp.cpp +++ b/qucs/components/libcomp.cpp @@ -361,8 +361,10 @@ QString LibComp::vhdlCode(int) return s; } -QString LibComp::spice_netlist(bool, bool) +QString LibComp::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = SpiceModel + Name + " 0 "; // connect ground of subckt to circuit ground for (Port *p1 : Ports) s += " "+p1->Connection->Name; // node names @@ -380,7 +382,7 @@ QString LibComp::spice_netlist(bool, bool) QString LibComp::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } QStringList LibComp::getAttachedIFS() diff --git a/qucs/components/libcomp.h b/qucs/components/libcomp.h index f2b96232e..d14cd746c 100644 --- a/qucs/components/libcomp.h +++ b/qucs/components/libcomp.h @@ -37,7 +37,7 @@ class LibComp : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); QString vhdlCode(int); QString verilogCode(int); diff --git a/qucs/components/logical_buf.cpp b/qucs/components/logical_buf.cpp index f6923be51..f5c4790ec 100644 --- a/qucs/components/logical_buf.cpp +++ b/qucs/components/logical_buf.cpp @@ -135,9 +135,9 @@ Element* Logical_Buf::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Logical_Buf::spice_netlist(bool isXyce, bool) +QString Logical_Buf::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/logical_buf.h b/qucs/components/logical_buf.h index e75c605e9..a1eae2f22 100644 --- a/qucs/components/logical_buf.h +++ b/qucs/components/logical_buf.h @@ -31,7 +31,7 @@ class Logical_Buf : public MultiViewComponent { protected: QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); void createSymbol(); }; diff --git a/qucs/components/logical_inv.cpp b/qucs/components/logical_inv.cpp index 1ca291e03..b4036e552 100644 --- a/qucs/components/logical_inv.cpp +++ b/qucs/components/logical_inv.cpp @@ -152,9 +152,9 @@ Element* Logical_Inv::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Logical_Inv::spice_netlist(bool isXyce, bool) +QString Logical_Inv::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/logical_inv.h b/qucs/components/logical_inv.h index 45f9a8340..b358e3b36 100644 --- a/qucs/components/logical_inv.h +++ b/qucs/components/logical_inv.h @@ -29,7 +29,7 @@ class Logical_Inv : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/mosfet.cpp b/qucs/components/mosfet.cpp index c7cf3c91d..6fe1179e7 100644 --- a/qucs/components/mosfet.cpp +++ b/qucs/components/mosfet.cpp @@ -140,7 +140,7 @@ QString MOSFET::netlist() return s + '\n'; } -QString MOSFET::spice_netlist(bool isXyce, bool isCdl /* = false */) +QString MOSFET::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -156,7 +156,7 @@ QString MOSFET::spice_netlist(bool isXyce, bool isCdl /* = false */) spice_incompat<<"Type"<<"Temp"<<"L"<<"W"<<"Ad"<<"As"<<"Pd"<<"Ps" <<"Rg"<<"N"<<"Tt"<<"Nrd"<<"Nrs"<<"Ffe"<<"UseGlobTemp"; // spice-incompatible parameters - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { spice_tr<<"Vt0"<<"VtO"; // parameters that need conversion of names } else { spice_tr.clear(); @@ -200,7 +200,7 @@ QString MOSFET::spice_netlist(bool isXyce, bool isCdl /* = false */) .arg(Name).arg(l).arg(w).arg(ad).arg(as).arg(pd).arg(ps).arg(getProperty("Temp")->Value); } - if (!isCdl) + if (dialect != spicecompat::CDL) { s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); } @@ -210,6 +210,6 @@ QString MOSFET::spice_netlist(bool isXyce, bool isCdl /* = false */) QString MOSFET::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/components/mosfet.h b/qucs/components/mosfet.h index d05b8551c..94a95e8e1 100644 --- a/qucs/components/mosfet.h +++ b/qucs/components/mosfet.h @@ -33,7 +33,7 @@ class MOSFET : public Basic_MOSFET { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/mosfet_sub.cpp b/qucs/components/mosfet_sub.cpp index 4e5ef4b7a..fc9584fac 100644 --- a/qucs/components/mosfet_sub.cpp +++ b/qucs/components/mosfet_sub.cpp @@ -150,7 +150,7 @@ Component* MOSFET_sub::newOne() return p; } -QString MOSFET_sub::spice_netlist(bool isXyce, bool isCdl /* = false */) +QString MOSFET_sub::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); QList pin_seq; @@ -166,7 +166,7 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool isCdl /* = false */) spice_incompat<<"Type"<<"Temp"<<"L"<<"W"<<"Ad"<<"As"<<"Pd"<<"Ps" <<"Rg"<<"N"<<"Tt"<<"Nrd"<<"Nrs"<<"Ffe"<<"UseGlobTemp"; // spice-incompatible parameters - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { spice_tr<<"Vt0"<<"VtO"; // parameters that need conversion of names } else { spice_tr.clear(); @@ -209,7 +209,7 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool isCdl /* = false */) .arg(Name).arg(l).arg(w).arg(ad).arg(as).arg(pd).arg(ps).arg(getProperty("Temp")->Value); } - if (!isCdl) + if (dialect != spicecompat::CDL) { s += QStringLiteral(".MODEL MMOD_%1 %2MOS (%3)\n").arg(Name).arg(mosfet_type).arg(par_str); } @@ -219,7 +219,7 @@ QString MOSFET_sub::spice_netlist(bool isXyce, bool isCdl /* = false */) QString MOSFET_sub::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } // ------------------------------------------------------- diff --git a/qucs/components/mosfet_sub.h b/qucs/components/mosfet_sub.h index b01671ce7..8050e5fc3 100644 --- a/qucs/components/mosfet_sub.h +++ b/qucs/components/mosfet_sub.h @@ -38,7 +38,7 @@ class MOSFET_sub : public Basic_MOSFET { protected: void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/mutual.cpp b/qucs/components/mutual.cpp index af518be9e..1a5c3ca76 100644 --- a/qucs/components/mutual.cpp +++ b/qucs/components/mutual.cpp @@ -84,9 +84,10 @@ Element* Mutual::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Mutual::spice_netlist(bool isXyce, bool) +QString Mutual::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString l1 = "L" + Name + "_L1"; QString l2 = "L" + Name + "_L2"; QString k1 = "K" + Name; diff --git a/qucs/components/mutual.h b/qucs/components/mutual.h index de81409d6..a9abb9304 100644 --- a/qucs/components/mutual.h +++ b/qucs/components/mutual.h @@ -29,7 +29,7 @@ class Mutual : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/mutual2.cpp b/qucs/components/mutual2.cpp index 9afcd731f..a3adc7ac5 100644 --- a/qucs/components/mutual2.cpp +++ b/qucs/components/mutual2.cpp @@ -114,10 +114,10 @@ Element* Mutual2::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Mutual2::spice_netlist(bool isXyce, bool) +QString Mutual2::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString l1 = "L" + Name + "_L1"; QString l2 = "L" + Name + "_L2"; QString l3 = "L" + Name + "_L3"; diff --git a/qucs/components/mutual2.h b/qucs/components/mutual2.h index 15a23c91b..46c673926 100644 --- a/qucs/components/mutual2.h +++ b/qucs/components/mutual2.h @@ -29,7 +29,7 @@ class Mutual2 : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/mutualx.cpp b/qucs/components/mutualx.cpp index 4ae6cf7b7..8ced18502 100644 --- a/qucs/components/mutualx.cpp +++ b/qucs/components/mutualx.cpp @@ -229,9 +229,10 @@ void MutualX::createSymbol() } } -QString MutualX::spice_netlist(bool isXyce, bool) +QString MutualX::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + int coils = getProperty("coils")->Value.toInt(); QString s; diff --git a/qucs/components/mutualx.h b/qucs/components/mutualx.h index e46d06eef..0e8a1fa77 100644 --- a/qucs/components/mutualx.h +++ b/qucs/components/mutualx.h @@ -35,7 +35,7 @@ class MutualX : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/opamp.cpp b/qucs/components/opamp.cpp index e3b6bc339..f3e94f381 100644 --- a/qucs/components/opamp.cpp +++ b/qucs/components/opamp.cpp @@ -74,7 +74,7 @@ Element* OpAmp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString OpAmp::spice_netlist(bool isXyce, bool) +QString OpAmp::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString in_m = Ports.at(0)->Connection->Name; if (in_m=="gnd") in_m="0"; @@ -89,7 +89,7 @@ QString OpAmp::spice_netlist(bool isXyce, bool) QString s; s = QStringLiteral("B_%1 %2 0 V = ").arg(Name).arg(out); - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { s += QStringLiteral("%1*V(%2,%3)*stp(%4-%1*V(%2,%3))*stp(%1*V(%2,%3)-(-%4))" "+%4*stp(%1*V(%2,%3)-%4)" "+(-%4)*stp((-%4)-%1*V(%2,%3))\n").arg(G).arg(in_p).arg(in_m).arg(Vmax); diff --git a/qucs/components/opamp.h b/qucs/components/opamp.h index d6c60c208..4eda09112 100644 --- a/qucs/components/opamp.h +++ b/qucs/components/opamp.h @@ -28,7 +28,7 @@ class OpAmp : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/param_sweep.cpp b/qucs/components/param_sweep.cpp index 8e6ef1989..a6ef3e0e6 100644 --- a/qucs/components/param_sweep.cpp +++ b/qucs/components/param_sweep.cpp @@ -193,14 +193,14 @@ QString Param_Sweep::getCounterVar() return s; } -QString Param_Sweep::spice_netlist(bool isXyce, bool) +QString Param_Sweep::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { double start,stop,step,fac,points; QString unit; QString s; - if(getProperty("Type")->Value=="list") { // List STEP variance Xyce-only - if(isXyce) { + if (getProperty("Type")->Value=="list") { // List STEP variance Xyce-only + if(dialect == spicecompat::SPICEXyce) { QString var = getProperty("Param")->Value; QString list = getProperty("Values")->Value; list.remove('[').remove(']'); @@ -209,7 +209,7 @@ QString Param_Sweep::spice_netlist(bool isXyce, bool) return s.toLower(); } } - if(getProperty("Type")->Value!="list" && getProperty("Type")->Value!="const"){ + if (getProperty("Type")->Value!="list" && getProperty("Type")->Value!="const"){ misc::str2num(getProperty("Start")->Value,start,unit,fac); start *= fac; misc::str2num(getProperty("Stop")->Value,stop,unit,fac); @@ -222,8 +222,8 @@ QString Param_Sweep::spice_netlist(bool isXyce, bool) if (Props.at(0)->Value.toLower().startsWith("dc")) { QString src = getProperty("Param")->Value; s = QStringLiteral("DC %1 %2 %3 %4\n").arg(src).arg(start).arg(stop).arg(step); - if (isXyce) s.prepend('.'); - } else if (isXyce) { + if (dialect == spicecompat::SPICEXyce) s.prepend('.'); + } else if (dialect == spicecompat::SPICEXyce) { QString var = getProperty("Param")->Value; s = QStringLiteral(".STEP %1 %2 %3 %4\n").arg(var).arg(start).arg(stop).arg(step); } else { diff --git a/qucs/components/param_sweep.h b/qucs/components/param_sweep.h index 4781c64b3..ed3066059 100644 --- a/qucs/components/param_sweep.h +++ b/qucs/components/param_sweep.h @@ -34,7 +34,7 @@ class Param_Sweep : public qucs::component::SimulationComponent { QString getCounterVar(); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString param_split_str=";"; }; diff --git a/qucs/components/potentiometer.cpp b/qucs/components/potentiometer.cpp index c26b15db0..365d88fcf 100644 --- a/qucs/components/potentiometer.cpp +++ b/qucs/components/potentiometer.cpp @@ -111,9 +111,10 @@ void potentiometer::createSymbol() x2 = 40; y2 = 15; } -QString potentiometer::spice_netlist(bool isXyce, bool) +QString potentiometer::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString R = spicecompat::normalize_value(getProperty("R_pot")->Value); QString rot = spicecompat::normalize_value(getProperty("Rotation")->Value); diff --git a/qucs/components/potentiometer.h b/qucs/components/potentiometer.h index 70119bc61..2f7f97eae 100644 --- a/qucs/components/potentiometer.h +++ b/qucs/components/potentiometer.h @@ -22,7 +22,7 @@ class potentiometer : public Component static Element* info(QString&, char* &, bool getNewOne=false); protected: void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif /* potentiometer_H */ diff --git a/qucs/components/relais.cpp b/qucs/components/relais.cpp index e6b40c4e9..a59d25282 100644 --- a/qucs/components/relais.cpp +++ b/qucs/components/relais.cpp @@ -85,7 +85,7 @@ Component* Relais::newOne() return new Relais(); } -QString Relais::spice_netlist(bool isXyce, bool) +QString Relais::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = Name; QString unit; @@ -114,7 +114,7 @@ QString Relais::spice_netlist(bool isXyce, bool) QString Ron = spicecompat::normalize_value(Props.at(2)->Value); QString Roff = spicecompat::normalize_value(Props.at(3)->Value); - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { s += QStringLiteral(".MODEL %1 vswitch von=%2 voff=%3 ron=%4 roff=%5 \n").arg(model).arg(Vt).arg(Vt-Vh).arg(Ron).arg(Roff); } else { s += QStringLiteral(".MODEL %1 sw vt=%2 vh=%3 ron=%4 roff=%5 \n").arg(model).arg(Vt).arg(Vh).arg(Ron).arg(Roff); diff --git a/qucs/components/relais.h b/qucs/components/relais.h index 3151d84af..e07f26cf5 100644 --- a/qucs/components/relais.h +++ b/qucs/components/relais.h @@ -27,7 +27,7 @@ class Relais : public Component { ~Relais(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/resistor.cpp b/qucs/components/resistor.cpp index 554e34bc3..dc698b0f0 100644 --- a/qucs/components/resistor.cpp +++ b/qucs/components/resistor.cpp @@ -53,7 +53,7 @@ Component* Resistor::newOne() return new Resistor(Props.back()->Value != "US"); } -QString Resistor::spice_netlist(bool, bool isCdl /* = false */) +QString Resistor::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); @@ -66,7 +66,7 @@ QString Resistor::spice_netlist(bool, bool isCdl /* = false */) s += QStringLiteral(" %1").arg(spicecompat::normalize_value(Props.at(0)->Value)); - if (!isCdl) + if (dialect != spicecompat::CDL) { if (!Tc1.isEmpty()) { s += " tc1=" + Tc1; @@ -84,7 +84,7 @@ QString Resistor::spice_netlist(bool, bool isCdl /* = false */) QString Resistor::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } QString Resistor::va_code() diff --git a/qucs/components/resistor.h b/qucs/components/resistor.h index 4c24b9128..fb86f78a5 100644 --- a/qucs/components/resistor.h +++ b/qucs/components/resistor.h @@ -30,7 +30,7 @@ class Resistor : public MultiViewComponent { static Element* info_us(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); QString va_code(); void createSymbol(); diff --git a/qucs/components/rlcg.cpp b/qucs/components/rlcg.cpp index 2c0dffb04..d12acf68c 100644 --- a/qucs/components/rlcg.cpp +++ b/qucs/components/rlcg.cpp @@ -93,9 +93,10 @@ Element* RLCG::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString RLCG::spice_netlist(bool isXyce, bool) +QString RLCG::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString in = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); QString out = spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); diff --git a/qucs/components/rlcg.h b/qucs/components/rlcg.h index 3a9cde6ac..5b5e201de 100644 --- a/qucs/components/rlcg.h +++ b/qucs/components/rlcg.h @@ -28,7 +28,7 @@ class RLCG : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/source_ac.cpp b/qucs/components/source_ac.cpp index 631ac23a2..66e674d74 100644 --- a/qucs/components/source_ac.cpp +++ b/qucs/components/source_ac.cpp @@ -159,9 +159,9 @@ QString Source_ac::xyce_netlist() return s; } -QString Source_ac::spice_netlist(bool isXyce, bool) +QString Source_ac::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { return xyce_netlist(); } else { return ngspice_netlist(); diff --git a/qucs/components/source_ac.h b/qucs/components/source_ac.h index 17cfbf6df..0dd75badb 100644 --- a/qucs/components/source_ac.h +++ b/qucs/components/source_ac.h @@ -30,7 +30,7 @@ class Source_ac : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString netlist(); }; diff --git a/qucs/components/sp_sim.cpp b/qucs/components/sp_sim.cpp index d705151db..ab750ddb6 100644 --- a/qucs/components/sp_sim.cpp +++ b/qucs/components/sp_sim.cpp @@ -206,9 +206,9 @@ QString SP_Sim::xyce_netlist() return s; } -QString SP_Sim::spice_netlist(bool isXyce, bool) +QString SP_Sim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { return xyce_netlist(); } else { return ngspice_netlist(); diff --git a/qucs/components/sp_sim.h b/qucs/components/sp_sim.h index ff9e3ecf0..edc49aefa 100644 --- a/qucs/components/sp_sim.h +++ b/qucs/components/sp_sim.h @@ -36,7 +36,7 @@ class SP_Sim : public qucs::component::SimulationComponent { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); void recreate(Schematic*); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QStringList getExtraVariables(); }; diff --git a/qucs/components/sparamfile.cpp b/qucs/components/sparamfile.cpp index 81083d2fb..e242896ed 100644 --- a/qucs/components/sparamfile.cpp +++ b/qucs/components/sparamfile.cpp @@ -196,10 +196,10 @@ void SParamFile::createSymbol() ty = y1 - 2*metrics.lineSpacing() - 4; } -QString SParamFile::spice_netlist(bool isXyce, bool) +QString SParamFile::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { int Np = getProperty("Ports")->Value.toInt(); s = "YLIN YLIN_" + Name; QString s_mod = "YLIN_" + Name + "_model"; diff --git a/qucs/components/sparamfile.h b/qucs/components/sparamfile.h index 955937a4e..59f29af33 100644 --- a/qucs/components/sparamfile.h +++ b/qucs/components/sparamfile.h @@ -35,7 +35,7 @@ class SParamFile : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/spicefile.cpp b/qucs/components/spicefile.cpp index 36dd1dc0e..e5998d7f5 100644 --- a/qucs/components/spicefile.cpp +++ b/qucs/components/spicefile.cpp @@ -479,8 +479,10 @@ void SpiceFile::slotExited() } } -QString SpiceFile::spice_netlist(bool, bool) +QString SpiceFile::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QStringList ports_lst = Props.at(1)->Value.split(","); for (auto & it : ports_lst) { if (it.startsWith("_net")) it.remove(0,4); @@ -509,5 +511,5 @@ QString SpiceFile::spice_netlist(bool, bool) QString SpiceFile::cdl_netlist() { - return spice_netlist(false); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/components/spicefile.h b/qucs/components/spicefile.h index 19b8c3145..13c881a89 100644 --- a/qucs/components/spicefile.h +++ b/qucs/components/spicefile.h @@ -53,7 +53,7 @@ class SpiceFile : public QObject, public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); private slots: diff --git a/qucs/components/subcircuit.cpp b/qucs/components/subcircuit.cpp index d9b652aaf..89ce5a772 100644 --- a/qucs/components/subcircuit.cpp +++ b/qucs/components/subcircuit.cpp @@ -219,7 +219,10 @@ QString Subcircuit::netlist() { return s + '\n'; } -QString Subcircuit::spice_netlist(bool, bool) { +QString Subcircuit::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) +{ + Q_UNUSED(dialect); + QString s; QString f = misc::properFileName(Props.at(0)->Value); s += spicecompat::check_refdes(Name, SpiceModel); @@ -240,7 +243,7 @@ QString Subcircuit::spice_netlist(bool, bool) { QString Subcircuit::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } // ------------------------------------------------------- diff --git a/qucs/components/subcircuit.h b/qucs/components/subcircuit.h index 0be677b1e..e7541d91b 100644 --- a/qucs/components/subcircuit.h +++ b/qucs/components/subcircuit.h @@ -32,7 +32,7 @@ class Subcircuit : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); QString vhdlCode(int); QString verilogCode(int); diff --git a/qucs/components/subcirport.cpp b/qucs/components/subcirport.cpp index 9b0bcf5f6..17d1181be 100644 --- a/qucs/components/subcirport.cpp +++ b/qucs/components/subcirport.cpp @@ -108,8 +108,10 @@ QString SubCirPort::netlist() } // ------------------------------------------------------- -QString SubCirPort::spice_netlist(bool, bool) +QString SubCirPort::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + return QString(); } diff --git a/qucs/components/subcirport.h b/qucs/components/subcirport.h index d7378dbb2..0798c289c 100644 --- a/qucs/components/subcirport.h +++ b/qucs/components/subcirport.h @@ -30,7 +30,7 @@ class SubCirPort : public MultiViewComponent { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString vhdlCode(int); QString verilogCode(int); void createSymbol(); diff --git a/qucs/components/switch.cpp b/qucs/components/switch.cpp index 52b02a914..15bedd1d5 100644 --- a/qucs/components/switch.cpp +++ b/qucs/components/switch.cpp @@ -84,8 +84,10 @@ QString Switch::netlist() return s + '\n'; } -QString Switch::spice_netlist(bool, bool) +QString Switch::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString port1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); QString port2 = spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); diff --git a/qucs/components/switch.h b/qucs/components/switch.h index 857105087..7800bb8ee 100644 --- a/qucs/components/switch.h +++ b/qucs/components/switch.h @@ -29,7 +29,7 @@ class Switch : public MultiViewComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString netlist(); void createSymbol(); }; diff --git a/qucs/components/tff_SR.cpp b/qucs/components/tff_SR.cpp index a54c40036..6c047c34c 100644 --- a/qucs/components/tff_SR.cpp +++ b/qucs/components/tff_SR.cpp @@ -175,9 +175,9 @@ QString tff_SR::verilogCode( int ) return l; } -QString tff_SR::spice_netlist(bool isXyce, bool) +QString tff_SR::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name; QString tmp_model = "model_" + Name; diff --git a/qucs/components/tff_SR.h b/qucs/components/tff_SR.h index 735e65ceb..ead997e64 100644 --- a/qucs/components/tff_SR.h +++ b/qucs/components/tff_SR.h @@ -24,7 +24,7 @@ class tff_SR : public Component void createSymbol(); QString vhdlCode(int); QString verilogCode(int); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif /* tff_SR_H */ diff --git a/qucs/components/tr_sim.cpp b/qucs/components/tr_sim.cpp index 7f6c72f06..43d22f774 100644 --- a/qucs/components/tr_sim.cpp +++ b/qucs/components/tr_sim.cpp @@ -91,7 +91,7 @@ Element* TR_Sim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString TR_Sim::spice_netlist(bool isXyce, bool) +QString TR_Sim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = SpiceModel; QString unit; @@ -109,11 +109,11 @@ QString TR_Sim::spice_netlist(bool isXyce, bool) QString max_step = spicecompat::normalize_value(getProperty("MaxStep")->Value); if (max_step!="0") s+= max_step; - if (!isXyce) { // Xyce ignores this parameter + if (dialect != spicecompat::SPICEXyce) { // Xyce ignores this parameter if (Props.at(18)->Value == "no") s += " UIC"; } s += "\n"; - if (!isXyce) s.remove(0,1); + if (dialect != spicecompat::SPICEXyce) s.remove(0,1); return s.toLower(); } diff --git a/qucs/components/tr_sim.h b/qucs/components/tr_sim.h index 869394a93..70f2a0f11 100644 --- a/qucs/components/tr_sim.h +++ b/qucs/components/tr_sim.h @@ -27,7 +27,7 @@ class TR_Sim : public qucs::component::SimulationComponent { ~TR_Sim(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); void recreate(Schematic*); }; diff --git a/qucs/components/vacomponent.cpp b/qucs/components/vacomponent.cpp index 38931e7f4..817539072 100644 --- a/qucs/components/vacomponent.cpp +++ b/qucs/components/vacomponent.cpp @@ -296,9 +296,9 @@ void vacomponent::createSymbol(QJsonObject json) } -QString vacomponent::spice_netlist(bool isXyce, bool) +QString vacomponent::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - if (isXyce) return QString(); + if (dialect == spicecompat::SPICEXyce) return QString(); QString s = SpiceModel + Name + " "; for(const auto pp: Ports) { diff --git a/qucs/components/vacomponent.h b/qucs/components/vacomponent.h index baa0283ad..39ff24b87 100644 --- a/qucs/components/vacomponent.h +++ b/qucs/components/vacomponent.h @@ -41,7 +41,7 @@ class vacomponent : public Component protected: void createSymbol(QJsonObject json); void parseJson(QJsonObject json); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; diff --git a/qucs/components/vccs.cpp b/qucs/components/vccs.cpp index af8ca1b13..74b1a7ca1 100644 --- a/qucs/components/vccs.cpp +++ b/qucs/components/vccs.cpp @@ -84,30 +84,30 @@ Element* VCCS::info(QString& Name, char* &BitmapFile, bool getNewOne) } QString VCCS::va_code() -{ - - QString Gain = vacompat::normalize_value(Props.at(0)->Value); - QString P1 = Ports.at(0)->Connection->Name; +{ + QString Gain = vacompat::normalize_value(Props.at(0)->Value); + QString P1 = Ports.at(0)->Connection->Name; QString P4 = Ports.at(1)->Connection->Name; QString P3 = Ports.at(2)->Connection->Name; QString P2 = Ports.at(3)->Connection->Name; QString s = ""; - + QString Vpm = vacompat::normalize_voltage(P1,P2); - QString Ipm = vacompat::normalize_current(P1,P2,true); + QString Ipm = vacompat::normalize_current(P1,P2,true); s += QStringLiteral(" %1 <+ %2 * 1e-9;\n").arg(Ipm).arg(Vpm); QString Vpm2 = vacompat::normalize_voltage(P4,P3); - QString Ipm2 = vacompat::normalize_current(P4,P3,true); + QString Ipm2 = vacompat::normalize_current(P4,P3,true); s += QStringLiteral("%1 <+ %2 * 1e-9;\n").arg(Ipm2).arg(Vpm2); s += QStringLiteral("%1 <+ %2 * %3 ;\n").arg(Ipm2).arg(Vpm).arg(Gain); - - return s; + return s; } -QString VCCS::spice_netlist(bool, bool) +QString VCCS::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - QString s = spicecompat::check_refdes(Name,SpiceModel); + Q_UNUSED(dialect); + + QString s = spicecompat::check_refdes(Name,SpiceModel); QList seq; // nodes sequence seq<<1<<2<<0<<3; // output all node names diff --git a/qucs/components/vccs.h b/qucs/components/vccs.h index 378a19bd7..fafda4373 100644 --- a/qucs/components/vccs.h +++ b/qucs/components/vccs.h @@ -29,7 +29,7 @@ class VCCS : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/components/vcresistor.cpp b/qucs/components/vcresistor.cpp index 87e7ca15e..37a835f3f 100644 --- a/qucs/components/vcresistor.cpp +++ b/qucs/components/vcresistor.cpp @@ -109,9 +109,10 @@ QString vcresistor::netlist() return s; } -QString vcresistor::spice_netlist(bool isXyce, bool) +QString vcresistor::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s; QString gain = spicecompat::normalize_value(getProperty("gain")->Value); QString in1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/vcresistor.h b/qucs/components/vcresistor.h index 0cd266d60..e1248b91c 100644 --- a/qucs/components/vcresistor.h +++ b/qucs/components/vcresistor.h @@ -29,7 +29,7 @@ class vcresistor : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/vcvs.cpp b/qucs/components/vcvs.cpp index 31c80d9f2..fa8a0e23f 100644 --- a/qucs/components/vcvs.cpp +++ b/qucs/components/vcvs.cpp @@ -64,7 +64,7 @@ VCVS::VCVS() SpiceModel = "E"; Props.append(new Property("G", "1", true, - QObject::tr("forward transfer factor"))); + QObject::tr("forward transfer factor"))); Props.append(new Property("T", "0", false, QObject::tr("delay time (Qucsator only)"))); } @@ -89,25 +89,28 @@ Element* VCVS::info(QString& Name, char* &BitmapFile, bool getNewOne) QString VCVS::va_code() { QString Gain = vacompat::normalize_value(Props.at(0)->Value); - QString P1 = Ports.at(0)->Connection->Name; + QString P1 = Ports.at(0)->Connection->Name; QString P4 = Ports.at(1)->Connection->Name; QString P3 = Ports.at(2)->Connection->Name; QString P2 = Ports.at(3)->Connection->Name; QString s = ""; - + QString Vpm = vacompat::normalize_voltage(P1,P2); - QString Ipm = vacompat::normalize_current(P1,P2,true); + QString Ipm = vacompat::normalize_current(P1,P2,true); s += QStringLiteral(" %1 <+ %2 * 1e-9;\n").arg(Ipm).arg(Vpm); QString Vpm2 = vacompat::normalize_voltage(P3,P4); - QString Ipm2 = vacompat::normalize_current(P3,P4,true); + QString Ipm2 = vacompat::normalize_current(P3,P4,true); s += QStringLiteral("%1 <+ -(%2 * 1e3);\n").arg(Ipm2).arg(Vpm2); s += QStringLiteral("%1 <+ -(%2 * 1e3* %3) ;\n").arg(Ipm2).arg(Vpm).arg(Gain); - + return s; - } -QString VCVS::spice_netlist(bool, bool) +} + +QString VCVS::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - QString s = spicecompat::check_refdes(Name,SpiceModel); + Q_UNUSED(dialect); + + QString s = spicecompat::check_refdes(Name,SpiceModel); QList seq; // nodes sequence seq<<1<<2<<0<<3; // output all node names diff --git a/qucs/components/vcvs.h b/qucs/components/vcvs.h index 34a13188b..2ac9bd38d 100644 --- a/qucs/components/vcvs.h +++ b/qucs/components/vcvs.h @@ -29,7 +29,7 @@ class VCVS : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/components/vexp.cpp b/qucs/components/vexp.cpp index 772c75138..b19e3179f 100644 --- a/qucs/components/vexp.cpp +++ b/qucs/components/vexp.cpp @@ -86,8 +86,10 @@ Element* vExp::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString vExp::spice_netlist(bool, bool) +QString vExp::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -95,12 +97,12 @@ QString vExp::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString U1= spicecompat::normalize_value(Props.at(0)->Value); - QString U2 = spicecompat::normalize_value(Props.at(1)->Value); - QString T1 = spicecompat::normalize_value(Props.at(2)->Value); - QString T2 = spicecompat::normalize_value(Props.at(3)->Value); - QString Tr = spicecompat::normalize_value(Props.at(4)->Value); - QString Tf = spicecompat::normalize_value(Props.at(5)->Value); + QString U1= spicecompat::normalize_value(Props.at(0)->Value); + QString U2 = spicecompat::normalize_value(Props.at(1)->Value); + QString T1 = spicecompat::normalize_value(Props.at(2)->Value); + QString T2 = spicecompat::normalize_value(Props.at(3)->Value); + QString Tr = spicecompat::normalize_value(Props.at(4)->Value); + QString Tf = spicecompat::normalize_value(Props.at(5)->Value); s += QStringLiteral(" DC 0 EXP(%1 %2 %3 %4 %5 %6) AC 0\n").arg(U1).arg(U2).arg(T1).arg(Tr).arg(T2).arg(Tf); return s; diff --git a/qucs/components/vexp.h b/qucs/components/vexp.h index a19da1eea..55e8092a0 100644 --- a/qucs/components/vexp.h +++ b/qucs/components/vexp.h @@ -31,7 +31,7 @@ class vExp : public Component { ~vExp(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/vfile.cpp b/qucs/components/vfile.cpp index bb6ba4bbc..4af50c5d1 100644 --- a/qucs/components/vfile.cpp +++ b/qucs/components/vfile.cpp @@ -112,9 +112,10 @@ QString vFile::netlist() return s + "\n"; } -QString vFile::spice_netlist(bool isXyce, bool) +QString vFile::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); + QString s = SpiceModel + Name; QString modname = "mod_" + Model + Name; QString p1 = spicecompat::normalize_node_name(Ports.at(0)->Connection->Name); diff --git a/qucs/components/vfile.h b/qucs/components/vfile.h index 30b7b334e..eb9f40ca1 100644 --- a/qucs/components/vfile.h +++ b/qucs/components/vfile.h @@ -32,7 +32,7 @@ class vFile : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/volt_ac.cpp b/qucs/components/volt_ac.cpp index e0886124c..f17231db3 100644 --- a/qucs/components/volt_ac.cpp +++ b/qucs/components/volt_ac.cpp @@ -83,8 +83,10 @@ Element* Volt_ac::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Volt_ac::spice_netlist(bool, bool) +QString Volt_ac::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/components/volt_ac.h b/qucs/components/volt_ac.h index 10f662cf8..716e12fd7 100644 --- a/qucs/components/volt_ac.h +++ b/qucs/components/volt_ac.h @@ -29,7 +29,7 @@ class Volt_ac : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString netlist(); }; diff --git a/qucs/components/volt_dc.cpp b/qucs/components/volt_dc.cpp index e66826f1d..d9ac038f8 100644 --- a/qucs/components/volt_dc.cpp +++ b/qucs/components/volt_dc.cpp @@ -59,7 +59,7 @@ Component* Volt_dc::newOne() return new Volt_dc(); } -QString Volt_dc::spice_netlist(bool, bool isCdl /* = false */) +QString Volt_dc::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { @@ -68,14 +68,14 @@ QString Volt_dc::spice_netlist(bool, bool isCdl /* = false */) s += " "+ nam; // node names } - s += QStringLiteral(" %1%2\n").arg(isCdl ? "" : "DC ").arg(spicecompat::normalize_value(Props.at(0)->Value)); + s += QStringLiteral(" %1%2\n").arg(dialect == spicecompat::CDL ? "" : "DC ").arg(spicecompat::normalize_value(Props.at(0)->Value)); return s; } QString Volt_dc::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } Element* Volt_dc::info(QString& Name, char* &BitmapFile, bool getNewOne) diff --git a/qucs/components/volt_dc.h b/qucs/components/volt_dc.h index 1a2bdb37b..8703b116a 100644 --- a/qucs/components/volt_dc.h +++ b/qucs/components/volt_dc.h @@ -29,7 +29,7 @@ class Volt_dc : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/components/vprobe.cpp b/qucs/components/vprobe.cpp index 4d7c5dc7a..7068f9a66 100644 --- a/qucs/components/vprobe.cpp +++ b/qucs/components/vprobe.cpp @@ -39,7 +39,7 @@ vProbe::vProbe() Lines.append(new qucs::Line(-10, 0,-10, 6,QPen(Qt::red,2))); Lines.append(new qucs::Line(-13, 3, -7, 3,QPen(Qt::red,2))); Lines.append(new qucs::Line( 7, 3, 13, 3,QPen(Qt::black,2))); - + Lines.append(new qucs::Line(-10, 9,-10, 20,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 10, 9, 10, 20,QPen(Qt::darkBlue,2))); Ports.append(new Port(-10, 20)); @@ -78,8 +78,10 @@ QString vProbe::getProbeVariable(bool) return Name; } -QString vProbe::spice_netlist(bool, bool) +QString vProbe::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = QStringLiteral("E%1 %2 0 %3 %4 1.0\nR%1%2 %2 0 1E8\nR%1%3 %3 %4 1E8\n").arg(Name).arg(Name) .arg(Ports.at(0)->Connection->Name).arg(Ports.at(1)->Connection->Name); return s; diff --git a/qucs/components/vprobe.h b/qucs/components/vprobe.h index 2bdd461c9..147762774 100644 --- a/qucs/components/vprobe.h +++ b/qucs/components/vprobe.h @@ -29,7 +29,7 @@ class vProbe : public Component { static Element* info(QString&, char* &, bool getNewOne=false); QString getProbeVariable(bool isXyce = false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/vpulse.cpp b/qucs/components/vpulse.cpp index e707e22d9..aa6d4e57a 100644 --- a/qucs/components/vpulse.cpp +++ b/qucs/components/vpulse.cpp @@ -73,8 +73,10 @@ vPulse::~vPulse() { } -QString vPulse::spice_netlist(bool, bool) +QString vPulse::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { @@ -88,7 +90,7 @@ QString vPulse::spice_netlist(bool, bool) QString VL = spicecompat::normalize_value(Props.at(0)->Value); // VL QString VH = spicecompat::normalize_value(Props.at(1)->Value); // VH - QString Tr = spicecompat::normalize_value(Props.at(4)->Value); // Tr + QString Tr = spicecompat::normalize_value(Props.at(4)->Value); // Tr QString Tf = spicecompat::normalize_value(Props.at(5)->Value); // Tf misc::str2num(Props.at(2)->Value,T1,unit,fac); // Td diff --git a/qucs/components/vpulse.h b/qucs/components/vpulse.h index 1ecd4ecf7..86aa39879 100644 --- a/qucs/components/vpulse.h +++ b/qucs/components/vpulse.h @@ -30,7 +30,7 @@ class vPulse : public Component { ~vPulse(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/components/vrect.cpp b/qucs/components/vrect.cpp index 5ec12728d..411d4c38e 100644 --- a/qucs/components/vrect.cpp +++ b/qucs/components/vrect.cpp @@ -74,8 +74,10 @@ vRect::~vRect() { } -QString vRect::spice_netlist(bool, bool) +QString vRect::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { diff --git a/qucs/components/vrect.h b/qucs/components/vrect.h index cf907080d..080862b85 100644 --- a/qucs/components/vrect.h +++ b/qucs/components/vrect.h @@ -29,7 +29,7 @@ class vRect : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString netlist(); }; diff --git a/qucs/extsimkernels/CdlNetlistWriter.cpp b/qucs/extsimkernels/CdlNetlistWriter.cpp index ef09e8e74..3fe8d12db 100644 --- a/qucs/extsimkernels/CdlNetlistWriter.cpp +++ b/qucs/extsimkernels/CdlNetlistWriter.cpp @@ -162,7 +162,7 @@ void CdlNetlistWriter::startNetlist() { if (a_schematic->getIsAnalog() && !pc->isSimulation && !pc->isEquation) { - s = pc->getSpiceNetlist(false, true); + s = pc->getSpiceNetlist(spicecompat::CDL); a_netlistStream << s; } } diff --git a/qucs/extsimkernels/abstractspicekernel.cpp b/qucs/extsimkernels/abstractspicekernel.cpp index 13d490fb3..58c92f0e9 100644 --- a/qucs/extsimkernels/abstractspicekernel.cpp +++ b/qucs/extsimkernels/abstractspicekernel.cpp @@ -191,7 +191,7 @@ bool AbstractSpiceKernel::checkDCSimulation() * \param xyce Default is false. Should be set in true if netlist is * prepared for Xyce simulator. For Ngspice should be false. */ -void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce) +void AbstractSpiceKernel::startNetlist(QTextStream &stream, spicecompat::SpiceDialect dialect) { QString s; @@ -235,7 +235,7 @@ void AbstractSpiceKernel::startNetlist(QTextStream &stream, bool xyce) // Parameters, Initial conditions, Options for(Component *pc = a_schematic->a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) { if (pc->isEquation) { - s = pc->getExpression(xyce); + s = pc->getExpression(dialect); stream<getIsAnalog() && !(pc->isSimulation) && !(pc->isEquation)) { - s = pc->getSpiceNetlist(xyce); + s = pc->getSpiceNetlist(dialect); stream<a_DocComps.first(); pc != 0; pc = a_schematic->a_DocComps.next()) { // Xyce can run if(pc->isSimulation && pc->isActive == COMP_IS_ACTIVE) { // only one simulations per time. QString sim_typ = pc->Model; // Multiple simulations are forbidden. - QString s = pc->getSpiceNetlist(true); + QString s = pc->getSpiceNetlist(spicecompat::SPICEXyce); if ((sim_typ==".AC")&&(sim=="ac")) stream<Model==".FOURIER") { if (pc1->Props.at(0)->Value==pc->Name) { - QString s1 = pc1->getSpiceNetlist(true); + QString s1 = pc1->getSpiceNetlist(spicecompat::SPICEXyce); outputs.append("spice4qucs.tran.cir.four0"); stream<Value; QString s = spicecompat::check_refdes(Name,ltr); for (Port *p1 : Ports) { @@ -214,6 +216,6 @@ QString BJT_SPICE::spice_netlist(bool, bool) QString BJT_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/BJT_SPICE.h b/qucs/spicecomponents/BJT_SPICE.h index e22de63f0..e0c6a940c 100644 --- a/qucs/spicecomponents/BJT_SPICE.h +++ b/qucs/spicecomponents/BJT_SPICE.h @@ -38,7 +38,7 @@ class BJT_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/C_SPICE.cpp b/qucs/spicecomponents/C_SPICE.cpp index b1892c664..13292c98f 100644 --- a/qucs/spicecomponents/C_SPICE.cpp +++ b/qucs/spicecomponents/C_SPICE.cpp @@ -109,8 +109,10 @@ QString C_SPICE::netlist() return QString(); } -QString C_SPICE::spice_netlist(bool, bool) +QString C_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); for (Port *p1 : Ports) { @@ -130,7 +132,9 @@ QString C_SPICE::spice_netlist(bool, bool) if( C_Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(C_Line_3); if( C_Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(C_Line_4); if( C_Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(C_Line_5); + s += "\n"; + return s; } @@ -138,7 +142,7 @@ QString C_SPICE::cdl_netlist() { if (Ports.size() == 2) { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } return QString(); diff --git a/qucs/spicecomponents/C_SPICE.h b/qucs/spicecomponents/C_SPICE.h index 8e4851a97..c0e52a364 100644 --- a/qucs/spicecomponents/C_SPICE.h +++ b/qucs/spicecomponents/C_SPICE.h @@ -34,7 +34,7 @@ class C_SPICE: public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/DIODE_SPICE.cpp b/qucs/spicecomponents/DIODE_SPICE.cpp index 73cd6f2e7..5fdd6b179 100644 --- a/qucs/spicecomponents/DIODE_SPICE.cpp +++ b/qucs/spicecomponents/DIODE_SPICE.cpp @@ -114,8 +114,10 @@ QString DIODE_SPICE::netlist() return QString(); } -QString DIODE_SPICE::spice_netlist(bool, bool) +QString DIODE_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); for (Port *p1 : Ports) { @@ -135,7 +137,9 @@ QString DIODE_SPICE::spice_netlist(bool, bool) if( D_Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(D_Line_3); if( D_Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(D_Line_4); if( D_Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(D_Line_5); + s += "\n"; + return s; } @@ -143,7 +147,7 @@ QString DIODE_SPICE::cdl_netlist() { if (Ports.size() == 2) { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } return QString(); diff --git a/qucs/spicecomponents/DIODE_SPICE.h b/qucs/spicecomponents/DIODE_SPICE.h index d650f2d09..53a7f7ee3 100644 --- a/qucs/spicecomponents/DIODE_SPICE.h +++ b/qucs/spicecomponents/DIODE_SPICE.h @@ -34,7 +34,7 @@ class DIODE_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/Icouple.cpp b/qucs/spicecomponents/Icouple.cpp index bec8d5b26..5e184d867 100644 --- a/qucs/spicecomponents/Icouple.cpp +++ b/qucs/spicecomponents/Icouple.cpp @@ -27,11 +27,11 @@ Icouple::Icouple() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-40, -40, -40, -30,QPen(Qt::darkBlue,2))); // L1 - Lines.append(new qucs::Line(-40, -30, -40, -25,QPen(Qt::blue,3))); // L2 - Lines.append(new qucs::Line(-40, -25, -30, -25,QPen(Qt::blue,3))); // L3 - Lines.append(new qucs::Line(-30, -25, -30, -15,QPen(Qt::blue,3))); // L4 - Lines.append(new qucs::Line(-30, -15, -40, -15,QPen(Qt::blue,3))); // L5 - Lines.append(new qucs::Line(-30, -15, -40, -15,QPen(Qt::blue,3))); // L6 + Lines.append(new qucs::Line(-40, -30, -40, -25,QPen(Qt::blue,3))); // L2 + Lines.append(new qucs::Line(-40, -25, -30, -25,QPen(Qt::blue,3))); // L3 + Lines.append(new qucs::Line(-30, -25, -30, -15,QPen(Qt::blue,3))); // L4 + Lines.append(new qucs::Line(-30, -15, -40, -15,QPen(Qt::blue,3))); // L5 + Lines.append(new qucs::Line(-30, -15, -40, -15,QPen(Qt::blue,3))); // L6 Lines.append(new qucs::Line(-40, -15, -40, -5,QPen(Qt::blue,3))); // L7 Lines.append(new qucs::Line(-40, -5, -30, -5,QPen(Qt::blue,3))); // L8 Lines.append(new qucs::Line(-30, -5, -30, 5,QPen(Qt::blue,3))); // L9 @@ -39,23 +39,23 @@ Icouple::Icouple() Lines.append(new qucs::Line(-40, 5, -40, 15,QPen(Qt::blue,3))); // L11 Lines.append(new qucs::Line(-40, 15, -30, 15,QPen(Qt::blue,3))); // L12 Lines.append(new qucs::Line(-30, 15, -30, 25,QPen(Qt::blue,3))); // L13 - Lines.append(new qucs::Line(-30, 25, -40, 25,QPen(Qt::blue,3))); // L14 - Lines.append(new qucs::Line(-40, 25, -40, 30,QPen(Qt::blue,3))); // L15 - Lines.append(new qucs::Line(-40, 30, -40, 40,QPen(Qt::darkBlue,2))); // L16 - + Lines.append(new qucs::Line(-30, 25, -40, 25,QPen(Qt::blue,3))); // L14 + Lines.append(new qucs::Line(-40, 25, -40, 30,QPen(Qt::blue,3))); // L15 + Lines.append(new qucs::Line(-40, 30, -40, 40,QPen(Qt::darkBlue,2))); // L16 + Lines.append(new qucs::Line( 40, -40, 40, -30,QPen(Qt::darkBlue,2))); // L17 Lines.append(new qucs::Line( 40, -30, 40, -20,QPen(Qt::blue,3))); // L18 Lines.append(new qucs::Line( 40, -20, 20, 0,QPen(Qt::blue,3))); // L19 Lines.append(new qucs::Line( 20, 0, 40, 20,QPen(Qt::blue,3))); // L20 Lines.append(new qucs::Line( 40, 20, 60, 0,QPen(Qt::blue,3))); // L21 - Lines.append(new qucs::Line( 60, 00, 40, -20,QPen(Qt::blue,3))); // L22 + Lines.append(new qucs::Line( 60, 00, 40, -20,QPen(Qt::blue,3))); // L22 Lines.append(new qucs::Line( 40, 20, 40, 30,QPen(Qt::blue,3))); // L23 - Lines.append(new qucs::Line( 40, 30, 40, 40,QPen(Qt::darkBlue,2))); // L24 - + Lines.append(new qucs::Line( 40, 30, 40, 40,QPen(Qt::darkBlue,2))); // L24 + Lines.append(new qucs::Line( 20, -20, 20, -10,QPen(Qt::red,3))); // + Lines.append(new qucs::Line( 15, -15, 25, -15,QPen(Qt::red,3))); - Lines.append(new qucs::Line( 15, 20, 25, 20,QPen(Qt::black,3))); // - - + Lines.append(new qucs::Line( 15, 20, 25, 20,QPen(Qt::black,3))); // - + Ports.append(new Port( -40, -40)); // Pplus Ports.append(new Port( -40, 40)); // Pneg Ports.append(new Port( 40, -40)); // PVplus @@ -70,10 +70,10 @@ Icouple::Icouple() Model = "Icouple"; SpiceModel = "A"; Name = "ICOUPLE"; - + Props.append(new Property("A ", "", true,"Parameter list and\n .model spec.")); Props.append(new Property("A_Line 2", "", false,".model line")); - + //rotate(); // fix historical flaw } @@ -89,7 +89,7 @@ Component* Icouple::newOne() Element* Icouple::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("Icouple"); - BitmapFile = (char *) "Icouple"; + BitmapFile = (char *) "Icouple"; if(getNewOne) return new Icouple(); return 0; @@ -100,17 +100,18 @@ QString Icouple::netlist() return QString(); } -QString Icouple::spice_netlist(bool, bool) +QString Icouple::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString P1 = Ports.at(0)->Connection->Name; QString P2 = Ports.at(1)->Connection->Name; QString P3 = Ports.at(2)->Connection->Name; QString P4 = Ports.at(3)->Connection->Name; - - s += " " + P1 + " " + P2 + " " + P3 + " " + P4 + " "; - + + s += " " + P1 + " " + P2 + " " + P3 + " " + P4 + " "; + QString A= Props.at(0)->Value; QString A_Line_2= Props.at(1)->Value; if( A.length() > 0) s += QStringLiteral("%1").arg(A); diff --git a/qucs/spicecomponents/Icouple.h b/qucs/spicecomponents/Icouple.h index e27c8d5d5..61110ee74 100644 --- a/qucs/spicecomponents/Icouple.h +++ b/qucs/spicecomponents/Icouple.h @@ -31,7 +31,7 @@ class Icouple: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // Icouple diff --git a/qucs/spicecomponents/K_SPICE.cpp b/qucs/spicecomponents/K_SPICE.cpp index 7fd941220..8275f2448 100644 --- a/qucs/spicecomponents/K_SPICE.cpp +++ b/qucs/spicecomponents/K_SPICE.cpp @@ -44,11 +44,11 @@ K_SPICE::K_SPICE() SpiceModel = "K"; Name = "K"; - + Props.append(new Property("Ind1", "L1", true, "Inductance 1 name")); Props.append(new Property("Ind2", "L2", true, "Inductance 2 name")); Props.append(new Property("K", "0.1", true, QObject::tr("Coupling factor ( 0 < K <= 1)"))); - + rotate(); // fix historical flaw } @@ -75,20 +75,25 @@ QString K_SPICE::netlist() return QString(); } -QString K_SPICE::spice_netlist(bool, bool) +QString K_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - QString s = spicecompat::check_refdes(Name,SpiceModel); - for (Port *p1 : Ports) { + Q_UNUSED(dialect); + + QString s = spicecompat::check_refdes(Name,SpiceModel); + + for (Port *p1 : Ports) + { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; - s += " "+ nam+" "; // node names -} - QString Ind1 = Props.at(0) ->Value; - QString Ind2 = Props.at(1) ->Value; - QString K = spicecompat::normalize_value(Props.at(2)->Value); - - s+= QStringLiteral(" %1 %2 %3 \n").arg(Ind1).arg(Ind2).arg(K); - + s += " " + nam + " "; // node names + } + + QString Ind1 = Props.at(0) ->Value; + QString Ind2 = Props.at(1) ->Value; + QString K = spicecompat::normalize_value(Props.at(2)->Value); + + s+= QStringLiteral(" %1 %2 %3 \n").arg(Ind1).arg(Ind2).arg(K); + return s; } diff --git a/qucs/spicecomponents/K_SPICE.h b/qucs/spicecomponents/K_SPICE.h index 693ead557..414e31949 100644 --- a/qucs/spicecomponents/K_SPICE.h +++ b/qucs/spicecomponents/K_SPICE.h @@ -31,7 +31,7 @@ class K_SPICE: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // K_SPICE_H diff --git a/qucs/spicecomponents/LTL_SPICE.cpp b/qucs/spicecomponents/LTL_SPICE.cpp index d3a5ed82b..4133d2d73 100644 --- a/qucs/spicecomponents/LTL_SPICE.cpp +++ b/qucs/spicecomponents/LTL_SPICE.cpp @@ -24,7 +24,7 @@ LTL_SPICE::LTL_SPICE() { Description = QObject::tr("SPICE T:"); Simulator = spicecompat::simSpice; - + Arcs.append(new qucs::Arc(-28,-40, 18, 38,16*232, 16*33,QPen(Qt::darkBlue,2))); Arcs.append(new qucs::Arc(-28, 2, 18, 38, 16*95, 16*33,QPen(Qt::darkBlue,2))); @@ -42,8 +42,8 @@ LTL_SPICE::LTL_SPICE() Ports.append(new Port(-30,-10)); Ports.append(new Port(-30, 10)); Ports.append(new Port( 30,-10)); - Ports.append(new Port( 30, 10)); - + Ports.append(new Port( 30, 10)); + x1 = -30; y1 =-12; x2 = 30; y2 = 12; @@ -61,7 +61,7 @@ LTL_SPICE::LTL_SPICE() Props.append(new Property("V1", "0", true, QObject::tr("Initial voltage at end 1"))); Props.append(new Property("I1", "0", true, QObject::tr("Initial current at end 1"))); Props.append(new Property("V2", "0", true, QObject::tr("Initial voltage at end 2"))); - Props.append(new Property("I2", "0", true, QObject::tr("Initial current at end 2"))); + Props.append(new Property("I2", "0", true, QObject::tr("Initial current at end 2"))); } @@ -88,8 +88,10 @@ QString LTL_SPICE::netlist() return QString(); } -QString LTL_SPICE::spice_netlist(bool, bool) +QString LTL_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -97,29 +99,29 @@ QString LTL_SPICE::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString Z0 = spicecompat::normalize_value(Props.at(0)->Value); - QString Td = spicecompat::normalize_value(Props.at(1)->Value); - QString Freq = spicecompat::normalize_value(Props.at(2)->Value); - QString Nl = spicecompat::normalize_value(Props.at(3)->Value); - QString V1 = spicecompat::normalize_value(Props.at(4)->Value); - QString I1 = spicecompat::normalize_value(Props.at(5)->Value); - QString V2 = spicecompat::normalize_value(Props.at(6)->Value); - QString I2 = spicecompat::normalize_value(Props.at(7)->Value); - - - - if( Z0.trimmed().length() > 0) { - s += QStringLiteral(" Z0=%1").arg(Z0); - } - if( Td.trimmed().length() > 0 ) { - s += QStringLiteral(" Td=%1").arg(Td); - } - if( Freq.trimmed().length() > 0 ) { - s += QStringLiteral(" F=%1").arg(Freq); - } - if( Nl.trimmed().length() > 0 ) { - s += QStringLiteral(" NL=%1").arg(Nl); - } - s += QStringLiteral(" IC=%5, %6, %7, %8 \n").arg(V1).arg(I1).arg(V2).arg(I2); + QString Z0 = spicecompat::normalize_value(Props.at(0)->Value); + QString Td = spicecompat::normalize_value(Props.at(1)->Value); + QString Freq = spicecompat::normalize_value(Props.at(2)->Value); + QString Nl = spicecompat::normalize_value(Props.at(3)->Value); + QString V1 = spicecompat::normalize_value(Props.at(4)->Value); + QString I1 = spicecompat::normalize_value(Props.at(5)->Value); + QString V2 = spicecompat::normalize_value(Props.at(6)->Value); + QString I2 = spicecompat::normalize_value(Props.at(7)->Value); + + if( Z0.trimmed().length() > 0) { + s += QStringLiteral(" Z0=%1").arg(Z0); + } + if( Td.trimmed().length() > 0 ) { + s += QStringLiteral(" Td=%1").arg(Td); + } + if( Freq.trimmed().length() > 0 ) { + s += QStringLiteral(" F=%1").arg(Freq); + } + if( Nl.trimmed().length() > 0 ) { + s += QStringLiteral(" NL=%1").arg(Nl); + } + + s += QStringLiteral(" IC=%5, %6, %7, %8 \n").arg(V1).arg(I1).arg(V2).arg(I2); + return s; } diff --git a/qucs/spicecomponents/LTL_SPICE.h b/qucs/spicecomponents/LTL_SPICE.h index 5d23f37a8..cd23df9e0 100644 --- a/qucs/spicecomponents/LTL_SPICE.h +++ b/qucs/spicecomponents/LTL_SPICE.h @@ -29,7 +29,7 @@ class LTL_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // LTL_SPICE_H diff --git a/qucs/spicecomponents/LTRA_SPICE.cpp b/qucs/spicecomponents/LTRA_SPICE.cpp index b4d264d2b..ce8d8a657 100644 --- a/qucs/spicecomponents/LTRA_SPICE.cpp +++ b/qucs/spicecomponents/LTRA_SPICE.cpp @@ -29,29 +29,29 @@ LTRA_SPICE::LTRA_SPICE() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-60, -20,-45, -20,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-45, -20, 45, -20,QPen(Qt::darkRed,4))); + Lines.append(new qucs::Line(-45, -20, 45, -20,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line( 45, -20, 60, -20,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-60, 20,-45, 20,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line(-45, 20, 45, 20,QPen(Qt::darkRed,4))); + Lines.append(new qucs::Line(-45, 20, 45, 20,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line( 45, 20, 60, 20,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-45, 0, -37, 0,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line(-37, 0, -30, -10,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line(-30, -10, -15, 10,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line(-15, 10, 0, -10,QPen(Qt::darkRed,4))); Lines.append(new qucs::Line( 0, -10, 15, 10,QPen(Qt::darkRed,4))); - Lines.append(new qucs::Line( 15, 10, 30, -10,QPen(Qt::darkRed,4))); - Lines.append(new qucs::Line( 30, -10, 37, 0,QPen(Qt::darkRed,4))); - Lines.append(new qucs::Line( 37, 0, 45, 0,QPen(Qt::darkRed,4))); + Lines.append(new qucs::Line( 15, 10, 30, -10,QPen(Qt::darkRed,4))); + Lines.append(new qucs::Line( 30, -10, 37, 0,QPen(Qt::darkRed,4))); + Lines.append(new qucs::Line( 37, 0, 45, 0,QPen(Qt::darkRed,4))); + + - - Ports.append(new Port( -60, -20)); // P1 Ports.append(new Port( -60, 20)); // P2 Ports.append(new Port( 60, -20)); // P3 Ports.append(new Port( 60, 20)); // P4 - + x1 = -40; y1 = -20; x2 = 40; y2 = 30; @@ -94,15 +94,17 @@ QString LTRA_SPICE::netlist() return QString(); } -QString LTRA_SPICE::spice_netlist(bool, bool) +QString LTRA_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString O= Props.at(0)->Value; QString O_Line_2= Props.at(1)->Value; QString O_Line_3= Props.at(2)->Value; diff --git a/qucs/spicecomponents/LTRA_SPICE.h b/qucs/spicecomponents/LTRA_SPICE.h index 81ef706c9..bbb01413b 100644 --- a/qucs/spicecomponents/LTRA_SPICE.h +++ b/qucs/spicecomponents/LTRA_SPICE.h @@ -29,7 +29,7 @@ class LTRA_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // LTRA_SPICE_H diff --git a/qucs/spicecomponents/L_SPICE.cpp b/qucs/spicecomponents/L_SPICE.cpp index 3b4cb8912..60db018ec 100644 --- a/qucs/spicecomponents/L_SPICE.cpp +++ b/qucs/spicecomponents/L_SPICE.cpp @@ -83,8 +83,10 @@ QString L_SPICE::netlist() return QString(); } -QString L_SPICE::spice_netlist(bool, bool) +QString L_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -110,5 +112,5 @@ QString L_SPICE::spice_netlist(bool, bool) QString L_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/L_SPICE.h b/qucs/spicecomponents/L_SPICE.h index cc9de1c46..ab54b5e59 100644 --- a/qucs/spicecomponents/L_SPICE.h +++ b/qucs/spicecomponents/L_SPICE.h @@ -32,7 +32,7 @@ class L_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/MESFET_SPICE.cpp b/qucs/spicecomponents/MESFET_SPICE.cpp index ae329ce61..1a13d6c1f 100644 --- a/qucs/spicecomponents/MESFET_SPICE.cpp +++ b/qucs/spicecomponents/MESFET_SPICE.cpp @@ -32,13 +32,13 @@ MESFET_SPICE::MESFET_SPICE() Lines.append(new qucs::Line(-30, 0,-10, 0,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line(-10,-10, 0,-10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-10, 0,-20,QPen(Qt::darkRed,3))); - Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); + Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line(-10, 10, 0, 10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 10, 0, 20,QPen(Qt::darkRed,3))); - Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); + Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); - + Ports.append(new Port( 0,-30)); Ports.append(new Port(-30, 0)); Ports.append(new Port( 0, 30)); @@ -58,7 +58,7 @@ MESFET_SPICE::MESFET_SPICE() Props.append(new Property("Z_Line 3", "", false,"+ continuation line 2")); Props.append(new Property("Z_Line 4", "", false,"+ continuation line 3")); Props.append(new Property("Z_Line 5", "", false,"+ continuation line 4")); - + Texts.append(new Text(30,12,"NMF",Qt::darkRed,10.0,0.0,-1.0)); } @@ -86,15 +86,17 @@ QString MESFET_SPICE::netlist() return QString(); } -QString MESFET_SPICE::spice_netlist(bool, bool) +QString MESFET_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString Z= Props.at(0)->Value; QString Z_Line_2= Props.at(1)->Value; QString Z_Line_3= Props.at(2)->Value; diff --git a/qucs/spicecomponents/MESFET_SPICE.h b/qucs/spicecomponents/MESFET_SPICE.h index ef6df0778..156a9c8d8 100644 --- a/qucs/spicecomponents/MESFET_SPICE.h +++ b/qucs/spicecomponents/MESFET_SPICE.h @@ -31,7 +31,7 @@ class MESFET_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // MESFET_SPICE_H diff --git a/qucs/spicecomponents/MOS_SPICE.cpp b/qucs/spicecomponents/MOS_SPICE.cpp index 60012d299..429a79ae0 100644 --- a/qucs/spicecomponents/MOS_SPICE.cpp +++ b/qucs/spicecomponents/MOS_SPICE.cpp @@ -225,15 +225,17 @@ void MOS_SPICE::createSymbol() x2 = 4; y2 = 30; } -QString MOS_SPICE::spice_netlist(bool, bool) +QString MOS_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,Props.at(0)->Value); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString M= Props.at(3)->Value; QString M_Line_2= Props.at(4)->Value; QString M_Line_3= Props.at(5)->Value; @@ -254,7 +256,7 @@ QString MOS_SPICE::cdl_netlist() { if (Ports.size() == 4) { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } return QString(); diff --git a/qucs/spicecomponents/MOS_SPICE.h b/qucs/spicecomponents/MOS_SPICE.h index 4729986f0..584e83051 100644 --- a/qucs/spicecomponents/MOS_SPICE.h +++ b/qucs/spicecomponents/MOS_SPICE.h @@ -39,7 +39,7 @@ class MOS_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/NJF_SPICE.cpp b/qucs/spicecomponents/NJF_SPICE.cpp index adbd8e7ec..bc4667895 100644 --- a/qucs/spicecomponents/NJF_SPICE.cpp +++ b/qucs/spicecomponents/NJF_SPICE.cpp @@ -29,23 +29,23 @@ NJF_SPICE::NJF_SPICE() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-10,-15,-10, 15,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-30, 0,-20, 0,QPen(Qt::darkBlue,3))); - Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); - + Lines.append(new qucs::Line(-20, 0,-10, 0,QPen(Qt::darkRed,3))); + Lines.append(new qucs::Line(-10,-10, 0,-10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-10, 0,-20,QPen(Qt::darkRed,3))); - Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); + Lines.append(new qucs::Line(-10, 10, 0, 10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 10, 0, 20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(-16, -5,-11, 0,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line(-16, 5,-11, 0,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); - + //Texts.append(new Text(30,12,"NJF",Qt::darkRed,10.0,0.0,-1.0)); Ports.append(new Port( 0,-30)); //D @@ -93,15 +93,17 @@ QString NJF_SPICE::netlist() return QString(); } -QString NJF_SPICE::spice_netlist(bool, bool) +QString NJF_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString J= Props.at(0)->Value; QString J_Line_2= Props.at(1)->Value; QString J_Line_3= Props.at(2)->Value; @@ -120,5 +122,5 @@ QString NJF_SPICE::spice_netlist(bool, bool) QString NJF_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/NJF_SPICE.h b/qucs/spicecomponents/NJF_SPICE.h index a69fabdfc..0a0089496 100644 --- a/qucs/spicecomponents/NJF_SPICE.h +++ b/qucs/spicecomponents/NJF_SPICE.h @@ -32,7 +32,7 @@ class NJF_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/NMOS_SPICE.cpp b/qucs/spicecomponents/NMOS_SPICE.cpp index 23c9b6baf..5b454e14d 100644 --- a/qucs/spicecomponents/NMOS_SPICE.cpp +++ b/qucs/spicecomponents/NMOS_SPICE.cpp @@ -102,8 +102,10 @@ QString NMOS_SPICE::netlist() return QString(); } -QString NMOS_SPICE::spice_netlist(bool, bool) +QString NMOS_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -129,5 +131,5 @@ QString NMOS_SPICE::spice_netlist(bool, bool) QString NMOS_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/NMOS_SPICE.h b/qucs/spicecomponents/NMOS_SPICE.h index e5ab93f09..debf3cf98 100644 --- a/qucs/spicecomponents/NMOS_SPICE.h +++ b/qucs/spicecomponents/NMOS_SPICE.h @@ -32,7 +32,7 @@ class NMOS_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/NPN_SPICE.cpp b/qucs/spicecomponents/NPN_SPICE.cpp index 863957378..da10f3cb0 100644 --- a/qucs/spicecomponents/NPN_SPICE.cpp +++ b/qucs/spicecomponents/NPN_SPICE.cpp @@ -94,8 +94,10 @@ QString NPN_SPICE::netlist() return QString(); } -QString NPN_SPICE::spice_netlist(bool, bool) +QString NPN_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -121,5 +123,5 @@ QString NPN_SPICE::spice_netlist(bool, bool) QString NPN_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/NPN_SPICE.h b/qucs/spicecomponents/NPN_SPICE.h index ad1245ff6..88d1d5094 100644 --- a/qucs/spicecomponents/NPN_SPICE.h +++ b/qucs/spicecomponents/NPN_SPICE.h @@ -32,7 +32,7 @@ class NPN_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/PJF_SPICE.cpp b/qucs/spicecomponents/PJF_SPICE.cpp index 376b0a959..bf4fd9d5d 100644 --- a/qucs/spicecomponents/PJF_SPICE.cpp +++ b/qucs/spicecomponents/PJF_SPICE.cpp @@ -93,8 +93,10 @@ QString PJF_SPICE::netlist() return QString(); } -QString PJF_SPICE::spice_netlist(bool, bool) +QString PJF_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -120,5 +122,5 @@ QString PJF_SPICE::spice_netlist(bool, bool) QString PJF_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/PJF_SPICE.h b/qucs/spicecomponents/PJF_SPICE.h index f8f926c45..ba43bd361 100644 --- a/qucs/spicecomponents/PJF_SPICE.h +++ b/qucs/spicecomponents/PJF_SPICE.h @@ -32,7 +32,7 @@ class PJF_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/PMF_MESFET_SPICE.cpp b/qucs/spicecomponents/PMF_MESFET_SPICE.cpp index 99b7ba490..4106e3640 100644 --- a/qucs/spicecomponents/PMF_MESFET_SPICE.cpp +++ b/qucs/spicecomponents/PMF_MESFET_SPICE.cpp @@ -33,14 +33,14 @@ PMF_MESFET_SPICE::PMF_MESFET_SPICE() Lines.append(new qucs::Line(-10,-10, 0,-10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-10, 0,-20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0,-20, 0,-30,QPen(Qt::darkBlue,3))); - + Lines.append(new qucs::Line(-10, 10, 0, 10,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 10, 0, 20,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( 0, 20, 0, 30,QPen(Qt::darkBlue,3))); Lines.append(new qucs::Line( -4, 24, 4, 20,QPen(Qt::darkRed,2))); Texts.append(new Text(30,12,"PMF",Qt::darkRed,10.0,0.0,-1.0)); - + Ports.append(new Port( 0,-30)); Ports.append(new Port(-30, 0)); Ports.append(new Port( 0, 30)); @@ -67,7 +67,7 @@ PMF_MESFET_SPICE::~PMF_MESFET_SPICE() { } -Component* PMF_MESFET_SPICE::newOne() +Component* PMF_MESFET_SPICE::newOne() { return new PMF_MESFET_SPICE(); } @@ -86,15 +86,17 @@ QString PMF_MESFET_SPICE::netlist() return QString(); } -QString PMF_MESFET_SPICE::spice_netlist(bool, bool) +QString PMF_MESFET_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString Z= Props.at(0)->Value; QString Z_Line_2= Props.at(1)->Value; QString Z_Line_3= Props.at(2)->Value; diff --git a/qucs/spicecomponents/PMF_MESFET_SPICE.h b/qucs/spicecomponents/PMF_MESFET_SPICE.h index b6141b074..3bd455e67 100644 --- a/qucs/spicecomponents/PMF_MESFET_SPICE.h +++ b/qucs/spicecomponents/PMF_MESFET_SPICE.h @@ -31,7 +31,7 @@ class PMF_MESFET_SPICE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // PMF_MESFET_SPICE_H diff --git a/qucs/spicecomponents/PMOS_SPICE.cpp b/qucs/spicecomponents/PMOS_SPICE.cpp index 4c408fb64..f568a5a20 100644 --- a/qucs/spicecomponents/PMOS_SPICE.cpp +++ b/qucs/spicecomponents/PMOS_SPICE.cpp @@ -102,8 +102,10 @@ QString PMOS_SPICE::netlist() return QString(); } -QString PMOS_SPICE::spice_netlist(bool, bool) +QString PMOS_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -129,5 +131,5 @@ QString PMOS_SPICE::spice_netlist(bool, bool) QString PMOS_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/PMOS_SPICE.h b/qucs/spicecomponents/PMOS_SPICE.h index 86de3e7b5..ada80ed03 100644 --- a/qucs/spicecomponents/PMOS_SPICE.h +++ b/qucs/spicecomponents/PMOS_SPICE.h @@ -32,7 +32,7 @@ class PMOS_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/PNP_SPICE.cpp b/qucs/spicecomponents/PNP_SPICE.cpp index d6e74e1ad..1916494e2 100644 --- a/qucs/spicecomponents/PNP_SPICE.cpp +++ b/qucs/spicecomponents/PNP_SPICE.cpp @@ -95,8 +95,10 @@ QString PNP_SPICE::netlist() return QString(); } -QString PNP_SPICE::spice_netlist(bool, bool) +QString PNP_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -122,5 +124,5 @@ QString PNP_SPICE::spice_netlist(bool, bool) QString PNP_SPICE::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/PNP_SPICE.h b/qucs/spicecomponents/PNP_SPICE.h index 351149699..50a325962 100644 --- a/qucs/spicecomponents/PNP_SPICE.h +++ b/qucs/spicecomponents/PNP_SPICE.h @@ -32,7 +32,7 @@ class PNP_SPICE : public Component { protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/R_SPICE.cpp b/qucs/spicecomponents/R_SPICE.cpp index 1bdc9fc87..ff7351c55 100644 --- a/qucs/spicecomponents/R_SPICE.cpp +++ b/qucs/spicecomponents/R_SPICE.cpp @@ -113,8 +113,10 @@ QString R_SPICE::netlist() return QString(); } -QString R_SPICE::spice_netlist(bool, bool) +QString R_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString ltr = getProperty("Letter")->Value; QString s = spicecompat::check_refdes(Name,ltr); for (Port *p1 : Ports) { @@ -143,7 +145,7 @@ QString R_SPICE::cdl_netlist() { if (Ports.size() == 2) { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } return QString(); diff --git a/qucs/spicecomponents/R_SPICE.h b/qucs/spicecomponents/R_SPICE.h index a168e0923..c196366ac 100644 --- a/qucs/spicecomponents/R_SPICE.h +++ b/qucs/spicecomponents/R_SPICE.h @@ -34,7 +34,7 @@ class R_SPICE : public MultiViewComponent { protected: void createSymbol(); QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/S4Q_I.cpp b/qucs/spicecomponents/S4Q_I.cpp index 65db28529..7d65a5382 100644 --- a/qucs/spicecomponents/S4Q_I.cpp +++ b/qucs/spicecomponents/S4Q_I.cpp @@ -76,8 +76,10 @@ Element* S4Q_I::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_I::spice_netlist(bool, bool) +QString S4Q_I::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -103,5 +105,5 @@ QString S4Q_I::spice_netlist(bool, bool) QString S4Q_I::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/S4Q_I.h b/qucs/spicecomponents/S4Q_I.h index d33a0c20c..584f72b3c 100644 --- a/qucs/spicecomponents/S4Q_I.h +++ b/qucs/spicecomponents/S4Q_I.h @@ -32,7 +32,7 @@ class S4Q_I : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/S4Q_Ieqndef.cpp b/qucs/spicecomponents/S4Q_Ieqndef.cpp index 1d2888286..8f5d7799a 100644 --- a/qucs/spicecomponents/S4Q_Ieqndef.cpp +++ b/qucs/spicecomponents/S4Q_Ieqndef.cpp @@ -4,7 +4,7 @@ begin : 13 September 2015 copyright : (C) 2015 by Vadim Kaznetsov and Mike Brinson email : ra3xdh@gmil.co and mbrin72043@yahoo.co.uk - + ***************************************************************************/ /*************************************************************************** @@ -29,14 +29,14 @@ S4Q_Ieqndef::S4Q_Ieqndef() // pins Lines.append(new qucs::Line(-30, 0,-14, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 30, 0, 14, 0,QPen(Qt::darkBlue,2))); - + // arrow Lines.append(new qucs::Line( -8, 0, 8, 0,QPen(Qt::darkRed,3, Qt::SolidLine, Qt::FlatCap))); Lines.append(new qucs::Line( -8, 0, -4, -4,QPen(Qt::darkRed,3))); Lines.append(new qucs::Line( -8, 0, -4, 4,QPen(Qt::darkRed,3))); - + Texts.append(new Text(25,-30,"Eqn",Qt::darkRed,12.0,0.0,-1.0)); - + Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -49,7 +49,7 @@ S4Q_Ieqndef::S4Q_Ieqndef() Model = "S4Q_Ieqndef"; SpiceModel = "B"; Name = "B"; - + Props.append(new Property("I", "", true,"B(I) specification.")); Props.append(new Property("Line_2", "", false,"+ continuation line 1")); Props.append(new Property("Line_3", "", false,"+ continuation line 2")); @@ -86,15 +86,17 @@ QString S4Q_Ieqndef::netlist() return QString(); } -QString S4Q_Ieqndef::spice_netlist(bool, bool) +QString S4Q_Ieqndef::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam + " "; // node names } - + QString VI = Props.at(0)-> Name; QString VI2 = Props.at(0)->Value; QString Line_2 = Props.at(1)->Value; diff --git a/qucs/spicecomponents/S4Q_Ieqndef.h b/qucs/spicecomponents/S4Q_Ieqndef.h index 9a92b1d71..97c58595b 100644 --- a/qucs/spicecomponents/S4Q_Ieqndef.h +++ b/qucs/spicecomponents/S4Q_Ieqndef.h @@ -11,7 +11,7 @@ class S4Q_Ieqndef : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/spicecomponents/S4Q_S.cpp b/qucs/spicecomponents/S4Q_S.cpp index 44050a2fc..004cda1d4 100644 --- a/qucs/spicecomponents/S4Q_S.cpp +++ b/qucs/spicecomponents/S4Q_S.cpp @@ -39,11 +39,11 @@ S4Q_S::S4Q_S() Lines.append(new qucs::Line( 5, 0, 0, 8,QPen(Qt::darkRed,3, Qt::SolidLine, Qt::FlatCap))); Lines.append(new qucs::Line(-10, -30, -10, -15,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 10, -30, 10, -15,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line(22, -20, 18, -20,QPen(Qt::red,2))); Lines.append(new qucs::Line(20, -22, 20,-18,QPen(Qt::red,2))); Lines.append(new qucs::Line(-20, -22, -20,-18,QPen(Qt::black,2))); - + Ports.append(new Port(-30, 0)); // Ps+ Ports.append(new Port( 30, 0)); // Ps- Ports.append(new Port( 10,-30)); // Pc+ @@ -93,8 +93,10 @@ Element* S4Q_S::info(QString& Name, char* &BitmapFile, bool getNewOne) // return QString(); //} -QString S4Q_S::spice_netlist(bool, bool) +QString S4Q_S::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/spicecomponents/S4Q_S.h b/qucs/spicecomponents/S4Q_S.h index 20bc3ecfd..d8a4d506a 100644 --- a/qucs/spicecomponents/S4Q_S.h +++ b/qucs/spicecomponents/S4Q_S.h @@ -32,7 +32,7 @@ class S4Q_S : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/S4Q_V.cpp b/qucs/spicecomponents/S4Q_V.cpp index 0dd7657eb..a2f2046c5 100644 --- a/qucs/spicecomponents/S4Q_V.cpp +++ b/qucs/spicecomponents/S4Q_V.cpp @@ -76,8 +76,10 @@ Element* S4Q_V::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_V::spice_netlist(bool, bool) +QString S4Q_V::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -103,5 +105,5 @@ QString S4Q_V::spice_netlist(bool, bool) QString S4Q_V::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/S4Q_V.h b/qucs/spicecomponents/S4Q_V.h index f1acac012..7fd1e5373 100644 --- a/qucs/spicecomponents/S4Q_V.h +++ b/qucs/spicecomponents/S4Q_V.h @@ -32,7 +32,7 @@ class S4Q_V : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/S4Q_W.cpp b/qucs/spicecomponents/S4Q_W.cpp index c170babff..db6fa4f3f 100644 --- a/qucs/spicecomponents/S4Q_W.cpp +++ b/qucs/spicecomponents/S4Q_W.cpp @@ -81,8 +81,10 @@ Element* S4Q_W::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString S4Q_W::spice_netlist(bool, bool) +QString S4Q_W::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/spicecomponents/S4Q_W.h b/qucs/spicecomponents/S4Q_W.h index 409e07332..7115b0fc3 100644 --- a/qucs/spicecomponents/S4Q_W.h +++ b/qucs/spicecomponents/S4Q_W.h @@ -4,7 +4,7 @@ begin : Thu May 21 2015 copyright : (C) 2015 by Vadim Kuznetsov email : ra3xdh@gmail.com - + SPICE Version : Wednesday Sept 16 2015 copyright : (C) 2015 Mike Brinson email : mbrin72043@yahoo.co.uk @@ -32,7 +32,7 @@ class S4Q_W : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/SDTF.cpp b/qucs/spicecomponents/SDTF.cpp index 7b14c1a4f..fdbcd998c 100644 --- a/qucs/spicecomponents/SDTF.cpp +++ b/qucs/spicecomponents/SDTF.cpp @@ -29,15 +29,15 @@ SDTF::SDTF() Lines.append(new qucs::Line(-80, 0,-70, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 80, 0, 70, 0,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line( -70, 35, -70, -35,QPen(Qt::blue,3))); Lines.append(new qucs::Line( -70, -35, 70, -35,QPen(Qt::blue,3))); - Lines.append(new qucs::Line( 70, -35, 70, 35,QPen(Qt::blue,3))); - Lines.append(new qucs::Line( 70, 35, -70, 35,QPen(Qt::blue,3))); - + Lines.append(new qucs::Line( 70, -35, 70, 35,QPen(Qt::blue,3))); + Lines.append(new qucs::Line( 70, 35, -70, 35,QPen(Qt::blue,3))); + Texts.append(new Text( -60, -25," S Domain ",Qt::blue,12.0,1.0,0)); Texts.append(new Text( -60, 5,"Transfer Function",Qt::blue,12.0,1.0,0)); - + Ports.append(new Port( -80, 0)); // PIn Ports.append(new Port( 80, 0)); // POut @@ -49,14 +49,14 @@ SDTF::SDTF() Model = "SDTF"; SpiceModel = "A"; Name = "SDTF"; - + Props.append(new Property("A", " A_XSDFTmod", true,"Parameter list and\n .model spec.")); Props.append(new Property("A_Line 2", ".MODEL A_XSDFTmod s_xfer ( gain=1.0", false,".model line")); Props.append(new Property("A_Line 3", "+ num_coeff=[1.0]", false,".model line")); Props.append(new Property("A_Line 4", "+ den_coeff=[1.0 1.09775 1.0]", false,".model line")); Props.append(new Property("A_Line 5", "+ int_ic=[0 0 0]", false,".model line")); - Props.append(new Property("A_Line 6", "+ denormalized_freq=1500.0 )", false,".model line")); - Props.append(new Property("A_Line 7", "", false,".model line")); + Props.append(new Property("A_Line 6", "+ denormalized_freq=1500.0 )", false,".model line")); + Props.append(new Property("A_Line 7", "", false,".model line")); } @@ -72,7 +72,7 @@ Component* SDTF::newOne() Element* SDTF::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("SDTF"); - BitmapFile = (char *) "SDTF"; + BitmapFile = (char *) "SDTF"; if(getNewOne) return new SDTF(); return 0; @@ -83,24 +83,25 @@ QString SDTF::netlist() return QString(); } -QString SDTF::spice_netlist(bool, bool) +QString SDTF::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString P1 = Ports.at(0)->Connection->Name; if (P1=="gnd") P1 = "0"; QString P2 = Ports.at(1)->Connection->Name; if (P2=="gnd") P2 = "0"; s += " " + P1 + " " + P2 + " "; - + QString A = Props.at(0)->Value; QString A_Line_2 = Props.at(1)->Value; - QString A_Line_3 = Props.at(2)->Value; - QString A_Line_4 = Props.at(3)->Value; + QString A_Line_3 = Props.at(2)->Value; + QString A_Line_4 = Props.at(3)->Value; QString A_Line_5 = Props.at(4)->Value; QString A_Line_6 = Props.at(5)->Value; - QString A_Line_7 = Props.at(6)->Value; - + QString A_Line_7 = Props.at(6)->Value; + if( A.length() > 0) s += QStringLiteral("%1").arg(A); if( A_Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(A_Line_2); if( A_Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(A_Line_3); diff --git a/qucs/spicecomponents/SDTF.h b/qucs/spicecomponents/SDTF.h index ccdf98df0..5f5c086a7 100644 --- a/qucs/spicecomponents/SDTF.h +++ b/qucs/spicecomponents/SDTF.h @@ -31,7 +31,7 @@ class SDTF: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // SDTF_H diff --git a/qucs/spicecomponents/UDRCTL_SPICE.cpp b/qucs/spicecomponents/UDRCTL_SPICE.cpp index 86dedbbbe..0099ec6ad 100644 --- a/qucs/spicecomponents/UDRCTL_SPICE.cpp +++ b/qucs/spicecomponents/UDRCTL_SPICE.cpp @@ -28,12 +28,11 @@ UDRCTL_SPICE::UDRCTL_SPICE() Description = QObject::tr("SPICE U(URC):\nMultiple line ngspice or Xyce U specifications allowed using \"+\" continuation lines.\nLeave continuation lines blank when NOT in use."); Simulator = spicecompat::simSpice; - - Lines.append(new qucs::Line( -60, 0, -45, 0,QPen(Qt::darkBlue,2))); + Lines.append(new qucs::Line( -60, 0, -45, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( -45, 20, 45, 20,QPen(Qt::blue,4))); - Lines.append(new qucs::Line( 60, 0, 45, 0,QPen(Qt::darkBlue,2))); - Lines.append(new qucs::Line( 0, 20, 0, 40,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line( 60, 0, 45, 0,QPen(Qt::darkBlue,2))); + Lines.append(new qucs::Line( 0, 20, 0, 40,QPen(Qt::darkBlue,2))); + Lines.append(new qucs::Line(-45, 0, -37, 0,QPen(Qt::blue,4))); Lines.append(new qucs::Line(-37, 0, -30, -10,QPen(Qt::blue,4))); Lines.append(new qucs::Line(-30, -10, -15, 10,QPen(Qt::blue,4))); @@ -43,9 +42,6 @@ UDRCTL_SPICE::UDRCTL_SPICE() Lines.append(new qucs::Line( 30, -10, 37, 0,QPen(Qt::blue,4))); Lines.append(new qucs::Line( 37, 0, 45, 0,QPen(Qt::blue,4))); - - - Ports.append(new Port( -60, 0)); // P1 Ports.append(new Port( 60, 0)); // P2 Ports.append(new Port( 0, 40)); // P3 @@ -92,15 +88,17 @@ QString UDRCTL_SPICE::netlist() return QString(); } -QString UDRCTL_SPICE::spice_netlist(bool, bool) +QString UDRCTL_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } - + QString U= Props.at(0)->Value; QString U_Line_2= Props.at(1)->Value; QString U_Line_3= Props.at(2)->Value; diff --git a/qucs/spicecomponents/UDRCTL_SPICE.h b/qucs/spicecomponents/UDRCTL_SPICE.h index 98f4fd894..e02e7efce 100644 --- a/qucs/spicecomponents/UDRCTL_SPICE.h +++ b/qucs/spicecomponents/UDRCTL_SPICE.h @@ -5,7 +5,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * */ #ifndef UDRCTL_SPICE_H @@ -14,15 +14,15 @@ #include "components/component.h" class UDRCTL_SPICE : public Component { - public: +public: UDRCTL_SPICE(); ~UDRCTL_SPICE(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); - protected: -// void createSymbol(); + +protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif /* UDRCTL_SPICE_H */ diff --git a/qucs/spicecomponents/XAPWL.cpp b/qucs/spicecomponents/XAPWL.cpp index 7c846b52d..3c0e48257 100644 --- a/qucs/spicecomponents/XAPWL.cpp +++ b/qucs/spicecomponents/XAPWL.cpp @@ -26,18 +26,17 @@ XAPWL::XAPWL() Description = QObject::tr("PWL controlled voltage source:\nSeven line XSPICE specification. "); Simulator = spicecompat::simSpice; - Lines.append(new qucs::Line(-80, 0,-70, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 80, 0, 70, 0,QPen(Qt::darkBlue,2))); - + Lines.append(new qucs::Line( -70, 35, -70, -35,QPen(Qt::blue,3))); Lines.append(new qucs::Line( -70, -35, 70, -35,QPen(Qt::blue,3))); - Lines.append(new qucs::Line( 70, -35, 70, 35,QPen(Qt::blue,3))); - Lines.append(new qucs::Line( 70, 35, -70, 35,QPen(Qt::blue,3))); - + Lines.append(new qucs::Line( 70, -35, 70, 35,QPen(Qt::blue,3))); + Lines.append(new qucs::Line( 70, 35, -70, 35,QPen(Qt::blue,3))); + Texts.append(new Text( -60, -25," PWL controlled ",Qt::blue,12.0,1.0,0)); Texts.append(new Text( -60, 5," voltage source ",Qt::blue,12.0,1.0,0)); - + Ports.append(new Port( -80, 0)); // PIn Ports.append(new Port( 80, 0)); // POut @@ -49,15 +48,14 @@ XAPWL::XAPWL() Model = "XAPWL"; SpiceModel = "A"; Name = "XAPWL"; - + Props.append(new Property("A", " A_PWLmod", true,"Parameter list and\n .model spec.")); Props.append(new Property("A_Line 2", ".MODEL A_PWLmod pwl ( ", false,".model line")); Props.append(new Property("A_Line 3", "+ x_array=[-2.0 -1.0 2.0 4.0 5.0]", false,".model line")); Props.append(new Property("A_Line 4", "+ y_array=[-2.0 -0.2 0.1 2.0 10.0]", false,".model line")); Props.append(new Property("A_Line 5", "+ input_domain=0.05", false,".model line")); - Props.append(new Property("A_Line 6", "+ fraction=TRUE )", false,".model line")); - Props.append(new Property("A_Line 7", "", false,".model line")); - + Props.append(new Property("A_Line 6", "+ fraction=TRUE )", false,".model line")); + Props.append(new Property("A_Line 7", "", false,".model line")); } XAPWL::~XAPWL() @@ -72,7 +70,7 @@ Component* XAPWL::newOne() Element* XAPWL::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("XAPWL"); - BitmapFile = (char *) "XAPWL"; + BitmapFile = (char *) "XAPWL"; if(getNewOne) return new XAPWL(); return 0; @@ -83,24 +81,25 @@ QString XAPWL::netlist() return QString(); } -QString XAPWL::spice_netlist(bool, bool) +QString XAPWL::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString P1 = Ports.at(0)->Connection->Name; if (P1=="gnd") P1 = "0"; QString P2 = Ports.at(1)->Connection->Name; if (P2=="gnd") P2 = "0"; s += " " + P1 + " " + P2 + " "; - + QString A = Props.at(0)->Value; QString A_Line_2 = Props.at(1)->Value; - QString A_Line_3 = Props.at(2)->Value; - QString A_Line_4 = Props.at(3)->Value; + QString A_Line_3 = Props.at(2)->Value; + QString A_Line_4 = Props.at(3)->Value; QString A_Line_5 = Props.at(4)->Value; QString A_Line_6 = Props.at(5)->Value; - QString A_Line_7 = Props.at(6)->Value; - + QString A_Line_7 = Props.at(6)->Value; + if( A.length() > 0) s += QStringLiteral("%1").arg(A); if( A_Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(A_Line_2); if( A_Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(A_Line_3); diff --git a/qucs/spicecomponents/XAPWL.h b/qucs/spicecomponents/XAPWL.h index abdaa12a2..03675b4f8 100644 --- a/qucs/spicecomponents/XAPWL.h +++ b/qucs/spicecomponents/XAPWL.h @@ -31,7 +31,7 @@ class XAPWL: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // XAPWL_H diff --git a/qucs/spicecomponents/core.cpp b/qucs/spicecomponents/core.cpp index d68f07adb..099fe54cc 100644 --- a/qucs/spicecomponents/core.cpp +++ b/qucs/spicecomponents/core.cpp @@ -3,7 +3,7 @@ -------------------------------------- begin : Sun 22 Nov 2015 copyright : (C) by Mike Brinson (mbrin72043@yahoo.co.uk), - : Vadim Kuznetsov (ra3xdh@gmail.com) + : Vadim Kuznetsov (ra3xdh@gmail.com) ***************************************************************************/ @@ -27,23 +27,22 @@ core::core() Simulator = spicecompat::simSpice; Lines.append(new qucs::Line(-40, 0, -30, 0,QPen(Qt::darkBlue,2))); // L1 - Lines.append(new qucs::Line(-30, -15, 30, -15,QPen(Qt::blue,3))); // L2 - Lines.append(new qucs::Line( 30, -15, 30, 15,QPen(Qt::blue,3))); // L3 - Lines.append(new qucs::Line( 30, 15, -30, 15,QPen(Qt::blue,3))); // L4 - Lines.append(new qucs::Line(-30, 15, -30, -15,QPen(Qt::blue,3))); // L5 - + Lines.append(new qucs::Line(-30, -15, 30, -15,QPen(Qt::blue,3))); // L2 + Lines.append(new qucs::Line( 30, -15, 30, 15,QPen(Qt::blue,3))); // L3 + Lines.append(new qucs::Line( 30, 15, -30, 15,QPen(Qt::blue,3))); // L4 + Lines.append(new qucs::Line(-30, 15, -30, -15,QPen(Qt::blue,3))); // L5 Lines.append(new qucs::Line(-25, -5, 25, -5,QPen(Qt::black,3))); // L7 Lines.append(new qucs::Line(-25, 0, 25, 0,QPen(Qt::black,3))); // L8 Lines.append(new qucs::Line(-25, 5, 25, 5,QPen(Qt::black,3))); // L9 - - Lines.append(new qucs::Line(40, 0, 30, 0,QPen(Qt::darkBlue,2))); // L16 - - + + Lines.append(new qucs::Line(40, 0, 30, 0,QPen(Qt::darkBlue,2))); // L16 + + Lines.append(new qucs::Line( -40, -30, -40, -20,QPen(Qt::red,3))); // + Lines.append(new qucs::Line( -45, -25, -35, -25,QPen(Qt::red,3))); - Lines.append(new qucs::Line( 45, -25, 35, -25,QPen(Qt::black,3))); // - - + Lines.append(new qucs::Line( 45, -25, 35, -25,QPen(Qt::black,3))); // - + Ports.append(new Port( -40, 0)); // Pin Ports.append(new Port( 40, 0)); // Pout @@ -55,7 +54,7 @@ core::core() Model = "core"; SpiceModel = "A"; Name = "CORE"; - + Props.append(new Property("A ", "", true,"Parameter list and\n .model spec.")); Props.append(new Property("A_Line 2", "", false,".model line")); Props.append(new Property("A_Line 3", "", false,".model line")); @@ -79,7 +78,7 @@ Component* core::newOne() Element* core::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("core"); - BitmapFile = (char *) "core"; + BitmapFile = (char *) "core"; if(getNewOne) return new core(); return 0; @@ -90,23 +89,24 @@ QString core::netlist() return QString(); } -QString core::spice_netlist(bool, bool) +QString core::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QString P1 = Ports.at(0)->Connection->Name; QString P2 = Ports.at(1)->Connection->Name; - - s += " " + P1 + " " + P2 + " "; - + s += " " + P1 + " " + P2 + " "; + QString A= Props.at(0)->Value; QString A_Line_2= Props.at(1)->Value; - QString A_Line_3= Props.at(2)->Value; + QString A_Line_3= Props.at(2)->Value; QString A_Line_4= Props.at(3)->Value; - QString A_Line_5= Props.at(4)->Value; + QString A_Line_5= Props.at(4)->Value; QString A_Line_6= Props.at(5)->Value; - QString A_Line_7= Props.at(6)->Value; + QString A_Line_7= Props.at(6)->Value; + if( A.length() > 0) s += QStringLiteral("%1\n").arg(A); if( A_Line_2.length() > 0 ) s += QStringLiteral("%1\n").arg(A_Line_2); if( A_Line_3.length() > 0 ) s += QStringLiteral("%1\n").arg(A_Line_3); @@ -114,6 +114,6 @@ QString core::spice_netlist(bool, bool) if( A_Line_5.length() > 0 ) s += QStringLiteral("%1\n").arg(A_Line_5); if( A_Line_6.length() > 0 ) s += QStringLiteral("%1\n").arg(A_Line_6); if( A_Line_7.length() > 0 ) s += QStringLiteral("%1\n").arg(A_Line_7); - + return s; } diff --git a/qucs/spicecomponents/core.h b/qucs/spicecomponents/core.h index eff6996d1..9a685cde2 100644 --- a/qucs/spicecomponents/core.h +++ b/qucs/spicecomponents/core.h @@ -31,7 +31,7 @@ class core: public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // core_H diff --git a/qucs/spicecomponents/eNL.cpp b/qucs/spicecomponents/eNL.cpp index 949341b16..d6066b048 100644 --- a/qucs/spicecomponents/eNL.cpp +++ b/qucs/spicecomponents/eNL.cpp @@ -36,7 +36,7 @@ eNL::eNL() Lines.append(new qucs::Line( 18, -5, 18, -11,QPen(Qt::red,2))); Lines.append(new qucs::Line( 21, -8, 15, -8,QPen(Qt::red,2))); // minus sign - Lines.append(new qucs::Line(-18, -5,-18, -11,QPen(Qt::black,2))); + Lines.append(new qucs::Line(-18, -5,-18, -11,QPen(Qt::black,2))); Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -55,7 +55,7 @@ eNL::eNL() Props.append(new Property("Line_3", "", false,"+ continuation line 2")); Props.append(new Property("Line_4", "", false,"+ continuation line 3")); Props.append(new Property("Line_5", "", false,"+ continuation line 4")); - + rotate(); // fix historical flaw } @@ -71,7 +71,7 @@ Component* eNL::newOne() Element* eNL::info(QString& Name, char* &BitmapFile, bool getNewOne) { Name = QObject::tr("E"); - BitmapFile = (char *) "eNL"; + BitmapFile = (char *) "eNL"; if(getNewOne) return new eNL(); return 0; @@ -82,26 +82,30 @@ QString eNL::netlist() return QString(); } -QString eNL::spice_netlist(bool, bool) +QString eNL::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } + QString E = Props.at(0)->Value; - QString Line_2 = Props.at(1)->Value; + QString Line_2 = Props.at(1)->Value; QString Line_3 = Props.at(2)->Value; QString Line_4 = Props.at(3)->Value; QString Line_5 = Props.at(4)->Value; - if( E.length() > 0) s += QStringLiteral("%1").arg(E); if( Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_2); if( Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_3); if( Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_4); if( Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_5); + s += "\n"; + return s; } diff --git a/qucs/spicecomponents/eNL.h b/qucs/spicecomponents/eNL.h index b805c4149..3b7598848 100644 --- a/qucs/spicecomponents/eNL.h +++ b/qucs/spicecomponents/eNL.h @@ -28,7 +28,7 @@ class eNL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // ENL_H diff --git a/qucs/spicecomponents/gNL.cpp b/qucs/spicecomponents/gNL.cpp index e84f7aacb..cb49ed143 100644 --- a/qucs/spicecomponents/gNL.cpp +++ b/qucs/spicecomponents/gNL.cpp @@ -1,9 +1,9 @@ /*************************************************************************** gNL.cpp - description -------------------------------------- - begin : Tue. Mar 31 2015 - copyright : (C) by Mike Brinson (mbrin72043@yahoo.co.uk), - Vadim Kuznetsov (ra3xdh@gmail.com) + begin : Tue. Mar 31 2015 + copyright : (C) by Mike Brinson (mbrin72043@yahoo.co.uk), + : Vadim Kuznetsov (ra3xdh@gmail.com) ***************************************************************************/ @@ -36,7 +36,7 @@ gNL::gNL() Lines.append(new qucs::Line( -7, 0, 6, 0,QPen(Qt::blue,3, Qt::SolidLine, Qt::FlatCap))); Polylines.append(new qucs::Polyline( std::vector{{0, -4},{6, 0}, {0, 4}}, QPen(Qt::blue, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin))); - + Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -54,7 +54,7 @@ gNL::gNL() Props.append(new Property("Line_3", "", false,"+ continuation line 2")); Props.append(new Property("Line_4", "", false,"+ continuation line 3")); Props.append(new Property("Line_5", "", false,"+ continuation line 4")); - + rotate(); // fix historical flaw } @@ -81,27 +81,30 @@ QString gNL::netlist() return QString(); } -QString gNL::spice_netlist(bool, bool) +QString gNL::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam+" "; // node names } + QString G= Props.at(0)->Value; - QString Line_2 = Props.at(1)->Value; + QString Line_2 = Props.at(1)->Value; QString Line_3 = Props.at(2)->Value; QString Line_4 = Props.at(3)->Value; QString Line_5 = Props.at(4)->Value; - - + if( G.length() > 0 ) s += QStringLiteral("%1").arg(G); if( Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_2); if( Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_3); if( Line_4.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_4); if( Line_5.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_5); + s += "\n"; - return s; + return s; } diff --git a/qucs/spicecomponents/gNL.h b/qucs/spicecomponents/gNL.h index 56c2118a7..805a4709e 100644 --- a/qucs/spicecomponents/gNL.h +++ b/qucs/spicecomponents/gNL.h @@ -3,19 +3,19 @@ -------------------------------------- begin : Tue Mar 31 2015 copyright : (C) by Mike Brinson (mbrin72043@yahoo.co.uk), - Vadim Kuznetsov (ra3xdh@gmail.com) + Vadim Kuznetsov (ra3xdh@gmail.com) ***************************************************************************/ /*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * ***************************************************************************/ - #ifndef GNL_H +#ifndef GNL_H #define GNL_H #include "components/component.h" @@ -28,7 +28,7 @@ class gNL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // GNL_H diff --git a/qucs/spicecomponents/iAmpMod.cpp b/qucs/spicecomponents/iAmpMod.cpp index 07d34049b..7672fba5c 100644 --- a/qucs/spicecomponents/iAmpMod.cpp +++ b/qucs/spicecomponents/iAmpMod.cpp @@ -30,16 +30,15 @@ iAmpMod::iAmpMod() // normal current source symbol Ellipses.append(new qucs::Ellips(-12,-12, 24, 24, QPen(Qt::blue,3))); - Texts.append(new Text(26, 6,"AM",Qt::blue,12.0,0.0,-1.0)); + Texts.append(new Text(26, 6,"AM",Qt::blue,12.0,0.0,-1.0)); // pins Lines.append(new qucs::Line(-30, 0,-12, 0,QPen(Qt::darkBlue,2))); Lines.append(new qucs::Line( 30, 0, 12, 0,QPen(Qt::darkBlue,2))); - // arrow + // arrow Lines.append(new qucs::Line( -6, 0, 7, 0,QPen(Qt::blue,3, Qt::SolidLine, Qt::FlatCap))); Polylines.append(new qucs::Polyline( std::vector{{0, -4},{-6, 0}, {0, 4}}, QPen(Qt::blue, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin))); - Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -89,8 +88,10 @@ QString iAmpMod::netlist() return QString(); } -QString iAmpMod::spice_netlist(bool, bool) +QString iAmpMod::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -98,12 +99,11 @@ QString iAmpMod::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString Va= spicecompat::normalize_value(Props.at(0)->Value); - QString Vo= spicecompat::normalize_value(Props.at(1)->Value); - QString Mf= spicecompat::normalize_value(Props.at(2)->Value); - QString Fc = spicecompat::normalize_value(Props.at(3)->Value); - QString Td = spicecompat::normalize_value(Props.at(4)->Value); - + QString Va = spicecompat::normalize_value(Props.at(0)->Value); + QString Vo = spicecompat::normalize_value(Props.at(1)->Value); + QString Mf = spicecompat::normalize_value(Props.at(2)->Value); + QString Fc = spicecompat::normalize_value(Props.at(3)->Value); + QString Td = spicecompat::normalize_value(Props.at(4)->Value); s += QStringLiteral(" DC 0 AM(%1 %2 %3 %4 %5 ) AC 0\n").arg(Va).arg(Vo).arg(Mf).arg(Fc).arg(Td); return s; diff --git a/qucs/spicecomponents/iAmpMod.h b/qucs/spicecomponents/iAmpMod.h index 4f0ff819b..34fcde132 100644 --- a/qucs/spicecomponents/iAmpMod.h +++ b/qucs/spicecomponents/iAmpMod.h @@ -31,7 +31,7 @@ class iAmpMod : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // IAMPMOD_H diff --git a/qucs/spicecomponents/iPWL.cpp b/qucs/spicecomponents/iPWL.cpp index 6c58b3926..d67f0b54a 100644 --- a/qucs/spicecomponents/iPWL.cpp +++ b/qucs/spicecomponents/iPWL.cpp @@ -38,7 +38,6 @@ iPWL::iPWL() Lines.append(new qucs::Line( -7, 0, 6, 0,QPen(Qt::darkRed,3, Qt::SolidLine, Qt::FlatCap))); Polylines.append(new qucs::Polyline( std::vector{{0, -4},{6, 0}, {0, 4}}, QPen(Qt::darkRed, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin))); - Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -62,8 +61,7 @@ iPWL::iPWL() Props.append(new Property("Line_8", "", false,"+ continuation line 7")); Props.append(new Property("Line_9", "", false,"+ continuation line 8")); Props.append(new Property("Line_10", "", false,"+ continuation line 9")); - - + rotate(); // fix historical flaw } @@ -90,8 +88,10 @@ QString iPWL::netlist() return QString(); } -QString iPWL::spice_netlist(bool, bool) +QString iPWL::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); s += " " + spicecompat::normalize_node_name(Ports.at(1)->Connection->Name); diff --git a/qucs/spicecomponents/iPWL.h b/qucs/spicecomponents/iPWL.h index 3e596dc76..37a3c20f4 100644 --- a/qucs/spicecomponents/iPWL.h +++ b/qucs/spicecomponents/iPWL.h @@ -31,7 +31,7 @@ class iPWL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // IPWL_H diff --git a/qucs/spicecomponents/iTRNOISE.cpp b/qucs/spicecomponents/iTRNOISE.cpp index ea4b27224..1c01cb6df 100644 --- a/qucs/spicecomponents/iTRNOISE.cpp +++ b/qucs/spicecomponents/iTRNOISE.cpp @@ -44,7 +44,6 @@ iTRNOISE::iTRNOISE() Polylines.append(new qucs::Polyline( std::vector{{0, -4},{6, 0}, {0, 4}}, QPen(Qt::blue, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin))); - Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -98,8 +97,10 @@ QString iTRNOISE::netlist() return QString(); } -QString iTRNOISE::spice_netlist(bool, bool) +QString iTRNOISE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -107,14 +108,13 @@ QString iTRNOISE::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString Na= spicecompat::normalize_value(Props.at(0)->Value); - QString Nt= spicecompat::normalize_value(Props.at(1)->Value); - QString Nalpha= spicecompat::normalize_value(Props.at(2)->Value); - QString Namp = spicecompat::normalize_value(Props.at(3)->Value); - QString Rtsam = spicecompat::normalize_value(Props.at(4)->Value); - QString Rtscapt = spicecompat::normalize_value(Props.at(4)->Value); - QString Rtsemt = spicecompat::normalize_value(Props.at(4)->Value); - + QString Na= spicecompat::normalize_value(Props.at(0)->Value); + QString Nt= spicecompat::normalize_value(Props.at(1)->Value); + QString Nalpha= spicecompat::normalize_value(Props.at(2)->Value); + QString Namp = spicecompat::normalize_value(Props.at(3)->Value); + QString Rtsam = spicecompat::normalize_value(Props.at(4)->Value); + QString Rtscapt = spicecompat::normalize_value(Props.at(4)->Value); + QString Rtsemt = spicecompat::normalize_value(Props.at(4)->Value); s += QStringLiteral(" DC 0 AC 0 TRNOISE(%1 %2 %3 %4 %5 %6 %7) \n").arg(Na).arg(Nt).arg(Nalpha).arg(Namp). arg(Rtsam).arg(Rtscapt).arg(Rtsemt); diff --git a/qucs/spicecomponents/iTRNOISE.h b/qucs/spicecomponents/iTRNOISE.h index 563698a2f..2a25dff91 100644 --- a/qucs/spicecomponents/iTRNOISE.h +++ b/qucs/spicecomponents/iTRNOISE.h @@ -31,7 +31,7 @@ class iTRNOISE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // ITRNOISE_H diff --git a/qucs/spicecomponents/isffm.cpp b/qucs/spicecomponents/isffm.cpp index 5ac3f2742..d636aabff 100644 --- a/qucs/spicecomponents/isffm.cpp +++ b/qucs/spicecomponents/isffm.cpp @@ -29,7 +29,7 @@ iSffm::iSffm() Simulator = spicecompat::simSpice; // normal current source symbol - + Ellipses.append(new qucs::Ellips(-12,-12, 24, 24,QPen(Qt::darkRed,3))); Texts.append(new Text(26, 6,"SFFM",Qt::darkRed,12.0,0.0,-1.0)); // pins @@ -38,8 +38,10 @@ iSffm::iSffm() // arrow Lines.append(new qucs::Line( -6, 0, 7, 0,QPen(Qt::darkRed,3, Qt::SolidLine, Qt::FlatCap))); Polylines.append(new qucs::Polyline( - - std::vector{{0, -4},{-6, 0}, {0, 4}}, QPen(Qt::darkRed, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin))); + std::vector{{0, -4},{-6, 0}, {0, 4}}, + QPen(Qt::darkRed, 3, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin) + ) + ); Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -89,8 +91,10 @@ QString iSffm::netlist() return QString(); } -QString iSffm::spice_netlist(bool, bool) +QString iSffm::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -98,12 +102,11 @@ QString iSffm::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString I0 = spicecompat::normalize_value(Props.at(0)->Value); - QString Ia = spicecompat::normalize_value(Props.at(1)->Value); - QString Fc = spicecompat::normalize_value(Props.at(2)->Value); - QString Mdi = spicecompat::normalize_value(Props.at(3)->Value); - QString Fs = spicecompat::normalize_value(Props.at(4)->Value); - + QString I0 = spicecompat::normalize_value(Props.at(0)->Value); + QString Ia = spicecompat::normalize_value(Props.at(1)->Value); + QString Fc = spicecompat::normalize_value(Props.at(2)->Value); + QString Mdi = spicecompat::normalize_value(Props.at(3)->Value); + QString Fs = spicecompat::normalize_value(Props.at(4)->Value); s += QStringLiteral(" DC 0 SFFM(%1 %2 %3 %4 %5 ) AC 0\n").arg(I0).arg(Ia).arg(Fc).arg(Mdi).arg(Fs); return s; diff --git a/qucs/spicecomponents/isffm.h b/qucs/spicecomponents/isffm.h index 881272dbd..9de17235f 100644 --- a/qucs/spicecomponents/isffm.h +++ b/qucs/spicecomponents/isffm.h @@ -25,7 +25,7 @@ class iSffm : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // ISFFM_H diff --git a/qucs/spicecomponents/sp_customsim.cpp b/qucs/spicecomponents/sp_customsim.cpp index 8a0ea8098..1cbab0a3d 100644 --- a/qucs/spicecomponents/sp_customsim.cpp +++ b/qucs/spicecomponents/sp_customsim.cpp @@ -66,10 +66,10 @@ Element* SpiceCustomSim::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceCustomSim::spice_netlist(bool isXyce, bool) +QString SpiceCustomSim::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = ""; - if (isXyce) return s; + if (dialect == spicecompat::SPICEXyce) return s; s = Props.at(0)->Value+"\n"; return s; } diff --git a/qucs/spicecomponents/sp_customsim.h b/qucs/spicecomponents/sp_customsim.h index b0626fc89..64dcfdc09 100644 --- a/qucs/spicecomponents/sp_customsim.h +++ b/qucs/spicecomponents/sp_customsim.h @@ -29,7 +29,7 @@ class SpiceCustomSim : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_disto.cpp b/qucs/spicecomponents/sp_disto.cpp index a53878402..88f456bb5 100644 --- a/qucs/spicecomponents/sp_disto.cpp +++ b/qucs/spicecomponents/sp_disto.cpp @@ -61,10 +61,10 @@ Element* SpiceDisto::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceDisto::spice_netlist(bool isXyce, bool) +QString SpiceDisto::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { QString fstart = spicecompat::normalize_value(Props.at(1)->Value); // Start freq. QString fstop = spicecompat::normalize_value(Props.at(2)->Value); // Stop freq. QString swp = spicecompat::convert_sweep_type(Props.at(0)->Value); // Sweep mode (lin,dec,etc.) diff --git a/qucs/spicecomponents/sp_disto.h b/qucs/spicecomponents/sp_disto.h index 74cc69d59..b698aaab3 100644 --- a/qucs/spicecomponents/sp_disto.h +++ b/qucs/spicecomponents/sp_disto.h @@ -29,7 +29,7 @@ class SpiceDisto : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_fourier.cpp b/qucs/spicecomponents/sp_fourier.cpp index 31cdf21b8..e6d17cc82 100644 --- a/qucs/spicecomponents/sp_fourier.cpp +++ b/qucs/spicecomponents/sp_fourier.cpp @@ -54,12 +54,12 @@ Element* SpiceFourier::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceFourier::spice_netlist(bool isXyce, bool) +QString SpiceFourier::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; QString f0 = spicecompat::normalize_value(Props.at(2)->Value); QString out = "spice4qucs." + Name.toLower() + ".four"; - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { s = QStringLiteral("set nfreqs=%1\n").arg(Props.at(1)->Value); s += QStringLiteral("fourier %1 %2 > %3\n").arg(f0).arg(Props.at(3)->Value).arg(out); } else { diff --git a/qucs/spicecomponents/sp_fourier.h b/qucs/spicecomponents/sp_fourier.h index b06faef91..0f0572ba0 100644 --- a/qucs/spicecomponents/sp_fourier.h +++ b/qucs/spicecomponents/sp_fourier.h @@ -29,7 +29,7 @@ class SpiceFourier : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); Qt::GlobalColor color() const override { return Qt::darkRed; } }; diff --git a/qucs/spicecomponents/sp_noise.cpp b/qucs/spicecomponents/sp_noise.cpp index 888086687..bfc38dd16 100644 --- a/qucs/spicecomponents/sp_noise.cpp +++ b/qucs/spicecomponents/sp_noise.cpp @@ -64,7 +64,7 @@ Element* SpiceNoise::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceNoise::spice_netlist(bool isXyce, bool) +QString SpiceNoise::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; QString fstart = spicecompat::normalize_value(Props.at(1)->Value); // Start freq. @@ -91,7 +91,7 @@ QString SpiceNoise::spice_netlist(bool isXyce, bool) s = QStringLiteral("noise %1 %2 %3 %4 %5 %6\n").arg(Props.at(4)->Value).arg(Props.at(5)->Value) .arg(swp).arg(points).arg(fstart).arg(fstop); QString out = "spice4qucs." + Name.toLower() + ".cir.noise"; - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { s += QStringLiteral("print inoise_total onoise_total >> %1\n").arg(out); } else { s.insert(0,'.'); diff --git a/qucs/spicecomponents/sp_noise.h b/qucs/spicecomponents/sp_noise.h index d49c37880..4279323e7 100644 --- a/qucs/spicecomponents/sp_noise.h +++ b/qucs/spicecomponents/sp_noise.h @@ -29,7 +29,7 @@ class SpiceNoise : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_pz.cpp b/qucs/spicecomponents/sp_pz.cpp index 9b3159416..6108381a0 100644 --- a/qucs/spicecomponents/sp_pz.cpp +++ b/qucs/spicecomponents/sp_pz.cpp @@ -58,11 +58,11 @@ Element* SpicePZ::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpicePZ::spice_netlist(bool isXyce, bool) +QString SpicePZ::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; QString out = "spice4qucs." + Name.toLower() + ".cir.pz"; - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { s = QStringLiteral("pz %1 %2 %3 %4\n").arg(Props.at(0)->Value).arg(Props.at(1)->Value) .arg(Props.at(2)->Value).arg(Props.at(3)->Value); s += QStringLiteral("echo \"PZ analysis\" >> %1\n").arg(out); diff --git a/qucs/spicecomponents/sp_pz.h b/qucs/spicecomponents/sp_pz.h index df959460b..d2e941812 100644 --- a/qucs/spicecomponents/sp_pz.h +++ b/qucs/spicecomponents/sp_pz.h @@ -29,7 +29,7 @@ class SpicePZ : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_sens.cpp b/qucs/spicecomponents/sp_sens.cpp index c0b1ae4bb..3e7b68a9b 100644 --- a/qucs/spicecomponents/sp_sens.cpp +++ b/qucs/spicecomponents/sp_sens.cpp @@ -59,11 +59,11 @@ Element* SpiceSENS::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS::spice_netlist(bool isXyce, bool) +QString SpiceSENS::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; s.clear(); - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { QString sweepvar = Props.at(1)->Value; QString par = sweepvar; sweepvar.remove(' '); diff --git a/qucs/spicecomponents/sp_sens.h b/qucs/spicecomponents/sp_sens.h index 4823bd9b7..fd6da4521 100644 --- a/qucs/spicecomponents/sp_sens.h +++ b/qucs/spicecomponents/sp_sens.h @@ -29,7 +29,7 @@ class SpiceSENS : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_sens_ac.cpp b/qucs/spicecomponents/sp_sens_ac.cpp index 31a70a524..b70578a83 100644 --- a/qucs/spicecomponents/sp_sens_ac.cpp +++ b/qucs/spicecomponents/sp_sens_ac.cpp @@ -59,11 +59,11 @@ Element* SpiceSENS_AC::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS_AC::spice_netlist(bool isXyce, bool) +QString SpiceSENS_AC::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; s.clear(); - if (!isXyce) { + if (dialect != spicecompat::SPICEXyce) { QString fstart = spicecompat::normalize_value(Props.at(2)->Value); // Start freq. QString fstop = spicecompat::normalize_value(Props.at(3)->Value); // Stop freq. QString out = "spice4qucs." + Name.toLower() + ".sens.prn"; diff --git a/qucs/spicecomponents/sp_sens_ac.h b/qucs/spicecomponents/sp_sens_ac.h index cc144f787..144a0b836 100644 --- a/qucs/spicecomponents/sp_sens_ac.h +++ b/qucs/spicecomponents/sp_sens_ac.h @@ -29,7 +29,7 @@ class SpiceSENS_AC : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/sp_sens_tr_xyce.cpp b/qucs/spicecomponents/sp_sens_tr_xyce.cpp index b807a2d85..82f3a80b9 100644 --- a/qucs/spicecomponents/sp_sens_tr_xyce.cpp +++ b/qucs/spicecomponents/sp_sens_tr_xyce.cpp @@ -62,11 +62,11 @@ Element* SpiceSENS_TR_Xyce::info(QString& Name, char* &BitmapFile, bool getNewOn return 0; } -QString SpiceSENS_TR_Xyce::spice_netlist(bool isXyce, bool) +QString SpiceSENS_TR_Xyce::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; s.clear(); - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { QString start = spicecompat::normalize_value(Props.at(3)->Value); QString stop = spicecompat::normalize_value(Props.at(4)->Value); QString step = spicecompat::normalize_value(Props.at(5)->Value); diff --git a/qucs/spicecomponents/sp_sens_tr_xyce.h b/qucs/spicecomponents/sp_sens_tr_xyce.h index f5bf25d00..083afb0c2 100644 --- a/qucs/spicecomponents/sp_sens_tr_xyce.h +++ b/qucs/spicecomponents/sp_sens_tr_xyce.h @@ -29,7 +29,7 @@ class SpiceSENS_TR_Xyce : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; diff --git a/qucs/spicecomponents/sp_sens_xyce.cpp b/qucs/spicecomponents/sp_sens_xyce.cpp index bd3caa995..293e0db70 100644 --- a/qucs/spicecomponents/sp_sens_xyce.cpp +++ b/qucs/spicecomponents/sp_sens_xyce.cpp @@ -60,11 +60,11 @@ Element* SpiceSENS_Xyce::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceSENS_Xyce::spice_netlist(bool isXyce, bool) +QString SpiceSENS_Xyce::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s; s.clear(); - if (isXyce) { + if (dialect == spicecompat::SPICEXyce) { QString start = spicecompat::normalize_value(Props.at(3)->Value); QString stop = spicecompat::normalize_value(Props.at(4)->Value); QString step = spicecompat::normalize_value(Props.at(5)->Value); diff --git a/qucs/spicecomponents/sp_sens_xyce.h b/qucs/spicecomponents/sp_sens_xyce.h index 09bd87464..625cde8c6 100644 --- a/qucs/spicecomponents/sp_sens_xyce.h +++ b/qucs/spicecomponents/sp_sens_xyce.h @@ -29,7 +29,7 @@ class SpiceSENS_Xyce : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; diff --git a/qucs/spicecomponents/sp_spectrum.cpp b/qucs/spicecomponents/sp_spectrum.cpp index 6f515c9e5..e2584e40a 100644 --- a/qucs/spicecomponents/sp_spectrum.cpp +++ b/qucs/spicecomponents/sp_spectrum.cpp @@ -57,9 +57,9 @@ Element* SpiceFFT::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString SpiceFFT::spice_netlist(bool isXyce, bool) +QString SpiceFFT::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { - Q_UNUSED(isXyce); + Q_UNUSED(dialect); QString s; QString unit; diff --git a/qucs/spicecomponents/sp_spectrum.h b/qucs/spicecomponents/sp_spectrum.h index cf5510745..f65cdf719 100644 --- a/qucs/spicecomponents/sp_spectrum.h +++ b/qucs/spicecomponents/sp_spectrum.h @@ -29,7 +29,7 @@ class SpiceFFT : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/spicegeneric.cpp b/qucs/spicecomponents/spicegeneric.cpp index 9104c866e..6569bf93f 100644 --- a/qucs/spicecomponents/spicegeneric.cpp +++ b/qucs/spicecomponents/spicegeneric.cpp @@ -134,8 +134,10 @@ QString SpiceGeneric::netlist() return QString(); } -QString SpiceGeneric::spice_netlist(bool, bool) +QString SpiceGeneric::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + // form RefDes from unique device letter and device name QString s = Props.at(1)->Value + Name; for (Port *pp : Ports) { @@ -150,5 +152,5 @@ QString SpiceGeneric::spice_netlist(bool, bool) QString SpiceGeneric::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } diff --git a/qucs/spicecomponents/spicegeneric.h b/qucs/spicecomponents/spicegeneric.h index c3daf87fa..cff19fa19 100644 --- a/qucs/spicecomponents/spicegeneric.h +++ b/qucs/spicecomponents/spicegeneric.h @@ -37,7 +37,7 @@ class SpiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); }; diff --git a/qucs/spicecomponents/spicelibcomp.cpp b/qucs/spicecomponents/spicelibcomp.cpp index 1c279a95a..29a53f98f 100644 --- a/qucs/spicecomponents/spicelibcomp.cpp +++ b/qucs/spicecomponents/spicelibcomp.cpp @@ -218,8 +218,10 @@ int SpiceLibComp::loadSymbol(const QString& DocName) return -8; // field not closed } -QString SpiceLibComp::spice_netlist(bool, bool) +QString SpiceLibComp::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = QStringLiteral("X%1 ").arg(Name); QString pins = getProperty("PinAssign")->Value; QString sym = getProperty("SymPattern")->Value; @@ -241,7 +243,7 @@ QString SpiceLibComp::spice_netlist(bool, bool) QString SpiceLibComp::cdl_netlist() { - return spice_netlist(false, true); + return spice_netlist(spicecompat::CDL); } QString SpiceLibComp::getSpiceLibrary() diff --git a/qucs/spicecomponents/spicelibcomp.h b/qucs/spicecomponents/spicelibcomp.h index dd17d0800..dc89997eb 100644 --- a/qucs/spicecomponents/spicelibcomp.h +++ b/qucs/spicecomponents/spicelibcomp.h @@ -30,7 +30,7 @@ class SpiceLibComp : public MultiViewComponent { QString getSpiceLibrary(); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); virtual QString cdl_netlist(); void createSymbol(); void remakeSymbol(int No, QStringList &pin_names); diff --git a/qucs/spicecomponents/src_eqndef.cpp b/qucs/spicecomponents/src_eqndef.cpp index a16cdd5e3..3f987a7c9 100644 --- a/qucs/spicecomponents/src_eqndef.cpp +++ b/qucs/spicecomponents/src_eqndef.cpp @@ -30,7 +30,7 @@ Src_eqndef::Src_eqndef() Model = "src_eqndef"; SpiceModel = "B"; Name = "B"; - + Props.append(new Property("V", "", true,"B(V) specification")); Props.append(new Property("Line_2", "", false,"+ continuation line 1")); Props.append(new Property("Line_3", "", false,"+ continuation line 2")); @@ -67,15 +67,17 @@ QString Src_eqndef::netlist() return QString(); } -QString Src_eqndef::spice_netlist(bool, bool) +QString Src_eqndef::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; if (nam=="gnd") nam = "0"; s += " "+ nam + " "; // node names } - + QString VI = Props.at(0)-> Name; QString VI2 = Props.at(0)->Value; QString Line_2 = Props.at(1)->Value; diff --git a/qucs/spicecomponents/src_eqndef.h b/qucs/spicecomponents/src_eqndef.h index c3570663c..15d53dfcc 100644 --- a/qucs/spicecomponents/src_eqndef.h +++ b/qucs/spicecomponents/src_eqndef.h @@ -11,7 +11,7 @@ class Src_eqndef : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); QString va_code(); }; diff --git a/qucs/spicecomponents/vAmpMod.cpp b/qucs/spicecomponents/vAmpMod.cpp index ffd87fbe5..768cc1c12 100644 --- a/qucs/spicecomponents/vAmpMod.cpp +++ b/qucs/spicecomponents/vAmpMod.cpp @@ -40,8 +40,6 @@ vAmpMod::vAmpMod() // minus sign Lines.append(new qucs::Line(-18, -5,-18, -11,QPen(Qt::black,2))); - - Ports.append(new Port( 30, 0)); Ports.append(new Port(-30, 0)); @@ -91,8 +89,10 @@ QString vAmpMod::netlist() return QString(); } -QString vAmpMod::spice_netlist(bool, bool) +QString vAmpMod::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/spicecomponents/vAmpMod.h b/qucs/spicecomponents/vAmpMod.h index 1fbdfc8fb..024a3295c 100644 --- a/qucs/spicecomponents/vAmpMod.h +++ b/qucs/spicecomponents/vAmpMod.h @@ -29,9 +29,10 @@ class vAmpMod : public Component { ~vAmpMod(); Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); + protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // VAMPMOD_H diff --git a/qucs/spicecomponents/vPWL.cpp b/qucs/spicecomponents/vPWL.cpp index b8e1d3f89..a73f93d53 100644 --- a/qucs/spicecomponents/vPWL.cpp +++ b/qucs/spicecomponents/vPWL.cpp @@ -52,17 +52,16 @@ vPWL::vPWL() Name = "V"; Props.append(new Property("PWL", "", true,"Piece-Wise Linear\nSpecification")); - Props.append(new Property("Line_2", "", false,"+ continuation line 1")); - Props.append(new Property("Line_3", "", false,"+ continuation line 2")); - Props.append(new Property("Line_4", "", false,"+ continuation line 3")); - Props.append(new Property("Line_5", "", false,"+ continuation line 4")); - Props.append(new Property("Line_6", "", false,"+ continuation line 5")); - Props.append(new Property("Line_7", "", false,"+ continuation line 6")); - Props.append(new Property("Line_8", "", false,"+ continuation line 7")); - Props.append(new Property("Line_9", "", false,"+ continuation line 8")); - Props.append(new Property("Line_10", "", false,"+ continuation line 9")); - - + Props.append(new Property("Line_2", "", false,"+ continuation line 1")); + Props.append(new Property("Line_3", "", false,"+ continuation line 2")); + Props.append(new Property("Line_4", "", false,"+ continuation line 3")); + Props.append(new Property("Line_5", "", false,"+ continuation line 4")); + Props.append(new Property("Line_6", "", false,"+ continuation line 5")); + Props.append(new Property("Line_7", "", false,"+ continuation line 6")); + Props.append(new Property("Line_8", "", false,"+ continuation line 7")); + Props.append(new Property("Line_9", "", false,"+ continuation line 8")); + Props.append(new Property("Line_10", "", false,"+ continuation line 9")); + rotate(); // fix historical flaw } @@ -89,8 +88,10 @@ QString vPWL::netlist() return QString(); } -QString vPWL::spice_netlist(bool, bool) +QString vPWL::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -98,20 +99,19 @@ QString vPWL::spice_netlist(bool, bool) s += " "+ nam+" "; // node names } - -QString PWL= Props.at(0)->Value; -QString Line_2= Props.at(1)->Value; -QString Line_3= Props.at(2)->Value; -QString Line_4= Props.at(3)->Value; -QString Line_5= Props.at(4)->Value; -QString Line_6= Props.at(5)->Value; -QString Line_7= Props.at(6)->Value; -QString Line_8= Props.at(7)->Value; -QString Line_9= Props.at(8)->Value; -QString Line_10= Props.at(9)->Value; + QString PWL= Props.at(0)->Value; + QString Line_2= Props.at(1)->Value; + QString Line_3= Props.at(2)->Value; + QString Line_4= Props.at(3)->Value; + QString Line_5= Props.at(4)->Value; + QString Line_6= Props.at(5)->Value; + QString Line_7= Props.at(6)->Value; + QString Line_8= Props.at(7)->Value; + QString Line_9= Props.at(8)->Value; + QString Line_10= Props.at(9)->Value; s += QString(); - + if( PWL.length() > 0) s += QStringLiteral("%1").arg(PWL); if( Line_2.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_2); if( Line_3.length() > 0 ) s += QStringLiteral("\n%1").arg(Line_3); diff --git a/qucs/spicecomponents/vPWL.h b/qucs/spicecomponents/vPWL.h index 2077a0d76..01d19eb9f 100644 --- a/qucs/spicecomponents/vPWL.h +++ b/qucs/spicecomponents/vPWL.h @@ -31,7 +31,7 @@ class vPWL : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // VPWL_H diff --git a/qucs/spicecomponents/vTRNOISE.cpp b/qucs/spicecomponents/vTRNOISE.cpp index f1ffc0edd..34b11739d 100644 --- a/qucs/spicecomponents/vTRNOISE.cpp +++ b/qucs/spicecomponents/vTRNOISE.cpp @@ -94,8 +94,10 @@ QString vTRNOISE::netlist() return QString(); } -QString vTRNOISE::spice_netlist(bool, bool) +QString vTRNOISE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/spicecomponents/vTRNOISE.h b/qucs/spicecomponents/vTRNOISE.h index e5cd75679..c16c463d6 100644 --- a/qucs/spicecomponents/vTRNOISE.h +++ b/qucs/spicecomponents/vTRNOISE.h @@ -31,7 +31,7 @@ class vTRNOISE : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // VTRNOISE_H diff --git a/qucs/spicecomponents/vTRRANDOM.cpp b/qucs/spicecomponents/vTRRANDOM.cpp index 06be58508..14d6414c1 100644 --- a/qucs/spicecomponents/vTRRANDOM.cpp +++ b/qucs/spicecomponents/vTRRANDOM.cpp @@ -96,8 +96,10 @@ QString vTRRANDOM::netlist() return QString(); } -QString vTRRANDOM::spice_netlist(bool, bool) +QString vTRRANDOM::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -105,11 +107,11 @@ QString vTRRANDOM::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString Type= spicecompat::normalize_value(Props.at(0)->Value); - QString Ts= spicecompat::normalize_value(Props.at(1)->Value); - QString Td= spicecompat::normalize_value(Props.at(2)->Value); - QString Param1 = spicecompat::normalize_value(Props.at(3)->Value); - QString Param2 = spicecompat::normalize_value(Props.at(4)->Value); + QString Type= spicecompat::normalize_value(Props.at(0)->Value); + QString Ts= spicecompat::normalize_value(Props.at(1)->Value); + QString Td= spicecompat::normalize_value(Props.at(2)->Value); + QString Param1 = spicecompat::normalize_value(Props.at(3)->Value); + QString Param2 = spicecompat::normalize_value(Props.at(4)->Value); s += QStringLiteral(" DC 0 AC 0 TRRANDOM(%1 %2 %3 %4 %5 ) \n").arg(Type).arg(Ts).arg(Td).arg(Param1).arg(Param2); return s; diff --git a/qucs/spicecomponents/vTRRANDOM.h b/qucs/spicecomponents/vTRRANDOM.h index f34ff3406..b8de87a98 100644 --- a/qucs/spicecomponents/vTRRANDOM.h +++ b/qucs/spicecomponents/vTRRANDOM.h @@ -31,7 +31,7 @@ class vTRRANDOM : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // VTRRANDOM_H diff --git a/qucs/spicecomponents/volt_ac_SPICE.cpp b/qucs/spicecomponents/volt_ac_SPICE.cpp index ed19b4ee8..d14b1b6f8 100644 --- a/qucs/spicecomponents/volt_ac_SPICE.cpp +++ b/qucs/spicecomponents/volt_ac_SPICE.cpp @@ -72,8 +72,10 @@ Element* Vac_SPICE::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString Vac_SPICE::spice_netlist(bool, bool) +QString Vac_SPICE::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; diff --git a/qucs/spicecomponents/volt_ac_SPICE.h b/qucs/spicecomponents/volt_ac_SPICE.h index e66e44186..5419c0787 100644 --- a/qucs/spicecomponents/volt_ac_SPICE.h +++ b/qucs/spicecomponents/volt_ac_SPICE.h @@ -28,7 +28,7 @@ class Vac_SPICE : public Component { Component* newOne(); static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif diff --git a/qucs/spicecomponents/vsffm.cpp b/qucs/spicecomponents/vsffm.cpp index d77d73857..5816c93ba 100644 --- a/qucs/spicecomponents/vsffm.cpp +++ b/qucs/spicecomponents/vsffm.cpp @@ -89,8 +89,10 @@ QString vSffm::netlist() return QString(); } -QString vSffm::spice_netlist(bool, bool) +QString vSffm::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); for (Port *p1 : Ports) { QString nam = p1->Connection->Name; @@ -98,12 +100,11 @@ QString vSffm::spice_netlist(bool, bool) s += " "+ nam; // node names } - QString Vo= spicecompat::normalize_value(Props.at(0)->Value); - QString Va= spicecompat::normalize_value(Props.at(1)->Value); - QString Fc= spicecompat::normalize_value(Props.at(2)->Value); - QString Mdi = spicecompat::normalize_value(Props.at(3)->Value); - QString Fs = spicecompat::normalize_value(Props.at(4)->Value); - + QString Vo= spicecompat::normalize_value(Props.at(0)->Value); + QString Va= spicecompat::normalize_value(Props.at(1)->Value); + QString Fc= spicecompat::normalize_value(Props.at(2)->Value); + QString Mdi = spicecompat::normalize_value(Props.at(3)->Value); + QString Fs = spicecompat::normalize_value(Props.at(4)->Value); s += QStringLiteral(" DC 0 SFFM(%1 %2 %3 %4 %5 ) AC 0\n").arg(Vo).arg(Va).arg(Fc).arg(Mdi).arg(Fs); return s; diff --git a/qucs/spicecomponents/vsffm.h b/qucs/spicecomponents/vsffm.h index 3a8beb87a..ae6a1ad8a 100644 --- a/qucs/spicecomponents/vsffm.h +++ b/qucs/spicecomponents/vsffm.h @@ -31,7 +31,7 @@ class vSffm : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: QString netlist(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; #endif // VSFFM_H diff --git a/qucs/spicecomponents/xsp_cmlib.cpp b/qucs/spicecomponents/xsp_cmlib.cpp index bce6117db..77995c6a8 100644 --- a/qucs/spicecomponents/xsp_cmlib.cpp +++ b/qucs/spicecomponents/xsp_cmlib.cpp @@ -86,8 +86,10 @@ QString XSP_CMlib::getSpiceInit() return s; } -QString XSP_CMlib::spice_netlist(bool, bool) +QString XSP_CMlib::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + return QString(); } diff --git a/qucs/spicecomponents/xsp_cmlib.h b/qucs/spicecomponents/xsp_cmlib.h index 4d8d90cab..617c4395f 100644 --- a/qucs/spicecomponents/xsp_cmlib.h +++ b/qucs/spicecomponents/xsp_cmlib.h @@ -32,7 +32,7 @@ class XSP_CMlib : public Component { QString getSpiceInit(); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; diff --git a/qucs/spicecomponents/xsp_codemodel.cpp b/qucs/spicecomponents/xsp_codemodel.cpp index 7c4a15c0d..4b2f5ac1a 100644 --- a/qucs/spicecomponents/xsp_codemodel.cpp +++ b/qucs/spicecomponents/xsp_codemodel.cpp @@ -69,8 +69,10 @@ Element* XSP_CodeModel::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString XSP_CodeModel::spice_netlist(bool, bool) +QString XSP_CodeModel::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + return QString(); } diff --git a/qucs/spicecomponents/xsp_codemodel.h b/qucs/spicecomponents/xsp_codemodel.h index ae0d74ec3..819ccf40a 100644 --- a/qucs/spicecomponents/xsp_codemodel.h +++ b/qucs/spicecomponents/xsp_codemodel.h @@ -30,7 +30,7 @@ class XSP_CodeModel : public Component { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; diff --git a/qucs/spicecomponents/xspicegeneric.cpp b/qucs/spicecomponents/xspicegeneric.cpp index 7695a410c..8a38f49eb 100644 --- a/qucs/spicecomponents/xspicegeneric.cpp +++ b/qucs/spicecomponents/xspicegeneric.cpp @@ -91,7 +91,7 @@ void XspiceGeneric::createSymbol() int No = n_ports.count(); QString tmp; - + // draw symbol outline #define HALFWIDTH 27 int h = 30*((No-1)/2) + 15; @@ -145,8 +145,10 @@ QString XspiceGeneric::netlist() return QString(); } -QString XspiceGeneric::spice_netlist(bool, bool) +QString XspiceGeneric::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { + Q_UNUSED(dialect); + QString s = spicecompat::check_refdes(Name,SpiceModel); QStringList t_ports = Props.at(0)->Value.split(','); diff --git a/qucs/spicecomponents/xspicegeneric.h b/qucs/spicecomponents/xspicegeneric.h index 9b5e878eb..8171df1fe 100644 --- a/qucs/spicecomponents/xspicegeneric.h +++ b/qucs/spicecomponents/xspicegeneric.h @@ -37,7 +37,7 @@ class XspiceGeneric : public MultiViewComponent { protected: QString netlist(); void createSymbol(); - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); }; diff --git a/qucs/spicecomponents/xyce_script.cpp b/qucs/spicecomponents/xyce_script.cpp index 940224df5..71280380e 100644 --- a/qucs/spicecomponents/xyce_script.cpp +++ b/qucs/spicecomponents/xyce_script.cpp @@ -55,10 +55,10 @@ Element* XyceScript::info(QString& Name, char* &BitmapFile, bool getNewOne) return 0; } -QString XyceScript::spice_netlist(bool isXyce, bool) +QString XyceScript::spice_netlist(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */) { QString s = ""; - if (!isXyce) return s; + if (dialect != spicecompat::SPICEXyce) return s; s = Props.at(0)->Value+"\n"; return s; } diff --git a/qucs/spicecomponents/xyce_script.h b/qucs/spicecomponents/xyce_script.h index 227b09ea4..239b3338c 100644 --- a/qucs/spicecomponents/xyce_script.h +++ b/qucs/spicecomponents/xyce_script.h @@ -29,7 +29,7 @@ class XyceScript : public qucs::component::SimulationComponent { static Element* info(QString&, char* &, bool getNewOne=false); protected: - QString spice_netlist(bool isXyce = false, bool isCdl = false); + QString spice_netlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault); Qt::GlobalColor color() const override { return Qt::darkGreen; } }; From efb112d74d9ea9afb6a2357a9bd8d3a68ede9302 Mon Sep 17 00:00:00 2001 From: Thomas Zecha <149156312+ThomasZecha@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:22:31 +0100 Subject: [PATCH 10/10] Update qucs.cpp Fixed typo --- qucs/qucs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qucs/qucs.cpp b/qucs/qucs.cpp index 584035413..039fae55e 100644 --- a/qucs/qucs.cpp +++ b/qucs/qucs.cpp @@ -3508,7 +3508,7 @@ void QucsApp::slotSaveCdlNetlist() Schematic* schematic = dynamic_cast(DocumentTab->currentWidget()); Q_ASSERT(schematic != nullptr); -#ifdef NETLIST_CDL_TO_CONSOLEa // for fast testing purposes +#ifdef NETLIST_CDL_TO_CONSOLE // for fast testing purposes QString netlistString; { QTextStream netlistStream(&netlistString);