Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem to specify log sweep #1195

Closed
dwarning opened this issue Jan 7, 2025 · 10 comments · Fixed by #1198
Closed

Problem to specify log sweep #1195

dwarning opened this issue Jan 7, 2025 · 10 comments · Fixed by #1198
Labels
Milestone

Comments

@dwarning
Copy link

dwarning commented Jan 7, 2025

Made yesterday a compile from current branch with mingw-ucrt64 and have now problem to specify a log parameter sweep. The widget did not calculate the number of total points anymore. Simulation fails.

image

@ra3xdh ra3xdh added the bug label Jan 7, 2025
@ra3xdh ra3xdh added this to the 25.1.0 milestone Jan 7, 2025
@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

According the chapter 11.3.2 of the Ngspice manual the log sweep typ is not supported for DC simulation. The DC+ParSweep is converted to SPICE DC sweep. You cannot define log sweep for it.

@ra3xdh ra3xdh removed the bug label Jan 7, 2025
@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

This simulation type will work only for Qucsator. Something is wrong with points calculation. When I input 10 point per decade the total points gives 1. This may appear after #1054 @iwbnwif , Please have a look.

image

@dwarning
Copy link
Author

dwarning commented Jan 7, 2025

No, with your provided executable 24.4.1 it works very well, as all the time:

image

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

To be honestly I cannot remember when I used the LOG Parameter Sweep the last time and if it was operational before.

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

No, with your provided executable 24.4.1 it works very well, as all the time:

It works, but the result is totally wrong. The step is linear. The DC simulation type supports only linear step. It generates the following netlist line (for another schematic):

dc i1 1e-09 0.1 0.000833333

But the point number calculation is correct. I suspect it was broken after #1054

@dwarning
Copy link
Author

dwarning commented Jan 7, 2025

OK, now I see. My thought was initial that qucs-s transfer this to a pointwise simulation.
Correct would be that log disappears if I specify DC1 simulation type.
How the step 0.000833333 is calculated?

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

How the step 0.000833333 is calculated?

step=(stop-start)/number

For my example (100m-1n)/121. This is not possible to fix, because DC doesn't support LOG sweep like AC.

@dwarning
Copy link
Author

dwarning commented Jan 7, 2025

I tried List with the provided binary.
image

This goes total wrong:

dc i1 0 2.63144e-312 1.17439e-311

In the end only lin sweep should be allowed and enumerated for ngspice active.

@ra3xdh ra3xdh added the bug label Jan 7, 2025
@ra3xdh
Copy link
Owner

ra3xdh commented Jan 7, 2025

I have identified the root of the wrong calculation. The error is gone after the following patch:

diff --git a/qucs/components/componentdialog.cpp b/qucs/components/componentdialog.cpp
index 4f94f71e..92397082 100644
--- a/qucs/components/componentdialog.cpp
+++ b/qucs/components/componentdialog.cpp
@@ -597,13 +597,13 @@ void ComponentDialog::updateSweepProperty(const QString& property)
       if (property == "Start" || property == "Stop" || property == "Points" || property == "All")
       {
         double points = str2num(pointsEdit->value());
-        double step = (points - 1.0) / log10(fabs((stop < 1.0 ? 1.0 : stop) / (start < 1.0 ? 1.0 : start)));
+        double step = (points - 1.0) / log10(fabs((stop) / (start)));
         sweepParamWidget["Step"]->setValue(misc::num2str(step));
       }
       else if (property == "Step")
       {
         double step = str2num(sweepParamWidget["Step"]->value());
-        double points = log10(fabs((stop < 1.0 ? 1.0 : stop) / (start < 1.0 ? 1.0 : start))) * step + 1.0;
+        double points = log10(fabs((stop) / (start))) * step + 1.0;
         pointsEdit->setValue(QString::number(round(points), 'g', 16));
       }     
     }

@iwbnwif What was the purpose of stop < 1.0 ? 1.0 : stop in the equation? The start and stop value may be less than one. The value greater than zero must be allowed.

@ra3xdh
Copy link
Owner

ra3xdh commented Jan 8, 2025

Log limits calculation is fixed by #1198. The disable of log+DC sweep will be implemented as part of #974, because it depends on simulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants