Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sean Leavey
Zero
Commits
46b2bc96
Commit
46b2bc96
authored
Feb 17, 2022
by
Sean Leavey
Browse files
WIP
parent
5a82645b
Pipeline
#357763
failed with stage
in 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.vscode/settings.json
View file @
46b2bc96
...
...
@@ -19,4 +19,5 @@
"latex"
,
"plaintext"
],
"python.formatting.provider"
:
"black"
,
}
zero/analysis/dc.py
View file @
46b2bc96
...
...
@@ -165,7 +165,6 @@ class Analysis(metaclass=abc.ABCMeta):
The convergence check results by node, if ``debug`` was set to ``True``,
else ``None``.
"""
# This code only works properly when we're dealing with (n x 1) arrays.
assert
x
.
shape
[
1
]
==
dx
.
shape
[
1
]
==
residuals
.
shape
[
1
]
==
1
...
...
@@ -499,9 +498,9 @@ class OperatingPoint(Analysis):
lu
=
scipy
.
sparse
.
linalg
.
splu
(
scipy
.
sparse
.
csc_matrix
(
mna
+
J
))
dx
=
lu
.
solve
(
-
residuals
)
else
:
dx
=
np
.
linalg
.
solve
(
mna
+
J
,
-
residuals
)
dx
=
scipy
.
linalg
.
solve
(
mna
+
J
,
-
residuals
)
x
+=
self
.
damping
(
dx
,
n
=
count
)
x
+=
self
.
damping
_factor
(
dx
,
n
=
count
)
*
dx
if
not
self
.
circuit
.
nonlinear
:
# The circuit should have converged in a single pass.
...
...
@@ -520,7 +519,7 @@ class OperatingPoint(Analysis):
return
is_converged
,
count
,
convergence_by_node
def
damping
(
self
,
dx
,
n
=-
1
):
def
damping
_factor
(
self
,
dx
,
n
=-
1
):
"""Calculates the damping coefficient for the Newthon method.
The damping coefficient is choosen as the lowest between:
...
...
@@ -600,7 +599,7 @@ class OperatingPoint(Analysis):
if
td_new
<
td
:
td
=
td_new
return
td
*
dx
return
td
class
Sweep
(
Analysis
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment