piel.tools.hdl21.simulator
==========================

.. py:module:: piel.tools.hdl21.simulator

.. autoapi-nested-parse::

   This module provides functions to configure and run various measurement of simulations for electronic circuits using HDL21 and NGSPICE.
   It includes utilities to set up NGSPICE simulations, configure operating point and transient simulations, and handle the results.



Functions
---------

.. autoapisummary::

   piel.tools.hdl21.simulator.configure_ngspice_simulation
   piel.tools.hdl21.simulator.configure_operating_point_simulation
   piel.tools.hdl21.simulator.configure_transient_simulation
   piel.tools.hdl21.simulator.run_simulation


Module Contents
---------------

.. py:function:: configure_ngspice_simulation(run_directory: piel.types.PathTypes = '.')

   Configures the NGSPICE simulation for the circuit and returns a simulation options class.

   :param run_directory: Directory where the simulation will be run.
   :type run_directory: PathTypes

   :returns: Configured NGSPICE simulation options.
   :rtype: vsp.SimOptions


.. py:function:: configure_operating_point_simulation(testbench: piel.types.AnalogueModule, **kwargs)

.. py:function:: configure_transient_simulation(testbench: piel.types.AnalogueModule, stop_time_s: float, step_time_s: float, **kwargs)

.. py:function:: run_simulation(simulation: Any, simulator_name: Literal['ngspice'] = 'ngspice', simulation_options: Any = None, to_csv: bool = True)

   Runs the simulation for the circuit and returns the results.

   :param simulation: HDL21 simulation class.
   :type simulation: h.sim.Sim
   :param simulator_name: Name of the simulator to use.
   :type simulator_name: Literal["ngspice"]
   :param simulation_options: Options for the simulation. Defaults to None.
   :type simulation_options: Optional[vsp.SimOptions]
   :param to_csv: Whether to save the results to a CSV file. Defaults to True.
   :type to_csv: bool

   :returns: Results of the simulation.
   :rtype: hs.SimResult


