Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write .subckt with I-V function

Solved!
Go to solution

Hi All,

 

I am now trying to build a Spice model for a type of high-voltage LED for Multisim 13. Because I do not have electronic parameters of the LED, and I only have the I-V function of it, I tried to write a .subckt file for it.

 

Assuming the anode is A1 and cathode is A2, the current through the LED can be expressed as by the function:

I=((0.581*(V(A1)-V(A2))*(V(A1)-V(A2))/3/3-18.4*(V(A1)-V(A2))/3+144.66)/1000)*U((V(A1)-V(A2))-53)

 

With it, I wrote a .subckt:

.SUBCKT LED A1 A2
B1 A1 A2 I=((0.581*(V(A1)-V(A2))*(V(A1)-V(A2))/3/3-18.4*(V(A1)-V(A2))/3+144.66)/1000)*U((V(A1)-V(A2))-53)
.ENDS LED

 

This model works well under IV analyzer in Multisim 13, but when I connect 2 or 3 of them in series and run a simple circuit simulation, I always get error report and always failed to fix the error.

 

Can any body help me check if my .subckt is correct or not? Thank you.

0 Kudos
Message 1 of 9
(6,191 Views)

Please post the circuit with the error.

Tien P.

National Instruments
0 Kudos
Message 2 of 9
(6,172 Views)

Hi Tien,

 

This is the circuit, it is just a simple AC LED circuit. 

kkkkkkkk.jpg

 

The error is

error.jpg

 

Thanks. Is there anything wrong with the .subckt script?

 

0 Kudos
Message 3 of 9
(6,170 Views)

Save the Multisim file and attach it to your post there are settings in your file doesn't doesn't appear in a screen shot.

Tien P.

National Instruments
0 Kudos
Message 4 of 9
(6,168 Views)

Hi Tien, this is the Multisim file. The LEDs are built by the .subckt script:

 

.SUBCKT SAW8K A1 A2
B1 A1 A2 I=((0.581*(V(A1)-V(A2))*(V(A1)-V(A2))/3/3-18.4*(V(A1)-V(A2))/3+144.66)/1000)*U((V(A1)-V(A2))-53)
.ENDS SAW8K

 

The U() function is a step function. 

 

Thank you very much.

0 Kudos
Message 5 of 9
(6,161 Views)

Considering that with real, physical devices, all the LEDs would be destroyed on the first cycle of the input signal, It is not too surprising that the simulation might have problems also.

 

Although your formula has a much slower increase in current than the typical exponential relationship, the peak power in one LED is over 70 watts.

 

Lynn

0 Kudos
Message 6 of 9
(6,158 Views)

Hi Lynn,

 

The LED model is for high-voltage LEDs, with typical forward voltage @ 66V and current 20mA. The LED turns on at 53V. Thanks.

0 Kudos
Message 7 of 9
(6,156 Views)
Solution
Accepted by topic author skywarrior340

It looks like the convergence error is caused by a discontinuity across the diode at about 53V.  Run DC sweep using the test circuit.

DC operating point.PNG

 

 

To prevent the discontinuity, use the following express with the if function instead. You can give it a small current when V (A1, A2) is less than 0V.

 

B1 A1 A2 I=if(((V(A1)-V(A2))-51)>0,((0.581*(V(A1)-V(A2))*(V(A1)-V(A2))/3/3-18.4*(V(A1)-V(A2))/3+144.66)/1000),-230u)

 

The attached circuit have a resistor to help convergence.

 

You may want to simplify your expression for readability:

- (V(A1)-V(A2)) = V(A1,A2) 

- if you can make the expression in this form it will simply the calculation ax^2 + bx + c

 

Tien P.

National Instruments
Download All
0 Kudos
Message 8 of 9
(6,095 Views)

Hi Tien,

 

Thank you so much for this. It works well in the Multisim. Thank you.

 

Jianchuan

0 Kudos
Message 9 of 9
(6,082 Views)