Skip to content

Commit

Permalink
Use omega0 as default angular frequency for ac #115
Browse files Browse the repository at this point in the history
  • Loading branch information
mph- committed Nov 6, 2023
1 parent 05d5a09 commit e6060e8
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lcapy/netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .subnetlist import SubNetlist
from .superpositionvoltage import SuperpositionVoltage
from .superpositioncurrent import SuperpositionCurrent
from .symbols import j, s, t, omega
from .symbols import j, s, t, omega, omega0
from .transformdomains import TransformDomains
from .utils import isiterable
from copy import copy
Expand Down Expand Up @@ -331,14 +331,19 @@ def get_vd(self, Np, Nm=None):

return self.get_Vd(Np, Nm).time()

def ac(self):
def ac(self, omega=None):
"""Return netlist for ac components of independent sources
for angular frequency omega.
for angular frequency `omega`. If `omega` is undefined,
the angular frequency `omega0` is used.
See also: dc, transient, laplace.
"""
# Could look at all the ac frequencies and if there is only
# one use that? If have multiple ac frequencies should issue

if omega is None:
omega = omega0

# Should look at all the ac frequencies and if there is only
# one use that. If have multiple ac frequencies should issue
# warning.
return self.select(omega)

Expand All @@ -354,15 +359,15 @@ def annotate_currents(self, cpts=None, domainvar=None, flow=False,
`flow` (default False) if True annotates current as a flow
`eng_format` (default True) if True use engineering format if
the current is a number, e.g., 100\,mV instead of 0.1\,V
the current is a number, e.g., 100\, mV instead of 0.1\, V
`evalf` (default True) if True prints floating point
numbers as decimals otherwise they are shown as rationals
`show_units` (default True) if True applies the units (e.g.,
`show_units` (default True) if True applies the units(e.g.,
V for volts)
`pos` specifies where to position the labels (see docs)
`pos` specifies where to position the labels(see docs)
"""

cct = self.copy()
Expand Down Expand Up @@ -405,15 +410,15 @@ def annotate_voltages(self, cpts=None, domainvar=None,
`pos` specifies where to position the labels, see docs
`eng_format` (default True) if True use engineering format if
the voltage is a number, e.g., 100\,mV instead of 0.1\,V
the voltage is a number, e.g., 100\, mV instead of 0.1\, V
`evalf` (default True) if True prints floating point
numbers as decimals otherwise they are shown as rationals
`show_units` (default True) if True applies the units (e.g.,
`show_units` (default True) if True applies the units(e.g.,
V for volts)
`pos` specifies where to position the labels (see docs)
`pos` specifies where to position the labels(see docs)
"""

cct = self.copy()
Expand Down Expand Up @@ -459,18 +464,18 @@ def annotate_node_voltages(self, nodes=None, domainvar=None,
(e.g., `t` for time-domain, `s` for Laplace-domain)
`label_voltages` (default False) if True prefixes the
annotation with V1= for node 1, etc.
annotation with V1 = for node 1, etc.
`eng_format` (default True) if True use engineering format if
the voltage is a number, e.g., 100\,mV instead of 0.1\,V
the voltage is a number, e.g., 100\, mV instead of 0.1\, V
`evalf` (default True) if True prints floating point
numbers as decimals otherwise they are shown as rationals
`num_digits` (default 3) specfies the number of digits to print
for floating point numbers
`show_units` (default True) if True applies the units (e.g.,
`show_units` (default True) if True applies the units(e.g.,
V for volts)
`anchor` (default 'south west') specifies the position of the
Expand Down

0 comments on commit e6060e8

Please sign in to comment.