<@U01732WNM60> the B-source in xschem is called devices/bsource.sym. You can give it any expression ...
s
@Christoph Maier the B-source in xschem is called devices/bsource.sym. You can give it any expression (wrap inside double quotes): the syntax for the FUNC attribute that represents the function that is passed to ngspice is:
FUNC="{expression}"
the braces are ngspice syntax. You can also use single quotes:
FUNC="'expression'"
the example shown in image produces this line;
B1 IOUT 0 V = {OFFSET + AMPLITUDE/2*(tanh(V(IPLUS,IMINUS)*GAIN*2/AMPLITUDE))}
c
During the time it took you to get back to me, I found not only one, but two solutions. First, I remembered https://github.com/MastellaM/sky130_TAC3/blob/tatzelbranch/sensormodels/b_source_magic.sch, lines 33-35. but I also found
devices/asrc.sym
and used it here: https://github.com/tatzelbrumm/sky130_cm_ip__biasgen/blame/main/xschem/test_isweep.sch, line 84. The problem here is not that I don't know how to do B source magic, cf. https://github.com/tatzelbrumm/teachingskilldemo/blame/master/LTspice/TimeVariableCoupling.asc, lines 69 and 72 (sorry, too busy right now trying to meet an arbitrary and capricious chipalooza deadline that could be used as chokepoint to enforce the Welch Matrix, cf.

https://www.12manage.com/images/picture_welch_matrix_performance_values_match.png

, if there is a serious inconsistency between the values of Tim Edwards at ISSCC1998 in Monterey [https://link.springer.com/chapter/10.1007/978-1-4757-6414-7_5] and today's efabless company to fire up LTSpice and endanger the very fragile xschem/ngspice tool chain sharing the same computer to take a screenshot) but that its implementation in
xschem
is inconsistent and subject to change without notice. That makes the various and sundry, inconsistent shotgun parsers [https://langsec.org/brucon/ShotgunParsersBruCON.pdf] in your tool chain (including, prominently, xschem) a chokepoint (by accident or by design, cf. https://chokepointcapitalism.com/) for any reliable, predictable design based on your open source tool chain. Nearly everything that matters is a side effect. — Meredith L. Patterson