If_keyword in Qspice

Can we use if statement in Qspice, like it is done in Ltspice. If yes where can i find this in documentation page?

Example below of arbitrary voltage source in Ltspice

  • Voltage source Vgs2c
    Vgs2c g2c s2 V=if(V(B2,B1) > V(B2)/2 + tol, Vdischarge_c, if(V(B2,B1) < V(B2)/2 - tol, Vcharge_c, 0))

You can use if, but your source should be B-source (your netlist is V source). I don’t think SPICE support if statement in V or I sources.

For B-source (Behavioral Source), goto Qspice Help > Simulator > Device Reference > B. Behavioral Sources

How are you saying my source is V source not B source.???

Syntax for behavioral sources mentioned in Qspice:
B. Behavioral voltage or current source.

Bnnn n001 n002 V= [ic=] [Rser=] ; Arbitrary voltage source

Your netlist with a source begin with a letter V, and this is a V-source
image

Type B to get a B-source, type B multiple time can get a voltage or current symbol from B-source.