Ramp (ramp)
A ramp that rises while a gate is on (slope compensation) or restarts at each clock edge (a clock-synced sawtooth).
Group: Control · Kind: {"block":"ramp","kind":"control"}
When to use it
Use the gate mode for the slope compensation of a peak-current-mode converter: feed it the switch gate and add its output to the sensed current. Use the saw mode for a carrier that follows an external clock. Use carrier for a free-running carrier at a fixed frequency.
Pins
| Pin | Domain | Meaning |
|---|---|---|
in |
signal | Gate input for the gate mode; the ramp runs while it is above 0.5. |
clk |
signal | Clock input for the saw mode; each rising edge across 0.5 restarts the ramp at 0. |
out |
signal | Ramp output. |
Common parameters
mode: Ramp mode:gate(out = se·(t − t_rise) while in is high and 0 while it is low) orsaw(from 0 at each rising edge of clk, reaching vh after 1/f) (Default: gate)se: Slope of the gate-mode ramp (output units per second) (Default: 1)f: Saw mode: the ramp rises at vh·f, so it reaches vh after 1/f (needed in saw mode) (Default: optional (off))vh: Upper limit of the output; the peak in saw mode (needed there), no limit in gate mode while unset (Default: optional (off))
Parameters
| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
mode |
— | gate | Ramp mode: gate (out = se·(t − t_rise) while in is high and 0 while it is low) or saw (from 0 at each rising edge of clk, reaching vh after 1/f) |
|
se |
1/s | 1 | Slope of the gate-mode ramp (output units per second) | |
f |
Hz | optional (off) | Saw mode: the ramp rises at vh·f, so it reaches vh after 1/f (needed in saw mode) | |
vh |
— | optional (off) | Upper limit of the output; the peak in saw mode (needed there), no limit in gate mode while unset |
Parameter descriptions are in English in both languages.
Model
In gate mode the output is se*(t - t_rise) while in is above 0.5, with t_rise the step at which it rose, and 0 while it is low; it is limited to vh when that is set. In saw mode the output starts at 0 at t = 0 and at every rising edge of clk, rises at vh*f (so it reaches vh after 1/f) and stays at vh until the next edge. The ramp is computed at each solver step; the edges come from the input, so a pwm gate gives exact edge times. The block has no direct feedthrough (its output is 0 at a rising edge whatever it reads), so a latch that gates its own slope, as in peak current mode, closes a loop through it: inside such a loop it reads the previous step, which delays only the reset at the falling edge by one step.
Common mistakes
- The slope
seis in output units per second. For slope compensation that is the sensed-current slope in V/s (current slope times the sense gain); a value of a few volts is a slope a million times too small. Half the inductor down-slope or more stops subharmonic oscillation above 50 % duty. - In
sawmodefandvhare both needed: the run stops with an error naming the block if one is missing. With no clock wired the saw rises once from t = 0 and then holds atvh.
Datasheet and sources
For slope compensation take the slope from the controller datasheet (the internal ramp amplitude over the switching period) or from Se >= Rsense*Vout/(2L) for a buck. For the saw mode f is the nominal switching frequency.
Example
Open the example with the command file.openExample and the name demo:ramp.
Generated by cargo xtask reference from the usage texts and parameter specs. Do not edit by hand.