From c5b5d3abd28e546e46cee013f6f3032a1c985a9a Mon Sep 17 00:00:00 2001 From: Michael Hayes Date: Thu, 26 Dec 2024 14:39:27 +1300 Subject: [PATCH] Show MNA equations for resistive circuits in the time-domain --- lcapy/netlist.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lcapy/netlist.py b/lcapy/netlist.py index 02d33231..4b9d53c7 100644 --- a/lcapy/netlist.py +++ b/lcapy/netlist.py @@ -772,12 +772,17 @@ def modified_nodal_analysis(self): """Perform modified nodal analysis for this netlist. This is cached.""" - if self.kind in ('time', 'super'): - raise ValueError( - 'Cannot put time domain equations into matrix form. ' - 'Convert to dc, ac, or laplace domain first.') + kind = self.kind + if kind in ('time', 'super'): - return SubNetlist(self, self.kind).mna + if self.reactances != []: + raise ValueError( + 'Cannot put time domain equations into matrix form due to' + ' reactive components: %s. Convert to dc, ac, or' + ' laplace domain first.' % ', '.join(self.reactances)) + kind = 'time' + + return SubNetlist(self, kind).mna @lru_cache(1) def nodal_analysis(self, node_prefix=''):