Skip to content

Commit

Permalink
Check for ac
Browse files Browse the repository at this point in the history
  • Loading branch information
mph- committed Jan 4, 2025
1 parent 01db8ae commit b06a7fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lcapy/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def __init__(self, cct, components):
self.has_ic = False
self.zeroic = True
self.has_s = False
self.has_ac = False
self.has_dc = False
self.has_transient = False
self.ac_count = 0
self.dc_count = 0
Expand Down Expand Up @@ -46,6 +48,10 @@ def __init__(self, cct, components):
self.dc_count += 1
if not elt.is_causal:
self.causal = False
if elt.has_ac:
self.has_ac = True
if elt.has_dc:
self.has_dc = True
if elt.is_dependent_source:
self.dependent_sources.append(eltname)
if elt.is_reactive:
Expand All @@ -56,9 +62,6 @@ def __init__(self, cct, components):

num_sources = len(self.independent_sources)

self.has_dc = self.dc_count > 0
self.has_ac = self.ac_count > 0

self.ac = self.ac_count > 0 and \
(num_sources == self.ac_count) and not self.has_ic
self.dc = self.dc_count > 0 and \
Expand Down
5 changes: 3 additions & 2 deletions lcapy/netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,16 +655,17 @@ def laplace(self):
"""

lap = self.select('laplace')
if self.is_causal:
return self.select('laplace')
return lap

# FIXME
if self.has_ac:
warn('Ignoring initial conditions due to AC source')
return

# Calculate initial conditions due to DC source
dc = self.dc()
lap = self.select('laplace')

new = self._new()

Expand Down

0 comments on commit b06a7fd

Please sign in to comment.