I am using an SDD in an HB simulation. I need that the current at one port of the SDD depends on the peak of the voltage across another port of the SDD itself (this voltage is not necessarily a sinusoidal waveform). Is there any simple function to implement this operation (max() doesn't work)? I tried by using an auxiliary circuit as a peak detector (diode + RC parallel) but it leads to some convergence issues.
If you have any suggestion, let me now!