Skip to content

SemiconductorAmplifierTimeStepper

SemiconductorAmplifierTimeStepper(
*,
small_signal_gain: Annotated[float, units='dB'] = 20.0,
saturation_power: Annotated[float, exclusiveMinimum=0, units='W']
| None = None,
carrier_lifetime: Annotated[
float, exclusiveMinimum=0, units='s'
] = 2e-10,
linewidth_enhancement_factor: Annotated[float, minimum=0] = 0.0,
noise_figure: Annotated[float, units='dB'] | None = None,
substeps: Annotated[int, exclusiveMinimum=0] = 1,
ports: Annotated[collections.abc.Sequence[str], maxItems=2, minItems=2]
| None = None,
seed: Annotated[int, minimum=0] | None = None,
) -> None

Time-stepper for a semiconductor optical amplifier (SOA).

Unidirectional travelling-wave amplifier with gain saturation, finite carrier recovery, carrier-induced self-phase modulation, and amplified spontaneous emission (ASE). The reverse optical path is absorbed, as in OpticalAmplifierTimeStepper.

The single state variable is the gain integrated over the device length, h(t)=∫0LΓg dzh(t) = \int_0^L \Gamma g\,{\rm d}z, so that the instantaneous power gain is G=ehG = e^h. It obeys

dhdt=h0−hτc−(eh−1)∣Ain∣2Esat\frac{{\rm d}h}{{\rm d}t} = \frac{h_0 - h}{\tau_c} - \left(e^h - 1\right) \frac{|A_\text{in}|^2}{E_\text{sat}}

with h0=ln⁡G0h_0 = \ln G_0 the unsaturated integrated gain, τc\tau_c the carrier lifetime, and Esat=PsatτcE_\text{sat} = P_\text{sat}\tau_c the saturation energy. The output field carries both the gain and the coupled phase:

Aout=Ainexp⁡ ⁣[h2(1−jαH)]A_\text{out} = A_\text{in} \exp\!\left[\frac{h}{2}\left(1 - j\alpha_H\right)\right]

in which αH\alpha_H is the linewidth enhancement factor.

On the chirp sign: an envelope factor e−2πjf0te^{-2\pi j f_0 t} corresponds to the physical frequency fc+f0f_c + f_0, so the instantaneous frequency deviation is δν=−12πdϕdt\delta\nu = -\frac{1}{2\pi}\frac{{\rm d}\phi}{{\rm d}t}. With ϕ=−αHh/2\phi = -\alpha_H h / 2 this gives

δν=αH4πdhdt\delta\nu = \frac{\alpha_H}{4\pi}\frac{{\rm d}h}{{\rm d}t}

so gain depletion (dh/dt<0{\rm d}h/{\rm d}t < 0) red-shifts the leading edge of a pulse and gain recovery blue-shifts the trailing edge. That is opposite in sign to Kerr self-phase modulation in fibre, and it is the established SOA behaviour.

Args

  • small_signal_gain: Unsaturated power gain G0G_0.
  • saturation_power: Internal saturation power PsatP_\text{sat}. If None, saturation is disabled and the model reduces to a constant-gain amplifier.
  • carrier_lifetime: Carrier recovery time τc\tau_c.
  • linewidth_enhancement_factor: Henry’s αH\alpha_H, coupling gain change to phase. A value of 0 disables chirp.
  • noise_figure: Noise figure (NF). If None, ASE is disabled.
  • substeps: Number of splitting substeps per time step, a count. The integrator is unconditionally stable at any value; increase only to reduce the second-order splitting error when the time step is comparable to the carrier lifetime.
  • ports: Input and output port names, in that order. If not set, the sorted list of optical port names from the component is used.
  • seed: Random number generator seed to ensure reproducibility.

Note

saturation_power is the internal saturation power appearing in the equations above, not the 3 dB output saturation power quoted on datasheets. The two differ by a factor of order ln⁡2⋅G0/(G0−2)\ln 2 \cdot G_0/(G_0-2); use saturation_output_power to convert self-consistently.

Wavelength dependence of the gain is not modelled: a single band at the carrier frequency is assumed. Sub-picosecond effects (carrier heating, spectral hole burning) and counter-propagating signals are also outside the model.

References

  1. Agrawal, G. P., & Olsson, N. A. (1989). Self-phase modulation and spectral broadening of optical pulses in semiconductor laser amplifiers. IEEE Journal of Quantum Electronics, 25(11), 2297-2306.

  2. Agrawal, G. P. (2010). Fiber-Optic Communication Systems. Wiley.

MethodDescription
bind_nativeBind a compiled step function.
resetReset any internal state of the time stepper.
setupInitialize the time stepper.
setup_stateInitialize internal state.
stepCompute the outputs of this time stepper, given inputs.
step_singleTake a single time step on the given inputs.
updateUpdate this time stepper.
write_verilog_aWrite this configured time stepper as one Verilog-A module.

bind_native(self, step, keys, state=None, cstate=None, context=None)

Bind a compiled step function.

Instead of implementing step_single, a time stepper can hand the simulator the address of a C function with the signature:

int64 step(inputs, outputs, time_index, update_state, shutdown,
context, state, cstate)

inputs and outputs are complex128 arrays with one entry per key, state and cstate are the float64 and complex128 arrays, and a nonzero return signals failure. The function must overwrite every element of outputs and only modify the state arrays when update_state is true. The arrays must not be reallocated after binding; reset restores them to the values given here, so a subclass overriding reset must call super().reset().

Calls with update_state false must give the same outputs: circuits may call the function several times in a time step, and setup checks this for steppers that declare path_delays. Random numbers must therefore come from a generator whose state lives in the arrays (e.g., a seed and a counter): output a draw kept there and draw the next one only when update_state is true, which also makes reset replay the stream. Do not use numpy.random in the function: numba draws it from a global stream that differs on every call and survives a reset.

The function can be compiled with numba (when available).

Args

  • step (int | object): Address of the step function, or an object with an address attribute such as a numba cfunc.
  • keys (Sequence[str]): Input/output keys.
  • state (ndarray | None): Contiguous float64 array the function may use.
  • cstate (ndarray | None): Contiguous complex128 array the function may use.
  • context (int | None): Opaque pointer passed to the function.

Example

A two-port element that leaks the field entering its first port out of its second one:

>>> from numba import cfunc
>>> from photonforge.time_steppers import STEP_SIGNATURE
>>>
>>> @cfunc(STEP_SIGNATURE, cache=True) # doctest: +SKIP
... def leaky_step(inputs, outputs, time_index, update_state,
... shutdown, context, state, cstate):
... # state[0]: decay per step
... # cstate[0]: field leaving the second port
... outputs[0] = 0j
... outputs[1] = cstate[0] * state[0] + inputs[0]
... if update_state:
... cstate[0] = outputs[1]
... return 0
...
>>> class LeakyTimeStepper(pf.TimeStepper):
... def __init__(self, *, k=0.5):
... super().__init__(k=k)
...
... def setup_state(self, *, component, time_step, **kwargs):
... keys = tuple(f"{p}@0" for p in sorted(component.ports))
... state = numpy.array([
... self.parametric_kwargs["k"] ** time_step
... ])
... self.bind_native(
... leaky_step, keys, state, numpy.zeros(1, complex)
... )
...
>>> pf.register_time_stepper_class(LeakyTimeStepper)

reset(self)

Reset any internal state of the time stepper.

The default implementation restores the arrays given to bind_native, if any, and performs no other action. Derived classes override it to reset the state they hold themselves.

setup(
self,
component,
time_step,
*,
carrier_frequency=0,
show_progress=True,
**kwargs,
)

Initialize the time stepper.

Args

  • component (Component): Component for the time stepper.
  • time_step (float): The interval between time steps (in seconds).
  • carrier_frequency (float): The carrier frequency used to construct the time stepper. The carrier should be omitted from the input signals, as it is handled automatically by the time stepper.
  • show_progress (bool): If True, show setup progress.
  • **kwargs (object): Keyword args forwarded to setup_state.

Returns

TimeStepper: This time stepper.

setup_state(
self,
*,
component: photonforge.Component,
time_step: Annotated[float, minimum=0, units='s'],
carrier_frequency: Annotated[float, minimum=0, units='Hz'],
**kwargs: object,
) -> None

Initialize internal state.

Args

  • component: Component representing the amplifier.
  • time_step: The interval between time steps (in seconds).
  • carrier_frequency: The carrier frequency used to construct the time stepper. Required to set the ASE photon energy.
  • kwargs: Unused.

step(self, inputs=None, steps=0, time_step=0, show_progress=True)

Compute the outputs of this time stepper, given inputs.

Args

  • inputs (TimeSeries): Inputs to the time stepper.
  • steps (int): The number of time steps to execute. If inputs is defined, this value is not used.
  • time_step (float): The interval between time steps (in seconds). If inputs is a defined, this value is not used.
  • show_progress (bool): If True, show computation progress.

Returns

TimeSeries: Computed outputs.

step_single(self, inputs, outputs, time_index, update_state, shutdown)

Take a single time step on the given inputs.

Important

Derived classes must implement this method unless they bind a compiled step with bind_native, in which case the default implementation calls it and, when shutdown is set, the optional _after_native_run hook.

The method takes the inputs as a numpy array of type complex with values in the order defined by keys. It advances a single time step, updating its internal state (if any) according to the update_state flag. It writes the outputs in-place to the pre-allocated, zero-initialized outputs array in the same order.

Args

  • inputs (ndarray): Input values at the current time step. Must be a 1D array of complex values ordered according to keys.
  • outputs (ndarray): Pre-allocated output array where results will be stored. Same size and type as inputs.
  • time_index (int): Time series index for the current input.
  • update_state (bool): Whether to update the internal stepper state.
  • shutdown (bool): Whether this is the last call to the single stepping function for the original TimeSeries.

update(self, *args, **kwargs)

Update this time stepper.

All contents of the time stepper are updated with the contents from the updated version. Object contents or modifications introduced after the time stepper creation (outside of the original parametric function) are not propagated.

Args

  • *args (object): Positional arguments to the parametric time stepper function.
  • **kwargs (object): Keyword arguments to the parametric time stepper function.

Returns

TimeStepper: This time stepper.

Note

The original keyword arguments used to generate the time stepper are stored and updated with the passed kwargs. This updated version is used in the function call and will be stored for future updates. Positional arguments are not stored.

write_verilog_a(
self,
path,
*,
backend='openvaf',
port_convention='travelling_wave',
module_name=None,
z0=50.0,
field_impedance=None,
)

Write this configured time stepper as one Verilog-A module.

The time stepper must first be configured with setup or Component.setup_time_stepper. The writer creates source only; it does not compile the model or create a simulator deck. Requires a PhotonForge Photonic Canvas license.

Args

  • path (str | os.PathLike): Destination .va file.
  • backend (Literal[“openvaf”, “spectre”]): Compiler capability target recorded in the source.
  • port_convention (Literal[“travelling_wave”, “gf_45spclo_npe”]): External optical port convention. GF packed ports require the Spectre backend.
  • module_name (str | None): Module identifier derived from path when omitted.
  • z0 (float): Travelling-wave optical reference impedance.
  • field_impedance (float | None): GF electric-field scaling.

Returns

pathlib.Path: Absolute destination path.

AttributeDescription
parametric_functionstr: Function used to update the time stepper.
parametric_kwargsdict[str, object]: Keyword arguments used to update the time stepper.
path_delaysdict[tuple[str, str], int] | None: Minimum delay in time steps of each (input key, output key) signal path; missing pairs have no path and None means every input reaches every output within the time step.
propertiesProperties: Object properties.
random_variableslist[RandomVariable]: Random variables associated to the time stepper’s parameters.

str: Function used to update the time stepper.

dict[str, object]: Keyword arguments used to update the time stepper.

dict[tuple[str, str], int] | None: Minimum delay in time steps of each (input key, output key) signal path; missing pairs have no path and None means every input reaches every output within the time step.

Properties: Object properties.

list[RandomVariable]: Random variables associated to the time stepper’s parameters.