dut_ngspice module
Manages simulations with NGSpice.
A DuT can be supplied using the input_circuit parameter. This parameter can be:
InpCircuit
String with path to a netlist of a circuit
String with the netlist of a circuit
List with paths to netlists or strings with netlists, these will be combined using copy-paste into the netlist to simulate.
DutAds allows loads from other files. In order to keep the Hash-System the content of these loaded files are added to the DuTs hash. Loades can be:
list_append
: Absolute path to a load file. The file will be loaded using the absolute path at the begin of the netlist.list_import
: Absolute or relative path files will be copied into the simulation folder and also loaded at the begin of the netlist.
This can be used for Verilog files. The correct load of ADS is determined by file ending.
- class DMT.ngspice.dut_ngspice.DutNgspice(database_dir, dut_type, input_circuit, name='ngspice_', simulator_options=None, simulator_command=None, simulator_arguments=None, initial_conditions={}, command_openvaf=None, copy_va_files=False, inp_name='ngspice_circuit.ckt', va_maps=[], **kwargs)[source]
Bases:
DutCircuit
Class description and methods
- Parameters:
- database_dir
str
This is the directory were the DUT will create its database.
- name
str
Prefix for the database
- dut_type
DutType
Type of the DUT.
- nodes
str
Strings with comma separated node names of DUT. If nodes is None, nodes will be requested from Dut_type class.
- input_circuit
str
,list
[str
]or
Circuit
- copy_va_files{
False
,True
} If True, all given VA-files are copied to the simulation directory and compiled there. If False, the VA-Files have to be given as a global path.
- va_maps[
DMT.core.VAFileMap
] Verilog-A file mapping that contains any additional Verilog-A files needed for this DutCircuit.
- database_dir
- add_temperature_sweep(temp_def)[source]
Adds the given temperature sweep to self.inp_header and returns it!
At the moment only constant temperature is supported!
- create_inp_header(inp_circuit: MCard | McParameterCollection | Circuit)[source]
Creates the input header of the given circuit description and returns it.
- classmethod from_json(json_content: Dict, classes_technology: List[Type[Technology]], subclass_kwargs: Dict | None = None) DutNgspice [source]
Static class method. Loads a DutNgspice object from a json or pickle file with full path save_dir.
Calls the from_json method of DutView with all dictionary inside the “parent” keyword. Afterwards the additional parameters are set correctly.
- Parameters:
- json_content
dict
Readed dictionary from a saved json DutNgspice.
- classes_technology
List
[Type
[Technology
]] All possible technologies this loaded DutNgspice can have. One will be choosen according to the serialized technology loaded from the file.
- subclass_kwargs
Dict
,optional
Additional kwargs necessary to create the concrete subclassed DutView.
- json_content
- Returns:
DutNgspice
Loaded object.
- import_output_data(sweep)[source]
Read the output files that have been produced while simulating sweep and attach them to self.db.
This is done by reading and resorting the binary output file from ADS.
- Parameters:
- sweep
DMT.core.sweep.Sweep
Sweep that has been simulated for the desired output files.
- sweep
- info_json(**_kwargs) Dict [source]
Returns a dict with serializeable content for the json file to create.
The topmost dict MUST have only one key: The string casted class name. Inside the parameters are:
A version key,
all extra parameters of DutNgspice compared to DutCircuit and
the info_json of DutCircuit.
- Returns:
dict
str(DutNgspice): serialized content
- make_input(sweep)[source]
Creates the sweep definition for the given sweep
- Parameters:
- sweep
Sweep
- sweep
- Returns:
str
header with added bias definitions
- validate_simulation_successful(sweep)[source]
Checks if the simulation of the given sweep was successful.
- Parameters:
- sweep
DMT.core.sweep.Sweep
Sweep that has been simulated.
- sweep
- Raises:
NotImplementedError
If the Dut is not a simulatable dut.
SimulationUnsuccessful
If the simulation output is not valid.
FileNotFoundError
If the sim log file does not exist.