From: Hannu V. <vu...@ms...> - 2015-09-20 13:36:07
|
Hi! My google-fu might not be perfect but I couldn't find any example how to sweep my connection with squarewave. And I'm looking for 1ms on 1ms off 100 us on 100 us off 10 us on 10 us off kind of sweep. I think I want transient analysis and somehow manipulate the vpulse parameters. Best regards, Hannu Vuolasaho |
From: Robert L. <Rob...@t-...> - 2015-09-20 17:49:05
|
Hello Hannu, I've appended something which might give you an idea starting point how to tackle this. You will need a "while" or similar loop in a ".control" section. Within the loop you will need an "alter" to change the v PULSE instance, and a "tran" to run simulation with this new v pulse source. Then you will need to collect somehow the data which you are after, or plot them altogether with something like plot tran1.v(n1) tran2.v(n1) .. The first attached piece just shows you a bit of syntax to do the "alter". The second attached piece shows you a "foreach" loop and a way to collect the plot names, and how to plot them all in one. This one runs "dc" instead of your "tran". (For the name concatenation you will need a sufficiently new ngspice) Regards, Robert altering the second parameter of a `pulse' VSRC device * (compile (concat "w32/src/ngspice " buffer-file-name) t) vaph1 aph1 0 pulse 0v 0.042ns .50ns .01ns .01ns .99ns 2ns .control show vaph1 let pulse_v1 = @vaph1[pulse] * print status quo print pulse_v1 @vaph1[pulse] * alter the second vaph1 pulse parameter let pulse_v1[1] = 0.43ns alter @vaph1[pulse] pulse_v1 * verify show vaph1 print pulse_v1 @vaph1[pulse] .endc ----- * (exec-spice "ngspice %s" t) i1 0 1 dc 100u d1 1 0 dplain .model dplain d(is=1.0f) .control set them = ( ) set signals = ( ) foreach is 0.1f, 1f, 10f altermod dplain is $is dc i1 200u 1000u 200u set them = ( $them $curplot ) set signals = ( $signals {$curplot}.v(1) ) echo "curplot = $curplot" echo "curplottitle = $curplottitle" echo "curplotname = $curplotname" set curplottitle = "p_title is=$is" set curplotname = "p_name is=$is" * on unix, curplottitle will be in the windowmanagers frame * which is around the plot window plot v(1) end * plot them all together echo "signals = $signals" plot $signals * plot one, setplot $them[1] plot v(1) .endc Hannu Vuolasaho <vu...@ms...> writes: > Hi! > > My google-fu might not be perfect but I couldn't find any example how > to sweep my connection with squarewave. > > And I'm looking for 1ms on 1ms off 100 us on 100 us off 10 us on 10 us > off kind of sweep. > I think I want transient analysis and somehow manipulate the vpulse parameters. > > Best regards, > Hannu Vuolasaho |
From: Andy F. <and...@si...> - 2015-09-20 18:00:46
|
You could try using the XSPICE Controlled Squarewave Oscillator: http://ngspice.sourceforge.net/docs/ngspice-manual.pdf#subsection.12.2.22 or you might like to play with this idea I was tinkering with: https://easyeda.com/andyfierman/Basic_behavioural_VCO_based_on_integrator_and_modulo_divider_function-omgysK2ke Cheers, Andy. signality.co.uk On 20 September 2015 at 14:23, Hannu Vuolasaho <vu...@ms...> wrote: > Hi! > > My google-fu might not be perfect but I couldn't find any example how to > sweep my connection with squarewave. > > And I'm looking for 1ms on 1ms off 100 us on 100 us off 10 us on 10 us off > kind of sweep. > I think I want transient analysis and somehow manipulate the vpulse > parameters. > > Best regards, > Hannu Vuolasaho > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ngspice-users mailing list > Ngs...@li... > https://lists.sourceforge.net/lists/listinfo/ngspice-users > |
From: Hannu V. <vu...@ms...> - 2015-09-20 18:46:20
|
Thanks guys. Unfortunately I'm not that fluent with spice. Controlled square wave oscillator looks something, I could use. However reading through the manual sections I couldn't figure out it thoroughly. If I understood correctly manual, I could put simple RC filter to ControlVin and get capacitor charging ramp to frequency from pulsesOut? or pwl source. ain ControlVin PulsesOut pulse1 .model pulse1 square(cntl_array = [ 0 10] + freq_array=[10 10000] out_low = 0.0 + out_high = 5 duty_cycle = 0.5 + rise_time = 1e-6 fall_time = 2e-6) With ControlVin I get the frequency. Am I totally wrong? Hannu Vuolasaho ________________________________ > From: and...@si... > Date: Sun, 20 Sep 2015 19:00:19 +0100 > To: ngs...@li... > Subject: Re: [Ngspice-users] How to make squarewave sweep > > You could try using the XSPICE Controlled Squarewave Oscillator: > > http://ngspice.sourceforge.net/docs/ngspice-manual.pdf#subsection.12.2.22 > > or you might like to play with this idea I was tinkering with: > > https://easyeda.com/andyfierman/Basic_behavioural_VCO_based_on_integrator_and_modulo_divider_function-omgysK2ke > > Cheers, > > Andy. > > signality.co.uk<http://signality.co.uk> > > On 20 September 2015 at 14:23, Hannu Vuolasaho > <vu...@ms...<mailto:vu...@ms...>> wrote: > Hi! > > My google-fu might not be perfect but I couldn't find any example how > to sweep my connection with squarewave. > > And I'm looking for 1ms on 1ms off 100 us on 100 us off 10 us on 10 us > off kind of sweep. > I think I want transient analysis and somehow manipulate the vpulse > parameters. > > Best regards, > Hannu Vuolasaho > > ------------------------------------------------------------------------------ > _______________________________________________ > Ngspice-users mailing list > Ngs...@li...<mailto:Ngs...@li...> > https://lists.sourceforge.net/lists/listinfo/ngspice-users > > > ------------------------------------------------------------------------------ > _______________________________________________ Ngspice-users mailing > list Ngs...@li... > https://lists.sourceforge.net/lists/listinfo/ngspice-users |
From: John D. <jp...@no...> - 2015-09-20 19:10:09
Attachments:
signature.asc
|
On Sep 20, 2015, at 12:46 PM, Hannu Vuolasaho <vu...@ms...> wrote: > or pwl source. That’s what I do for complicated stimuli. I write a little program in some scripting language to emit a PWL source. John Doty Noqsi Aerospace, Ltd. http://www.noqsi.com/ jp...@no... |
From: Tom <mad...@go...> - 2015-09-21 07:20:33
|
On 20/09/15 14:23, Hannu Vuolasaho wrote: > Hi! > > My google-fu might not be perfect but I couldn't find any example how to sweep my connection with squarewave. > > And I'm looking for 1ms on 1ms off 100 us on 100 us off 10 us on 10 us off kind of sweep. > I think I want transient analysis and somehow manipulate the vpulse parameters. > > Best regards, > Hannu Vuolasaho > > ------------------------------------------------------------------------------ > _______________________________________________ > Ngspice-users mailing list > Ngs...@li... > https://lists.sourceforge.net/lists/listinfo/ngspice-users > If its not too big PWL would do. I sometimes write external macros to produce the input I want if they are long. Tom |