CircuitModelView

class ipkiss3.all.CircuitModelView

The CircuitModelView calculates a CompactModel with a circuit solver

It stores parameters and a model to use in circuit simulation.

The model view data is called model. Use _generate_model to define a model on the view. The _generate_model should return either a CompactModel or HierarchicalModel.

Parameters:
layout_view: ( _LayoutView ), *None allowed*
netlist_view: ( NetlistView ), *None allowed*
view_name: String that contains only alphanumeric characters from the ASCII set or contains _$. ASCII set is extended on PY3.

The name of the view

Other Parameters:
solver: str and String that contains only ISO/IEC 8859-1 (extended ASCII py3) or pure ASCII (py2) characters, locked

circuit solver to use

get_smatrix(wavelengths, temperature=None, debug=False, validate_netlist=True, progress_bar=False, verbose=False)

Run a simple frequency-domain simulation of the circuit model in Caphe, returning an S-matrix for all the outside terms.

Parameters:
wavelengthsarray

Array of wavelengths that is contained in the simulation.

temperaturefloat, optional

Ambient temperature to simulate at.

debugboolean, optional

When True, run all models in Python mode. That means they are run in pure Python, allowing you to debug your model more easily.

validate_netlistboolean, optional

When True, validate that the netlist doesn’t have unconnected terms, duplicate nets or optical terms with multiple links.

progress_bar: boolean, optional

Whether or not to display a progress bar for the parameter sweep. Defaults to False.

verbose: boolean, optional

Whether or not to display information about the simulated circuit. Defaults to False.

Returns:
smatrix

An smatrix containing the transmissions from/to all terms of this circuit model.

Examples

>>> import numpy as np
>>> import ipkiss3.all as i3
>>> from pylab import plt
>>> dev = MyDevice()
>>> model = dev.CircuitModel(length=10.)
>>> wavelengths = np.linspace(1.4, 1.6, 1001)
>>> S = model.get_smatrix(wavelengths)
>>> transmission = S['in', 'out', :]
>>> plt.plot(wavelengths, np.abs(transmission) ** 2)
>>> plt.show()
get_time_response(t0, dt, t1, center_wavelength, temperature=None, integration_method='runge_kutta4', debug=False, validate_netlist=True, verbose=False)

Get the transient time response of a CircuitModelView.

This runs a time-domain simulation in the circuit simulator Caphe. The testbench must contain certain excitations and monitors. The output is a structure containing the times that were simulated, and the input on each monitors.

Please check out the tutorial in IPKISS (Tutorials –> Implementing circuit models in IPKISS) for an example and more information.

Parameters:
t0float

Start time.

dtfloat

Time step.

t1float

End time.

center_wavelength: float

The carrier wavelength to simulate at.

temperaturefloat, optional

Ambient temperature to simulate at.

integration_method: str, optional

The Caphe integration method to use, ‘runge_kutta4’ (default) or ‘euler’.

debugboolean, optional

When True, run all models in Python mode. That means they are run in pure Python, allowing you to debug your model more easily.

validate_netlistboolean, optional

When True, validate that the netlist doesn’t have unconnected terms, duplicate nets or optical terms with multiple links.

verbose: boolean, optional

Whether or not to display the debug prints. Defaults to False.

Returns:
result: TimeResponse

Data structure with times and data for all Excitation and Probe elements in the circuit.

Examples

>>> import numpy as np
>>> from pylab import plt
>>> import ipkiss3.all as i3
>>> laser = MyLaser()
>>> def my_signal(t):
>>>     return np.sin(t)
>>> testbench = i3.ConnectComponents(
>>>     child_cells={
>>>         'input': i3.FunctionExcitation(port_domain=i3.ElectricalDomain, excitation_function=my_signal),
>>>         'laser': laser,
>>>         'monitor': i3.Probe(port_domain=i3.OpticalDomain)
>>>     },
>>>     links=[('input:out', 'laser:in'),
>>>            ('laser:optical_out', 'monitor:in')]
>>> )
>>> testbench_cm = testbench.CircuitModel()
>>> res = cm.get_time_response(0, 1e-12, 5e-9, 1.55)
>>> plt.plot(res.times, res.data['monitor'])
>>>