KicadtoNgspice component

Note

Source : /src/kicadtoNgspice/KicadtoNgspice.py

class kicadtoNgspice.KicadtoNgspice.MainWindow(*args: Any, **kwargs: Any)
  • This class create KicadtoNgspice window.

  • And Call Convert function if convert button is pressed.

  • The convert function takes all the value entered by user and create a final netlist “*.cir.out”.

  • This final netlist is compatible with Ngspice.

  • clarg1 is the path to the .cir file

  • clarg2 is either None or “sub” depending on the analysis type

callConvert()
  • This function called when convert button clicked

  • Extracting data from the objs created above

  • Pushing this data to xml, and writing it finally

  • Written to a …_Previous_Values.xml file in the projDirectory

  • Finally, call createNetListFile, with the converted schematic

createMainWindow()
  • This function create main window of KiCad to Ngspice converter

  • Two components
    • createcreateConvertWidget

    • Convert button => callConvert

createNetlistFile(store_schematicInfo, plotText)
  • Creating .cir.out file

  • If analysis file present uses that and extract
    • Simulator

    • Initial

    • Analysis

  • Finally add the following components to .cir.out file
    • SimulatorOption

    • InitialCondOption

    • Store_SchematicInfo

    • AnalysisOption

  • In the end add control statements and allv, alli, end statements

createSubFile(subPath)
  • To create subcircuit file

  • Extract data from .cir.out file

createcreateConvertWidget()
  • Contains the tabs for various convertor elements
    • Analysis => obj_analysis

    => Analysis.Analysis(path_to_projFile)

    • Source Details => obj_source

    => Source.Source(sourcelist,`sourcelisttrack`,`path_to_projFile`)

    • NgSpice Model => obj_model

    => Model.Model(schematicInfo,`modelList`,`path_to_projFile`)

    • Device Modelling => obj_devicemodel

    => DeviceModel.DeviceModel(schematicInfo,`path_to_projFile`)

    • Subcircuits => obj_subcircuitTab

    => SubcircuitTab.SubcircuitTab(schematicInfo,`path_to_projFile`)

    • Microcontrollers => obj_microcontroller

    => Model.Model(schematicInfo, microcontrollerList, self.clarg1)

  • Finally pass each of these objects, to widgets

  • convertWindow > mainLayout > tabWidgets > AnalysisTab, SourceTab …