I have a C# program with a front panel that communicates to ngspice (version 25) using the –p argument. I want this C# program’s front panel to operate like a National Instruments Multisim interactive simulation. I have manually tried many combinations of ngspice commands to test a simple RC circuit - but nothing seems to work as expected.
The program’s front panel has indicators, switches, pots, displays etc. which the user can interact with while a simulation is running. It can communicate through pipes (stdin, stdout, stderr) and can parse the ngspice responses.
I would like to know what sequence of commands the C# program should send to ngspice to be able to run successive segments of a transient analysis (or separate trans). After each segment break (or at each time interval) component vectors will be read from the simulation and component values will be altered. Here is the basic processing functionality the program should be able to do:
1. It should be able to load/source a .cir into ngspice (source xyz.cir).
2. It should be able to read the final state of the analysis in order to update its front panel (?)
3. It should be able to write / alter component values for the next running simulation segment (alter r 10k) using values from its front panel.
4. It should be able to resume the simulation so that the next segment of the tran simulation retains the final state of the previous segment (tran) and use the altered component values (?).
5. It should be able to loop indefinitely running segmented simulations as fast as possible.
Do you have specific suggestions for the commands to be used in the above?
I appreciate any suggestions.
You may try the following sequence:
stop when time = 10n
stop when time = 25n
tran 0.1n 40n
tran step stop
will always set the total simulation time (stop).
The stop commands (to be given before tran) will set breakpoints, after being startet with tran, the simulation will stop at the breakpoint time given, you may alter something, read something else, and continue the simulation with resume.