text
stringlengths
0
828
Vβ‚‚ Zβ‚‚
── = ──
V₁ Z₁
Let us substitute a default value of 1 for terms Z1 and Z2:
>>> sp.pprint(subs_default(H, ['Z1', 'Z2'], 1))
Vβ‚‚
── = 1
V₁
Now, let us specify a default value of 1 for terms Z1 and Z2, but provide
an overriding value for Z1:
>>> sp.pprint(subs_default(H, ['Z1', 'Z2'], 1, Z1=4))
Vβ‚‚
── = 1/4
V₁
Note that keyword arguments for terms not specified in the list of symbol
names are ignored:
>>> sp.pprint(subs_default(H, ['Z1', 'Z2'], 1, Z1=4, Q=7))
Vβ‚‚
── = 1/4
V₁
'''
if mode == 'subs':
swap_f = _subs
default_swap_f = _subs
elif mode == 'limit':
swap_f = _limit
default_swap_f = _subs
elif mode == 'limit_default':
swap_f = _subs
default_swap_f = _limit
else:
raise ValueError('''Unsupported mode. `mode` must be one of: '''
'''('subs', 'limit').''')
result = equation
for s in symbol_names:
if s in kwargs:
if isinstance(kwargs[s], Iterable):
continue
else:
result = swap_f(result, s, kwargs[s])
else:
result = default_swap_f(result, s, default)
return result"
182,"def z_transfer_functions():
r'''
Return a symbolic equality representation of the transfer function of RMS
voltage measured by either control board analog feedback circuits.
According to the figure below, the transfer function describes the
following relationship::
# Hardware V1 # # Hardware V2 #
Vβ‚‚ V₁ Vβ‚‚ Z₁
── = ─────── ── = ──
Zβ‚‚ Z₁ + Zβ‚‚ V₁ Zβ‚‚
where $V_{1}$ denotes the high-voltage actuation signal from the amplifier
output and $V_{2}$ denotes the signal sufficiently attenuated to fall
within the measurable input range of the analog-to-digital converter
*(approx. 5V)*. The feedback circuits for control board **hardware version
1** and **hardware version 2** are shown below.
.. code-block:: none
# Hardware V1 # # Hardware V2 #
V_1 @ frequency V_1 @ frequency
β”― β”―
β”Œβ”€β”΄β”€β” β”Œβ”€β”΄β”€β” β”Œβ”€β”€β”€β”
β”‚Z_1β”‚ β”‚Z_1β”‚ β”Œβ”€β”€Z_2β”œβ”€β”
β””β”€β”¬β”€β”˜ β””β”€β”¬β”€β”˜ β”‚ β””β”€β”€β”€β”˜ β”‚
β”œβ”€β”€β”€βŠΈ V_2 β”‚ β”‚ β”‚β•² β”œβ”€β”€β”€βŠΈ V_2
β”Œβ”€β”΄β”€β” └────┴──│-β•²__β”‚
β”‚Z_2β”‚ β”Œβ”€β”€β”‚+β•±
β””β”€β”¬β”€β”˜ β”‚ β”‚β•±
═╧═ β”‚
Β― ═╧═
Β―
Notes
-----
- The symbolic equality can be solved for any symbol, _e.g.,_ $V_{1}$ or
$V_{2}$.
- A symbolically solved representation can be converted to a Python function
using `sympy.utilities.lambdify.lambdify`_, to compute results for
specific values of the remaining parameters.
.. _`sympy.utilities.lambdify.lambdify`: http://docs.sympy.org/dev/modules/utilities/lambdify.html
'''
# Define transfer function as a symbolic equality using SymPy.
V1, V2, Z1, Z2 = sp.symbols('V1 V2 Z1 Z2')