# Square Wave

Square Wave generates a real-valued binary time-domain waveform from configurable low and high levels, transition timing, and a manual bit sequence.

Square Wave timing parameters and RF frequency response

# Formula

Let:

  • L=AlowL = \mathrm{Alow}
  • H=AhighH = \mathrm{Ahigh}
  • P=TtotalP = \mathrm{Ttotal}
  • d=Tdelayd = \mathrm{Tdelay}
  • r=Triser = \mathrm{Trise}
  • h=Tholdh = \mathrm{Thold}
  • f=Tfallf = \mathrm{Tfall}

Each bit has duration:

B=P2 B = \frac{P}{2}

For a sequence containing NN bits, the sequence duration is:

D=NB=NP2 D = NB = N\frac{P}{2}

This Ttotal / 2 bit duration is the Tidy3D RF timing convention. There is no separate Period parameter.

For an isolated 10 pulse beginning at Alow, the local waveform is:

E(u)={L,0≤u<dL+(H−L)u−dr,d≤u<d+rH,d+r≤u<d+r+hH+(L−H)u−d−r−hf,d+r+h≤u<d+r+h+fL,d+r+h+f≤u≤P E(u)= \begin{cases} L, & 0 \le u < d \\ L+(H-L)\dfrac{u-d}{r}, & d \le u < d+r \\ H, & d+r \le u < d+r+h \\ H+(L-H)\dfrac{u-d-r-h}{f}, & d+r+h \le u < d+r+h+f \\ L, & d+r+h+f \le u \le P \end{cases}

For a 1 to 0 transition in a bit sequence, the falling-edge delay is:

q=d+r+h−B q=d+r+h-B

The sequence is composed as follows:

  • 0 → 0: remain at LL.
  • 0 → 1: remain at LL for dd, rise during rr, then remain at HH.
  • 1 → 1: remain at HH; do not restart the pulse.
  • 1 → 0: remain at HH for qq, fall during ff, then remain at LL.

InitBit supplies the state before the first sequence bit and is applied only once.

# Parameters

Signal delay: Shifts the complete generated waveform once in time.

  • Default: 0, Global Unit
  • May be positive, zero, or negative
  • A negative value starts the simulation partway through the waveform
  • Does not change the bit or sequence duration
  • Differs from Tdelay, which applies inside each rising transition

Alow: Amplitude representing logical 0.

  • Default: 0
  • May be signed
  • May equal Ahigh

Ahigh: Amplitude representing logical 1.

  • Default: 1
  • May be signed
  • This is the actual waveform level; no additional carrier amplitude is applied

Trise: Duration of a linear 0 → 1 transition.

  • Default: 0.1, Global Unit
  • Must be greater than zero
  • Must satisfy Tdelay+Trise≤Ttotal/2\mathrm{Tdelay} + \mathrm{Trise} \le \mathrm{Ttotal}/2

Tfall: Duration of a linear 1 → 0 transition.

  • Default: 0.1, Global Unit
  • Must be greater than zero

Tdelay: Time spent at Alow before a rising transition starts.

  • Default: 0, Global Unit
  • Must be nonnegative
  • Applies to each 0 → 1 transition
  • Does not shift the complete waveform

Thold: High-level plateau duration for an isolated 10 pulse.

  • Default: 1, Global Unit
  • Must be nonnegative
  • Each additional consecutive 1 extends the high plateau by Ttotal / 2

Ttotal: Duration of an isolated 10 pulse.

  • Default: 2, Global Unit
  • Must be greater than zero
  • Each bit lasts Ttotal / 2
  • For NN bits, the complete sequence lasts N×Ttotal/2N \times \mathrm{Ttotal}/2

InitBit: Logical state before BitSequence begins.

  • Default: 0
  • Options: 0, 1
  • Applied only once at waveform startup
  • Not reapplied at periodic repetition boundaries

BitSequence: Binary states used to construct the waveform.

  • Default: 101010
  • Must be a nonempty string containing only 0 and 1
  • Leading zeros are preserved
  • Consecutive equal bits hold their current level without creating another edge

Periodic: Controls behavior after one complete bit sequence.

  • Default: enabled
  • Enabled: repeat the complete sequence
  • Disabled: generate the sequence once, then hold its final amplitude
  • At a repetition boundary, compare the final bit with the first bit
  • Equal boundary states do not create another transition
  • Changes repetition versus endpoint holding but does not change a manual preview endpoint
  • A periodic Auto preview shows two complete sequences
  • A non-periodic Auto preview shows one complete sequence followed by a short final-level hold
  • Periodic simulation submission requires a resolved finite positive manual Run Time
  • A manual Run Time derived from global frequency is valid when it resolves to a finite positive duration

# Timing constraints

After converting all time quantities to the same unit, the following conditions must hold:

Tdelay+Trise≤Ttotal2 \mathrm{Tdelay} + \mathrm{Trise} \le \frac{\mathrm{Ttotal}}{2}
Tdelay+Trise+Thold≥Ttotal2 \mathrm{Tdelay} + \mathrm{Trise} + \mathrm{Thold} \ge \frac{\mathrm{Ttotal}}{2}
Tdelay+Trise+Thold+Tfall≤Ttotal \mathrm{Tdelay} + \mathrm{Trise} + \mathrm{Thold} + \mathrm{Tfall} \le \mathrm{Ttotal}
  • Boundary equality is valid
  • Invalid values are not clamped or automatically adjusted
  • Invalid form drafts remain visible for correction but are not saved
  • Preview continues to use the last valid saved waveform

Preview duration is controlled by Run Time. With a finite positive manual Run Time RR, the preview covers exactly [0,R][0,R] and may end inside a bit or transition. Auto Run Time uses a source-defined preview window.