Call: add(o1, o2):
Returns the addition of to operands. Operands can be skalars or DataFrames (e.g. the output of another expression) but not signals (,yet). Thus, it is senseful to use add() with clipped functions or values (got by value())
Clip the signal ‘v(inv_in)’ from 100us to 400us and add 2.
add(
clip(
'v(inv_in)',
'time',
100u
400u
),
2
)

def add(o1, o2):
o1 = process_operator(o1)
o2 = process_operator(o2)
# Überprüfen, ob o1 und o2 DataFrames sind
if isinstance(o1, pd.DataFrame) and isinstance(o2, pd.DataFrame):
# Multiplizieren Sie nur die 'y'-Spalte, wenn beide DataFrames sind
result = pd.DataFrame()
result['x'] = o1['x']
result['y'] = o1['y'] + o2['y']
elif isinstance(o1, pd.DataFrame):
# Wenn nur o1 ein DataFrame ist
result = o1.copy()
result['y'] += o2
elif isinstance(o2, pd.DataFrame):
# Wenn nur o2 ein DataFrame ist
result = o2.copy()
result['y'] += o1
else:
# Wenn beide Skalare sind
# result = o1 + o2
result = pd.DataFrame({'x': [0], 'y': o1 + o2})
return result