Netlist in LTspice

Discussion in 'General Electronics Chat' started by l0st_l0rd, Apr 29, 2013.

  1. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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.

    Could you please help me with this issue ?
     
  2. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    I don't understand.

    See the attachments.
     
    l0st_l0rd likes this.
  3. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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

    Code ( (Unknown Language)):
    1.  
    2. *black-body-lib
    3. .subckt black_body 12 11 10 params:t=5900
    4. 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))}
    5. .ends black_body
    6.  
    the suncircuit 2 :

    Code ( (Unknown Language)):
    1.  
    2. .subckt wavelength  11 10
    3. Vlambda 11  0  pwl 0.0001u    0.0001
    4. +     0.1u        0.1
    5. +    0.295u    0.295
    6. +    0.305u    0.305
    7. +    0.315u    0.315
    8. +    0.325u    0.325
    9. +    0.335u    0.335
    10. +    0.345u    0.345
    11. +    0.355u    0.355
    12. +    0.365u    0.365
    13. +    0.375u    0.375
    14. +    0.385u    0.385
    15. +    0.395u    0.395
    16. +    0.405u    0.405
    17. +    0.415u    0.415
    18. +    0.425u    0.425
    19. +    0.435u    0.435
    20. +    0.445u    0.445
    21. +    0.455u    0.455
    22. +    0.465u    0.465
    23. +    0.475u    0.475
    24. +    0.485u    0.485
    25. +    0.495u    0.495
    26. +    0.505u    0.505
    27. +    0.515u    0.515
    28. +    0.525u    0.525
    29. +    0.535u    0.535
    30. +    0.545u    0.545
    31. +    0.555u    0.555
    32. +    0.565u    0.565
    33. +    0.575u    0.575
    34. +    0.585u    0.585
    35. +    0.595u    0.595
    36. +    0.605u    0.605
    37. +    0.615u    0.615
    38. +    0.625u    0.625
    39. +    0.635u    0.635
    40. +    0.645u    0.645
    41. +    0.655u    0.655
    42. +    0.665u    0.665
    43. +    0.675u    0.675
    44. +    0.685u    0.685
    45. +    0.695u    0.695
    46. +    0.6983u    0.6983
    47. +    0.7u    0.7
    48. +    0.71u    0.71
    49. +    0.72u    0.72
    50. +    0.7277u    0.7277
    51. +    0.73u    0.73
    52. +    0.74u    0.74
    53. +    0.75u    0.75
    54. +    0.7621u    0.7621
    55. +    0.77u    0.77
    56. +    0.78u    0.78
    57. +    0.79u    0.79
    58. +    0.8u    0.8
    59. +    0.8059u    0.8059
    60. +    0.825u    0.825
    61. +    0.83u    0.83
    62. +    0.835u    0.835
    63. +    0.8465u    0.8465
    64. +    0.86u    0.86
    65. +    0.87u    0.87
    66. +    0.875u    0.875
    67. +    0.8875u    0.8875
    68. +    0.9u    0.9
    69. +    0.9075u    0.9075
    70. +    0.915u    0.915
    71. +    0.925u    0.925
    72. +    0.93u    0.93
    73. +    0.94u    0.94
    74. +    0.95u    0.95
    75. +    0.955u    0.955
    76. +    0.966u    0.966
    77. +    0.975u    0.975
    78. +    0.985u    0.985
    79. +    1.018u    1.018
    80. +    1.082u    1.082
    81. +    1.094u    1.094
    82. +    1.098u    1.098
    83. +    1.101u    1.101
    84. +    1.128u    1.128
    85. +    1.131u    1.131
    86. +    1.144u    1.144
    87. +    1.178u    1.178
    88. +    1.264u    1.264
    89. +    2u            2
    90. +    4u            4
    91.  
    92. .ends wavelength
    93.  

    the circuit : (consider wavelenght another sub circuit)

    Code ( (Unknown Language)):
    1.  
    2. .include black_body.lib
    3. .include wavelength.lib
    4. x_black_body  12 11 0 black_body
    5. x_wavelength 12 0 wavelength
    6.  
    7. .tran 0.1u 4u
    8. .probe
    9. .plot tran v(11)
    10. .end
    11.  
    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
    irradiance in W/m2pm

    The question is that how they plot it !!! how the software understand this !!! I cannot understand it !!! please explain me a bit
     
    • 1.jpg
      1.jpg
      File size:
      181.3 KB
      Views:
      26
    Last edited by a moderator: Apr 30, 2013
  4. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Were you able to get this plot? (attached)
     
    l0st_l0rd likes this.
  5. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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
     
  6. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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 likes this.
  7. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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
     
  8. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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.
     
    l0st_l0rd likes this.
  9. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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
     
  10. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    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 likes this.
  11. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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
     
  12. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    657
    Your punctuation (particularly your exclamation marks) makes reading your posts difficult.

    I still don't understand what your problem is.
     
    l0st_l0rd likes this.
  13. l0st_l0rd

    Thread Starter New Member

    Apr 29, 2013
    12
    0
    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 ?
     
  14. ifixit

    Distinguished Member

    Nov 20, 2008
    639
    108
    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
     
    l0st_l0rd likes this.
Loading...