From b847af10c70a2706ef1612152570f639d76c005d Mon Sep 17 00:00:00 2001 From: KrzysztofHerman Date: Tue, 3 Dec 2024 16:47:55 +0100 Subject: [PATCH 1/3] AC power source source_ac.cpp amplitude fix Signed-off-by: KrzysztofHerman --- qucs/components/source_ac.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qucs/components/source_ac.cpp b/qucs/components/source_ac.cpp index 1025f66a9..ca40bf377 100644 --- a/qucs/components/source_ac.cpp +++ b/qucs/components/source_ac.cpp @@ -64,7 +64,7 @@ Source_ac::Source_ac() Props.append(new Property("Z", "50 Ohm", true, QObject::tr("port impedance"))); Props.append(new Property("P", "0 dBm", false, - QObject::tr("(available) ac power in Watts"))); + QObject::tr("(available) ac power in dBm"))); Props.append(new Property("f", "1 MHz", false, QObject::tr("frequency in Hertz"))); Props.append(new Property("Temp", "26.85", false, @@ -106,7 +106,7 @@ QString Source_ac::ngspice_netlist() double z0 = spicecompat::normalize_value(getProperty("Z")->Value).toDouble(); double p = spicecompat::normalize_value(getProperty("P")->Value).toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = 2.0*vrms*sqrt(2.0); + double vamp = vrms*sqrt(2.0); QString f = spicecompat::normalize_value(getProperty("f")->Value); bool en_tran = true; @@ -140,7 +140,7 @@ QString Source_ac::xyce_netlist() QString s_p = spicecompat::normalize_value(getProperty("P")->Value); double p = s_p.toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = 2.0*vrms*sqrt(2.0); + double vamp = vrms*sqrt(2.0); bool en_tran = true; if (getProperty("EnableTran")->Value == "true") { From 043cb8214cf629f67c62e74e1fc0bd5484b46f9c Mon Sep 17 00:00:00 2001 From: KrzysztofHerman Date: Wed, 4 Dec 2024 08:24:08 +0100 Subject: [PATCH 2/3] Amplitude changes reverted Signed-off-by: KrzysztofHerman --- qucs/components/source_ac.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qucs/components/source_ac.cpp b/qucs/components/source_ac.cpp index ca40bf377..3b3f0f0ba 100644 --- a/qucs/components/source_ac.cpp +++ b/qucs/components/source_ac.cpp @@ -106,7 +106,7 @@ QString Source_ac::ngspice_netlist() double z0 = spicecompat::normalize_value(getProperty("Z")->Value).toDouble(); double p = spicecompat::normalize_value(getProperty("P")->Value).toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = vrms*sqrt(2.0); + double vamp = 2*vrms*sqrt(2.0); QString f = spicecompat::normalize_value(getProperty("f")->Value); bool en_tran = true; @@ -140,7 +140,7 @@ QString Source_ac::xyce_netlist() QString s_p = spicecompat::normalize_value(getProperty("P")->Value); double p = s_p.toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = vrms*sqrt(2.0); + double vamp = 2*vrms*sqrt(2.0); bool en_tran = true; if (getProperty("EnableTran")->Value == "true") { From 7a330e287b62216a8f91feba7ab611d724314df6 Mon Sep 17 00:00:00 2001 From: KrzysztofHerman Date: Wed, 4 Dec 2024 08:25:29 +0100 Subject: [PATCH 3/3] Amplitude changes reverted using floating point format Signed-off-by: KrzysztofHerman --- qucs/components/source_ac.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qucs/components/source_ac.cpp b/qucs/components/source_ac.cpp index 3b3f0f0ba..913047da5 100644 --- a/qucs/components/source_ac.cpp +++ b/qucs/components/source_ac.cpp @@ -106,7 +106,7 @@ QString Source_ac::ngspice_netlist() double z0 = spicecompat::normalize_value(getProperty("Z")->Value).toDouble(); double p = spicecompat::normalize_value(getProperty("P")->Value).toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = 2*vrms*sqrt(2.0); + double vamp = 2.0*vrms*sqrt(2.0); QString f = spicecompat::normalize_value(getProperty("f")->Value); bool en_tran = true; @@ -140,7 +140,7 @@ QString Source_ac::xyce_netlist() QString s_p = spicecompat::normalize_value(getProperty("P")->Value); double p = s_p.toDouble(); double vrms = sqrt(z0/1000.0)*pow(10, p/20.0); - double vamp = 2*vrms*sqrt(2.0); + double vamp = 2.0*vrms*sqrt(2.0); bool en_tran = true; if (getProperty("EnableTran")->Value == "true") {