This shows you the differences between two versions of the page.
gnucap:manual:examples:simple_power_supply [2022/10/18 04:24] felixs Tie down s1 and s2 |
gnucap:manual:examples:simple_power_supply [2022/10/18 04:51] (current) felixs [Simulate] |
||
---|---|---|---|
Line 73: | Line 73: | ||
===== Simulate ===== | ===== Simulate ===== | ||
+ | Try | ||
+ | |||
+ | gnucap> param cfilter 5000u | ||
+ | gnucap> param rload 100 | ||
+ | gnucap> print tran v(nodes) | ||
+ | gnucap> tr .2 trace=a > tr.out | ||
+ | |||
+ | Now, there is a file tr.out with voltages over time. Plot some of it, and it may look like | ||
+ | |||
+ | {{:gnucap:manual:examples:pwr_init.png?400|}} | ||
+ | |||
+ | We are interested in v(out). Store it from now on, and simulate a bit further. | ||
+ | |||
+ | gnucap> store tran v(out) | ||
+ | gnucap> tr .5 trace=a > tr.out | ||
+ | |||
+ | {{:gnucap:manual:examples:pwr_out.png?400|}} | ||
+ | |||
+ | OK, not perfect. We should have waited until .3 or more for it to settle. Try tr 0 .3 if you are curious. Anyway, with this waveform stored, we can do some measurements as follows. | ||
+ | |||
+ | gnucap> measure min=min("v(out)") | ||
+ | min= 37.4370112192329 | ||
+ | gnucap> measure max=max("v(out)") | ||
+ | max= 38.0723316837578 | ||
+ | gnucap> param range = max-min | ||
+ | gnucap> eval range | ||
+ | range= 0.635320464524902 | ||
+ | gnucap> measure mean=mean("v(out)") | ||
+ | mean= 37.8378453386751 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
==== Set up and first run ==== | ==== Set up and first run ==== |