# Netlist in LTspice

#### l0st_l0rd

Joined Apr 29, 2013
12
Hi
I have problem with writing a specific netlist in LTspice.
As you know LTSpice has only the possiblity of showing the diagrams in some specific parameters such as Voltage and time (different kind of analysis).
I want to define a some new elements (sub circuits) and see the changes in diagram while the X and Y axis are showing the new parameters.
for example I want to define a sub circuit for wave length and irradiance and see the changes in diagrams and it does not matter that what are the units in the axis but it is important that it acts. for example I see v in one axis but it is actually Irradiance !

another problem :
I want to see the axis in parameters which are known for LTSpice. For example I want to see the Power vs Resistance in Ltspice.

#### Ron H

Joined Apr 14, 2005
7,014
Hi
I have problem with writing a specific netlist in LTspice.
As you know LTSpice has only the possiblity of showing the diagrams in some specific parameters such as Voltage and time (different kind of analysis).
I want to define a some new elements (sub circuits) and see the changes in diagram while the X and Y axis are showing the new parameters.
for example I want to define a sub circuit for wave length and irradiance and see the changes in diagrams and it does not matter that what are the units in the axis but it is important that it acts. for example I see v in one axis but it is actually Irradiance !
I don't understand.

another problem :
I want to see the axis in parameters which are known for LTSpice. For example I want to see the Power vs Resistance in Ltspice.

See the attachments.

#### Attachments

• 22 KB Views: 31
• 401 bytes Views: 18

#### l0st_l0rd

Joined Apr 29, 2013
12
Dear Ron

Thank you very much for the file and it really helps.
The first part, I mean, I want to make a new element with netlist. I consider Wavelenght and Irradiance. It is possible to define these elements with some parameters and functions and expressions. The point is that the SPICE only knows the electrical parameters which are defined for it as default such as R V I ... .
After Making this elements I want to see these 2 elements on diagram. I have seen in some netlists that I draw these with electrical parameters but they are in fact the new elements
Here you can see that :

the subcircuit

Rich (BB code):
*black-body-lib
.subckt black_body 12 11 10 params:t=5900
e_black_body 11 10 value={8.925e-12/(((v(12)*1e-6)**5)*(t**4)*(exp(0.0143/(v(12)*1e-6*t))-1))}
.ends black_body
the suncircuit 2 :

Rich (BB code):
.subckt wavelength  11 10
Vlambda 11  0  pwl 0.0001u    0.0001
+     0.1u        0.1
+    0.295u    0.295
+    0.305u    0.305
+    0.315u    0.315
+    0.325u    0.325
+    0.335u    0.335
+    0.345u    0.345
+    0.355u    0.355
+    0.365u    0.365
+    0.375u    0.375
+    0.385u    0.385
+    0.395u    0.395
+    0.405u    0.405
+    0.415u    0.415
+    0.425u    0.425
+    0.435u    0.435
+    0.445u    0.445
+    0.455u    0.455
+    0.465u    0.465
+    0.475u    0.475
+    0.485u    0.485
+    0.495u    0.495
+    0.505u    0.505
+    0.515u    0.515
+    0.525u    0.525
+    0.535u    0.535
+    0.545u    0.545
+    0.555u    0.555
+    0.565u    0.565
+    0.575u    0.575
+    0.585u    0.585
+    0.595u    0.595
+    0.605u    0.605
+    0.615u    0.615
+    0.625u    0.625
+    0.635u    0.635
+    0.645u    0.645
+    0.655u    0.655
+    0.665u    0.665
+    0.675u    0.675
+    0.685u    0.685
+    0.695u    0.695
+    0.6983u    0.6983
+    0.7u    0.7
+    0.71u    0.71
+    0.72u    0.72
+    0.7277u    0.7277
+    0.73u    0.73
+    0.74u    0.74
+    0.75u    0.75
+    0.7621u    0.7621
+    0.77u    0.77
+    0.78u    0.78
+    0.79u    0.79
+    0.8u    0.8
+    0.8059u    0.8059
+    0.825u    0.825
+    0.83u    0.83
+    0.835u    0.835
+    0.8465u    0.8465
+    0.86u    0.86
+    0.87u    0.87
+    0.875u    0.875
+    0.8875u    0.8875
+    0.9u    0.9
+    0.9075u    0.9075
+    0.915u    0.915
+    0.925u    0.925
+    0.93u    0.93
+    0.94u    0.94
+    0.95u    0.95
+    0.955u    0.955
+    0.966u    0.966
+    0.975u    0.975
+    0.985u    0.985
+    1.018u    1.018
+    1.082u    1.082
+    1.094u    1.094
+    1.098u    1.098
+    1.101u    1.101
+    1.128u    1.128
+    1.131u    1.131
+    1.144u    1.144
+    1.178u    1.178
+    1.264u    1.264
+    2u            2
+    4u            4

.ends wavelength

the circuit : (consider wavelenght another sub circuit)

Rich (BB code):
.include black_body.lib
.include wavelength.lib
x_black_body  12 11 0 black_body
x_wavelength 12 0 wavelength

.tran 0.1u 4u
.probe
.plot tran v(11)
.end
now the diagram is the attachement
and they have written this message below :

Black body spectral irradiance at 5900K (middle) compared with AM0 spectral irradiance
(upper) and AM1.5 (lower). Warning, x-axis is the wavelength in pm and the y-axis is the spectral

The question is that how they plot it !!! how the software understand this !!! I cannot understand it !!! please explain me a bit

#### Attachments

• 181.3 KB Views: 28
Last edited by a moderator:

#### Ron H

Joined Apr 14, 2005
7,014
Were you able to get this plot? (attached)

#### Attachments

• 15.3 KB Views: 28

#### l0st_l0rd

Joined Apr 29, 2013
12
yeah I get this but I cannot understand how it could define that these can be shown in the diagram !!! my problem is in the main circuit ! how to show these subcircuits in the diagram

#### Ron H

Joined Apr 14, 2005
7,014
yeah I get this but I cannot understand how it could define that these can be shown in the diagram !!! my problem is in the main circuit ! how to show these subcircuits in the diagram
I meant, were you able to run the simulation and plot V(11) in LTspice?
You won't be able to have a schematic representation of the circuit until you create subcircuit schematics and a top level schematic. No simulator can create a schematic from a netlist.

#### l0st_l0rd

Joined Apr 29, 2013
12
I don't mean Schematics ! I mean the diagram ! I don't want to extract schematics from the netlist I just want to know how I can adjust a parameter as a variable in diagram axis

#### Ron H

Joined Apr 14, 2005
7,014
I don't mean Schematics ! I mean the diagram ! I don't want to extract schematics from the netlist I just want to know how I can adjust a parameter as a variable in diagram axis
You can left-click on either axis to bring up a window that will allow you to change the quantity plotted. See the attachment.

If that won't do what you want, I suggest you edit the plot with something like Microsoft Paint.

#### Attachments

• 14.4 KB Views: 23

#### l0st_l0rd

Joined Apr 29, 2013
12
You can left-click on either axis to bring up a window that will allow you to change the quantity plotted. See the attachment.

If that won't do what you want, I suggest you edit the plot with something like Microsoft Paint.
Thank you very much it seems that I should work more on the first post that you put a sample while I want to put the element that I want as the parameter in the axis
Irradiance vs wavelenght !
the point is that I cannot understand how I can define it to the software

#### Ron H

Joined Apr 14, 2005
7,014
Thank you very much it seems that I should work more on the first post that you put a sample while I want to put the element that I want as the parameter in the axis
Irradiance vs wavelenght !
the point is that I cannot understand how I can define it to the software
THe original plot you posted was of voltage vs time. Whoever created it did not label it as irradiance vs wavelength.
LTspice gives you voltage vs time. I don't see any way to label it with irradiance vs wavelength.

#### l0st_l0rd

Joined Apr 29, 2013
12
the lable is not important ! I cannot understand how it works when I have two sub circuits and I plot those suncircuits versus each other !!! in any lable !but correct values

#### Ron H

Joined Apr 14, 2005
7,014
the lable is not important ! I cannot understand how it works when I have two sub circuits and I plot those suncircuits versus each other !!! in any lable !but correct values

I still don't understand what your problem is.

#### l0st_l0rd

Joined Apr 29, 2013
12
Dear Ron I am so sorry for the writing style I will take it into consider. I almost gave up the previous challenge and now I have a new problem.
I have many resistances in the circuit which I have defined their value by some parameters.
Now, I want to calculate the total resistance and each group of resistances in my circuit.

exampel :
.param rx=1
.param rc=2
.param rv=3
r1 node node {rx}
r2 node node {rx}
r3 node node {rx}

ra node node {rc}
rb node node {rc}
rc node node {rc}

rm node node {rv}
rn node node {rv}
ro node node {rv}

and now I want to "measure" sum of the values of a new parameter rp=r1+r2+r3 and another new parameter rj=ra+rb+rc and ri=rm+rn+ro as well and a new parameter rh=rp+rj+ri

the goal here is only to have the values. I used .meas, ,func and .param but seems that I have a problem and cannot get the answer. Could you please help me with this problem ?

#### ifixit

Joined Nov 20, 2008
650
Hi l0st_l0rd,

I have created a schematic to show wavelength vs irradiance LT style, I hope you can see how it works better, but I'm not sure it is what you are after.

The wavelength data comes from a text file into V1 and can be changed if required. A behavioral voltage source (B1) interprets the wavelength data with the formula given in post #3. The irradiance is the voltage produced by the behavioral source.

You can add two more behavioral sources for the other two wave forms. The data for them was not given in post #3.

The .plt file formats the waveform display, but you can change it.

The parameter.asc file answers post #13 ... I think.

Have Fun,
Ifixit

#### Attachments

• 1.8 KB Views: 9
• 208.7 KB Views: 22