I have found some solution in LTspice but Im wondering if anybody could achieve to sweep duty cycle of a fixed freq. pulse in PSpice.
Is that possible?
I tried the following but it didnt work:
You are not using a comparator. I would have answered in the comments section, but I feel it may not be enough, so here's as example made in LTspice:
What you are using is a VCVS (voltage controlled voltage source), which simply outputs the difference between its non-inverting input and its inverting one, multiplied by the amount of gain.
You need to use a comparator, or something with a comparator's properties. I used LTspice's Schmitt A-device, which has complementary ouputs (you can ignore the negated one) and is set with a 1mV positive hysteresis, in order to directly compare with an VCVS (E1 in the schematic) transformed to behave similarly to a comparator.
Note that, while I seem to recall (from some 20 years ago) that PSpice has some default, ideal comparator (that you can use instead of my A1), and that it should have some form of the original Berkeley SPICE's table() function, I don't know how to implement it, so it's up to you.
V1 acts as a variable duty-cycle generator (it is a simple voltage going from 5% of the ramp's amplitude, to 95% -- it could have been a PWL just as well), while V2 is the ramp generator. Notice I didn't use extreme values like 1ps for the timings, or so, but simply a more relaxed 0.1% of the total period, which works just fine while also not uselessly encumbering the simulation.
.STEPdirective on theTonparameter, as @winny mentions. If you decide to use two sources and a comparator (of your choice), then you can use JohnD's suggestion for a continuous sweep. – a concerned citizen Oct 01 '17 at 06:39