Description of gsim: Rozdiel medzi revíziami

Z Kiwiki
Skočit na navigaci Skočit na vyhledávání
 
(18 medziľahlých úprav od rovnakého používateľa nie je zobrazených.)
Riadok 2: Riadok 2:
 
''gsim'' is simulation pre/post processor for [http://www.gpleda.org/tools/gschem/index.html gschem], [http://ngspice.sourceforge.net/ ngspice] and [http://matplotlib.sourceforge.net/ matplotlib] based on Python. Allows easy control of simulation process directly from the circuit in ''gschem'' or interactively in Python environment.
 
''gsim'' is simulation pre/post processor for [http://www.gpleda.org/tools/gschem/index.html gschem], [http://ngspice.sourceforge.net/ ngspice] and [http://matplotlib.sourceforge.net/ matplotlib] based on Python. Allows easy control of simulation process directly from the circuit in ''gschem'' or interactively in Python environment.
  
''gsim'' contains a set of predefined components for ''gschem'' and python scripts 
+
'''A. Standard simulation''' - simulation is controlled directly from ''gschem'' (see [[Príklady_a_úlohy_pre_gsim | examples]])
* for simple graphic output directly from ''gschem'' - instant graphic components  
+
<center>
** plotter for amplitude-phase characteristic  
+
{|class="wikitable"
** 2/4 channel analog scope
+
| align="center" width=500 | [[Súbor:0558_comp.png | 500px]]
** digital scope, x/y parametric scope
+
|-
* for input of analog and digital blocks of XSpice simulator. Enables the creation of hybrid models, consisting of discrete, block and logic components and their use as regular components in gschem.
+
| align="center" width=500 | '''Example - gEDA/gschem circuit diagram'''
 +
|}
 +
</center>
 +
 
 +
<center>
 +
{|class="wikitable"
 +
| align="center" width=500 | [[Súbor:0558_comp_1.png | 500px]]
 +
|-
 +
| align="center" width=500 |'''Example - Simulation result, defined by A2'''
 +
|}
 +
</center>
 +
 
 +
''gsim'' contains a set of predefined components (see [[Knižnica komponentov gsim | list of components ]])
 +
* for simple graphic output directly from ''gschem'' - instant graphic components a.e.
 +
** [[Plot_4ap_log | amplitude-phase characteristic ]] plotter
 +
** [[Plot_4Y | 4 channel analog scope]]
 +
** [[Plot_Y2 | 2 channel analog recorder]]
 +
** [[Plot_xy | 2D xy parametric scope]]
 +
** [[Plot_zyx | 3D xyz parametric scope]]
 +
** [[Plot_Y4D | 4 channel digital recorder]]
 +
** 8 channel digital recorder
 +
* for input of analog and digital blocks of XSpice simulator. Enables the creation of hybrid models, consisting of discrete, block and logic components and their use as regular components in ''gschem''.
 +
 
 +
 
 +
'''B. Python scripting''' - simulation is controlled from Python language/enviroments (eg. [http://ipython.scipy.org/moin/ IPython], [http://www.geany.org/ Geany] )
 +
<source lang="python" line>
 +
...
 +
from gsim import *
 +
g=gsim('file_name.sch')      # load gschem file in to simulator
 +
g.netlist()                  # create and update netlist
 +
 
 +
for i in arange(1e-5, 10e-5, 1e-5): 
 +
g.setPAR('IB',i)          # update parameter in netlist
 +
g.sim()                    # repeat sumulation
 +
ic=g.yData.get('v(ic)')    # extract data from simulation in to python enviroment
 +
plt.plot(g.xData,ic)      # data processing in python
 +
        ...
 +
</source>
 +
 
 +
''gsim'' contains a set of predefined Python scripts (see [[Charakteristiky NPN tranzistora | example]])
 +
* in interactive mode substitutes parameters of components (functions setPAR, setTRAN, setAC …)
 +
* set of inherited classes for easy data manipulation (simulation results) in the interactive mode
 +
 
 +
 
 +
'''Additional Python functions'''
 
* simple *.sch files parser
 
* simple *.sch files parser
 
** generates list of a part of the schematics (components, connections...)
 
** generates list of a part of the schematics (components, connections...)
 
* *.net file parser with preferences
 
* *.net file parser with preferences
** allow use of real components in the simulation
+
** allow use of '''real''' components in the simulation, corrects the order of pins for the simulation by real pin name (eg diode - Anode, Anoda, AN, A), eliminates problems with different components for simulation and  real proposal of the circuit
** corrects the order of pins for the simulation by real pin name (eg diode - Anode, Anoda, AN, A), eliminates problems with different components for simulation and  real proposal of the circuit
 
 
** generates block models for XSpice in their specific format based on the components attributes
 
** generates block models for XSpice in their specific format based on the components attributes
  
* in interactive mode substitutes parameters of components (functions setPAR, setTRAN, setAC …)
+
[[4-bitový_binárny_čítač | Example]] - original line from Spice netlist file for D flip-flop
* set of referenced classes gsim_PLOT for implementing instant-graphic components
+
A4 6 4 5 5 7 6 D_DFF
* set of inherited classes for easy data manipulation (simulation results) in the interactive mode
+
 
 +
Part of expanded netlist by ''gsim'' for XSpice simulation, based on ''gschem'' [[D_dff | D_DFF]] component  attributes
 +
 
 +
* >>><<< A4 6 4 5 5 7 6 D_DFF
 +
A4 6 4 5 5 7 6 D_DFF_A4
 +
.MODEL D_DFF_A4 D_DFF (
 +
  + rise_delay=1.0e-9
 +
  + fall_delay=1.0e-9
 +
  + set_load=1.0e-12
 +
  + reset_load=1.0e-12
 +
  + data_load=1.0e-12
 +
  + clk_load=1.0e-12
 +
  + reset_delay=1.0e-12
 +
  + ic=0
 +
  + clk_delay=1.0e-9
 +
  + set_delay=1.0e-9 )  
 +
 
 +
'''[[Simulácie_a_modelovanie | Download]]''' contains
 +
* Python source code
 +
* Examples - Small set of gsim examples  - analog,digital, mixed, hybrid for testing of functionality
 +
* Component library - Selected set of Spice and Xspice components.
 +
* Models - Small set of Spice/Xspice models and macromodels
  
 
''gsim'' is in an early experimental version, it is intensively tested and continuously developed. Please notice, this is conceptual proposal which will be extended in the future.
 
''gsim'' is in an early experimental version, it is intensively tested and continuously developed. Please notice, this is conceptual proposal which will be extended in the future.
  
Thanks to the authors of gEDA project, ngspice, matplotlib, python, and scipy, only thank to their superior and excellent work, it was possible to integrate all components into a compact system, usable at the present time.
+
''itPK - Team''
 +
 
  
itPK - Team
+
<center>
 +
[[Súbor:Obrazovka.png | 640px]]
 +
</center>

Aktuálna revízia z 07:12, 24. júl 2011

gsim is simulation pre/post processor for gschem, ngspice and matplotlib based on Python. Allows easy control of simulation process directly from the circuit in gschem or interactively in Python environment.

A. Standard simulation - simulation is controlled directly from gschem (see examples)

0558 comp.png
Example - gEDA/gschem circuit diagram
0558 comp 1.png
Example - Simulation result, defined by A2

gsim contains a set of predefined components (see list of components )


B. Python scripting - simulation is controlled from Python language/enviroments (eg. IPython, Geany )

 1 ...
 2 from gsim import *
 3 g=gsim('file_name.sch')       # load gschem file in to simulator
 4 g.netlist()                   # create and update netlist 
 5 
 6 for i in arange(1e-5, 10e-5, 1e-5):   
 7 	g.setPAR('IB',i)           # update parameter in netlist
 8 	g.sim()                    # repeat sumulation
 9 	ic=g.yData.get('v(ic)')    # extract data from simulation in to python enviroment
10 	plt.plot(g.xData,ic)       # data processing in python
11         ...

gsim contains a set of predefined Python scripts (see example)

  • in interactive mode substitutes parameters of components (functions setPAR, setTRAN, setAC …)
  • set of inherited classes for easy data manipulation (simulation results) in the interactive mode


Additional Python functions

  • simple *.sch files parser
    • generates list of a part of the schematics (components, connections...)
  • *.net file parser with preferences
    • allow use of real components in the simulation, corrects the order of pins for the simulation by real pin name (eg diode - Anode, Anoda, AN, A), eliminates problems with different components for simulation and real proposal of the circuit
    • generates block models for XSpice in their specific format based on the components attributes

Example - original line from Spice netlist file for D flip-flop

A4 6 4 5 5 7 6 D_DFF

Part of expanded netlist by gsim for XSpice simulation, based on gschem D_DFF component attributes

* >>><<< A4 6 4 5 5 7 6 D_DFF
A4 6 4 5 5 7 6 D_DFF_A4
.MODEL D_DFF_A4 D_DFF (
  + rise_delay=1.0e-9
  + fall_delay=1.0e-9
  + set_load=1.0e-12
  + reset_load=1.0e-12
  + data_load=1.0e-12
  + clk_load=1.0e-12
  + reset_delay=1.0e-12
  + ic=0
  + clk_delay=1.0e-9
  + set_delay=1.0e-9 ) 

Download contains

  • Python source code
  • Examples - Small set of gsim examples - analog,digital, mixed, hybrid for testing of functionality
  • Component library - Selected set of Spice and Xspice components.
  • Models - Small set of Spice/Xspice models and macromodels

gsim is in an early experimental version, it is intensively tested and continuously developed. Please notice, this is conceptual proposal which will be extended in the future.

itPK - Team


Obrazovka.png