# 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.

# Formula
Let:
Each bit has duration:
For a sequence containing bits, the sequence duration is:
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:
For a 1 to 0 transition in a bit sequence, the falling-edge delay is:
The sequence is composed as follows:
0 → 0: remain at .0 → 1: remain at for , rise during , then remain at .1 → 1: remain at ; do not restart the pulse.1 → 0: remain at for , fall during , then remain at .
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
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 → 1transition - 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
1extends the high plateau byTtotal / 2
Ttotal: Duration of an isolated 10 pulse.
- Default: 2, Global Unit
- Must be greater than zero
- Each bit lasts
Ttotal / 2 - For bits, the complete sequence lasts
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
0and1 - 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:
- 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 , the preview covers exactly and may end inside a bit or transition. Auto Run Time uses a source-defined preview window.