Version 4 SHEET 1 1172 680 WIRE -128 176 -128 112 WIRE 16 112 -128 112 WIRE 16 240 16 112 WIRE 16 368 16 240 WIRE 16 496 16 368 WIRE 48 112 16 112 WIRE 96 112 48 112 WIRE 96 240 16 240 WIRE 96 368 16 368 WIRE 96 496 16 496 WIRE 464 240 96 240 FLAG -128 256 0 FLAG 96 192 0 FLAG 48 112 x FLAG 96 320 0 FLAG 96 448 0 FLAG 96 576 0 FLAG 464 320 0 SYMBOL voltage -128 160 R0 WINDOW 123 0 0 Left 0 WINDOW 39 24 132 Left 0 SYMATTR InstName V1 SYMATTR Value 0 SYMBOL bi 96 112 R0 SYMATTR InstName B1 SYMATTR Value I=cpwr1(pwr,Imax,Va,Vb,V(x)) SYMBOL bi 96 240 R0 WINDOW 0 37 20 Left 0 SYMATTR InstName B2 SYMATTR Value I=cpwr2(pwr,Imax,Va,Vb,V(x)) SYMBOL bi 96 368 R0 WINDOW 0 30 7 Left 0 SYMATTR InstName B3 SYMATTR Value I=cpwr3(pwr,Imax,Va,Vb,V(x)) SYMBOL bi 96 496 R0 SYMATTR InstName B4 SYMATTR Value I=cpwr4(pwr,Imax,Va,Vb,V(x)) SYMBOL res 448 224 R0 WINDOW 3 24 2 Left 0 SYMATTR Value R=V(x)/cpwr2(pwr,Imax,Va,Vb,V(x)) SYMATTR InstName R2 TEXT -136 -256 Left 0 !.params: pwr=10W Imax=5A Vb=pwr/Imax ;Vb always calculated!\n.params: Va=Vb/5 ;Va is arbitrary, but 0 < Va <= Vb ! TEXT -154 330 Left 0 !.dc V1 -5 5 .01 TEXT -136 -56 Left 0 !;-as cpwr1, alt. formula similar to analogspiceman/yahoo, for positive Vx\n.func cpwr3(pwr,Imax,Va,Vb,Vx) {limit(if(Vx>Vb,pwr/Vx,Imax*Vx/Va),Imax,0)} TEXT -136 24 Left 0 !;-as cpwr2,alt. formula, for pos. & neg. Vx\n.func cpwr4(pwr,Imax,Va,Vb,Vx) {limit(if(ABS(Vx)>Vb,pwr/ABS(Vx),Imax*ABS(Vx/Va)),Imax,0)*SGN(Vx)} TEXT -136 -192 Left 0 !;-only values Vx>0 give current >0\n.func cpwr1(pwr,Imax,Va,Vb,Vx) {if(Vx>0,if(Vx TEXT 608 368 Left 0 ;0V --- voltage Vx --> TEXT 568 352 Left 0 ;0A-> TEXT 488 192 Left 0 ;Alternative Syntax using R LINE Normal 672 288 784 288 LINE Normal 624 352 672 288 ARC Normal 768 352 1072 112 779 310 915 362