I'm using ngSpice_AllPlots(), then ngSpice_AllVecs("ac1") then ngGet_Vec_Info(..) then finally reading v_realdata or v_compdata. If I only use "ac" only or "tran" only, it works. But when I want both, the older one gets somehow rewriten and data is no longer available.
Attached is minimal demo. When you only use one characteristic (either ac or tran) it works, but when you use both the older one (ac) will have undefined "frequency". If you switch the order:
"tran 300u 20m 0",
"ac dec 10 16 20k",
then "tran1" will have undefined "time". Is it possible to read both at the same time?
If not how to read both "ac" and "tran"? Should I just run netlist with "ac", get data and then replace the entire netlist and run it with only "tran" and get data?
The ac command creates plot ac1, the tran command creates plot tran1.
So what about
ngSpice_AllPlots(), then ngSpice_AllVecs("ac1") then ngGet_Vec_Info(..)
read the ac data, then switch to the other plot by
ngSpice_AllPlots(), then ngSpice_AllVecs("tran1") then ngGet_Vec_Info(..)
read the tran data
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have following circuit:
I'm using ngSpice_AllPlots(), then ngSpice_AllVecs("ac1") then ngGet_Vec_Info(..) then finally reading v_realdata or v_compdata. If I only use "ac" only or "tran" only, it works. But when I want both, the older one gets somehow rewriten and data is no longer available.
Attached is minimal demo. When you only use one characteristic (either ac or tran) it works, but when you use both the older one (ac) will have undefined "frequency". If you switch the order:
then "tran1" will have undefined "time". Is it possible to read both at the same time?
If not how to read both "ac" and "tran"? Should I just run netlist with "ac", get data and then replace the entire netlist and run it with only "tran" and get data?
The ac command creates plot ac1, the tran command creates plot tran1.
So what about
ngSpice_AllPlots(), then ngSpice_AllVecs("ac1") then ngGet_Vec_Info(..)
read the ac data, then switch to the other plot by
ngSpice_AllPlots(), then ngSpice_AllVecs("tran1") then ngGet_Vec_Info(..)
read the tran data
That's exactly what I'm doing in demo and it doesn't work.
What happens if you send 'run' instead of 'bg_run', no need for usleep then, so to keep everything in the main thread?
It doesn't help.
To analyze what you have you might send the following commands and watch the response:
Ok, this helped. So before calling ngSpice_AllVecs("ac1") I need to call:
ngSpice_Command("setplot ac1");
Thanks.
Last edit: simpletk 2023-03-08