예제 #1
0
    def __init__(self, spice_file: str, parallel_sims=4, renaming_mask=None):
        """This class is intended to be used for simulations with many parameter sweeps. This provides a more user-
        friendly interface than the SimCommander class when there are many parameters to be found. Using the
        SimCommander class a loop needs to be added for each dimension of the simulations.
        A typical usage would be as follows:
        ```
        LTC = SimCommander("my_circuit.asc")
        for dmodel in ("BAT54", "BAT46WJ")
            LTC.set_element_model("D1", model)  # Sets the Diode D1 model
            for res_value1 in sweep(2.2, 2,4, 0.2):  # Steps from 2.2 to 2.4 with 0.2 increments
                LTC.set_component_value('R1', res_value1)  # Updates the resistor R1 value to be 3.3k
                for temperature in sweep(0, 80, 20):  # Makes temperature step from 0 to 80 degrees in 20 degree steps
                    LTC.set_parameters(temp=80)  # Sets the simulation temperature to be 80 degrees
                    for res_value2 in (10, 25, 32):
                        LTC.set_component_value('R2', res_value2)  # Updates the resistor R2 value to be 3.3k
                        LTC.run()

        LTC.wait_completion()  # Waits for the LTSpice simulations to complete
        ```

        With SimStepper the same thing can be done as follows, resulting in a more cleaner code.

        ```
        Stepper = SimStepper("my_circuit.asc")
        Stepper.add_model_sweep('D1', "BAT54", "BAT46WJ")
        Stepper.add_component_sweep('R1', sweep(2.2, 2,4, 0.2))  # Steps from 2.2 to 2.4 with 0.2 increments
        Stepper.add_parameter_sweep('temp', sweep(0, 80, 20))  # Makes temperature step from 0 to 80 degrees in 20
                                                               # degree steps
        Stepper.add_component_sweep('R2', (10, 25, 32)) #  Updates the resistor R2 value to be 3.3k
        Stepper.run_all()

        ```

        Another advantage of using SimStepper is that it can optionally use the .SAVEBIAS in the first simulation and
        then use the .LOADBIAS command at the subsequent ones to speed up the simulation times.
        """
        SimCommander.__init__(self, spice_file, parallel_sims)
        self.iter_list = []
예제 #2
0
 def __init__(self, circuit_file: str, parallel_sims=4):
     SimCommander.__init__(self, circuit_file, parallel_sims=parallel_sims)