# B sources (common examples)

When, why and how to use tripdt and tripdv with explanation

How to make a discretized (pseudo-digital) source

Various kinds of output limiters (tanh, limit, etc.) and explain why and where these are well worth using

Show how to convert a BV source into an equivalent BI source (with parallel capacitor) and explain why this is generally a much better form to use

other??

I've got an equation in an arbitrary behavioral source that uses the variable *TIME* to plot.  What I can't figure out is how to cause this to repeat at some interval.

Time is a ramp that never resets.  What you need is a replacement for time in your equation that resets to zero at your repeat interval, i.e., a sawtooth function.

You could set up a standalone voltage source to make the sawtooth and replace "time" in your equation with the sawtooth node, "v(x)" or you could do this directly in the equation by replacing "time" with either of the following expressions:

• time-int(time/m)*m ; where m is the modulus (repeat interval)
• idtmod(1,0,m) ; integrates 1*dt with 0 offset at modulus m

If you want, you could define such expressions with a .function statement in order to keep your b-source equation from getting too messy.

```.function a(m)= time-int(time/m)*m
.func b(m)= idtmod(1,0,m) ; .func is the short name
.param r=4 ; r is the actual reset modulus you wish to use
```

Now, within your b-source equation, you could replace each instance of "time" with either "a(r)" or "b(r)" (or change the names to suit what makes sense to you).