Problem with current sense and Bcurrent I=()

I have .subckt netlist for a PELTIER element which is working as a charm in LTspice and also in Qspice if I draw the schematics directly

Drawn extensively, it works but gives a simple warning

Warning: No such function: “i()”

But when I want to create a symbol in Qspice, there is a fatal error

Fatal error: Syntax error in source expression abs•x1(i(vpos•x1)(rp•x1i(vpos•x1)+{se•x1}*(v(1•x1)-v(2•x1)))

The problem occured while parsing the line:

BPE 0 1 I=ABS(I(VPOS)(RPI(VPOS)+{SE}*(V(1)-V(2)))

I’m pretty sure I do nothing wrong here as I(vpos) is a measuring current of a OV source and also as I already told, it works in LT and also in Q but only when I ‘m drawing extensively the netlist in Qspice

Could you kindly examine my netlist and give me a hint on how to change it

Thanks in advance

Best regards

Alain

this is the netlist


  • SIMULATION OF MEASURING SYSTEM

  • TAMB = AMBIENT TEMPERATURE

  • SE = SEEBECK CONSTANT


  • modified for Qspice 02 oct 2023 from:

*SPICE model of thermoelectric elements including thermal effects

*February 2000Conference Record - IEEE Instrumentation and Measurement Technology Conference 2:1019 - 1023 vol.2

*DOI: 10.1109/IMTC.2000.848895

*SourceIEEE Xplore

*Conference: Instrumentation and Measurement Technology Conference, 2000. IMTC 2000. Proceedings of the 17th IEEEVolume: 2


******** THERMAL CIRCUIT ********


*** HEAT SINK ***

.subckt PELTIER4 H C I1 I2 Tambient OTC

.param SE=0.05292 Rp=1.806 Tinit=25

.IC V(1)={Tinit+273.15} V(2)={Tinit+273.15} V(3)={Tinit+273.15} V(4)={Tinit+273.15} V(OTC)={Tinit+273.15}

B2 3 0 V=V(Tambient)+273.15

RKRAD 4 3 0.34

CRAD 4 GND 340

RSILH 4 1 0.143

*** THERMAL PELTIER MODEL ***

CH 1 0 2

BPE 0 1 I=abs(I(VPOS)(RPI(VPOS)+{SE}*(V(1)-V(2)))

RKM 1 2 1.768

BPX 2 1 I=I(VPOS)*( {SE}V(1)-{RP}/2I(VPOS))

CC 2 0 2

*** THERMAL MASS ***

RSILC OTC 2 0.143

CCONINT OTC 0 304

RCONINT OTC 3 3.1

B3 H 0 V=V(4)-273.15

B4 C 0 V=V(OTC)-273.15


******** ELECTRICAL CIRCUIT ********


*** ELECTRICAL PELTIER MODEL ***

VPOS I1 13 0

RM 13 12 {Rp}

BALPHA 12 0 V={SE*(V(1)-V(2))}

.ENDS


I apologize to the community because it was a debutant typo : a parameter without {}. Nevertheless , with that correction in the definition of BPE ({Rp}) , the simulation works but there is still a warning that I do not understand

Warning: No such function: “i()”
Warning: No such function: “i()”
Warning: Error: Node voltages such as V(n01) can not be used in netlist parameter expressions because these parameters are evaluated before the simulation starts.

Despite these warnings, the simulation with this .subckt works well.

the final word: if you define an ABS I= f() with parameters in it ,use I = f( { param} , V(no1)) and not I ={ f(V(no1), param )}. The warning disappears. The expression I ={ f(V(no1), param )} is often seen in netlists for Pspice.

This is the formula I quote from your first message

BPE 0 1 I=abs(I(VPOS)*(RP* I(VPOS)+{SE}*(V(1)-V(2)))

If just review the formula you mentioned, a bracket seems missing. I can run this formula with B current source format by adding a bracket at the end.

For .subckt, to prevent auto format change in forum, suggest to select “Preformatted text” and paste .subckt and formula in there.

Thanks a lot for having taken the time to respond, Sir. Yes there was an amateur mistake in my netlist but at the end, it helped to understand that the expression BPE 0 1 I ={ Rp*(V(1)-V(2))} is causing a warning in Qspice , while BPE 0 1 I={Rp} *(V(1)-V(2)) not. In LTspice, I didn’t have such problem. This is thus fully solved. I decided to stop to try to import all my LTspice devices in Qspice but instead, I will be better to re-write them from scratch. It’s much more helpful at the end and maybe this way discover other things. Thanks.

Actually, one feature in Qspice is elimination of curly bracket for parameter and formula.
For example, you can try BPE 0 1 I=Rp *(V(1)-V(2)) and it should run fine.