diff options
author | couriersud <couriersud@gmx.org> | 2019-11-02 22:25:11 +0100 |
---|---|---|
committer | couriersud <couriersud@gmx.org> | 2019-11-02 22:25:11 +0100 |
commit | 77ea61bac778e0eccaf2872e6d67c2eec7eb541b (patch) | |
tree | 34559a448c8c142ee5e707b567fa17d7c98cf006 /src/lib/netlist/analog/nlid_twoterm.cpp | |
parent | 7518cc226b9a6754847f67f6129b44c34be29179 (diff) |
netlist: add RELTOL/VNTOL solver parameters. Type safety. [Couriersud]
The newly added RELTOL and VNTOL parameters implement Newton convergence
checks comparable following other SPICE implementations.
The ACCURACY solver parameter now is only used for convergence checks in
iterative solvers.
In addition, type safety was significantly improved and a lot of "magic"
numbers are identifiable now.
Diffstat (limited to 'src/lib/netlist/analog/nlid_twoterm.cpp')
-rw-r--r-- | src/lib/netlist/analog/nlid_twoterm.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/netlist/analog/nlid_twoterm.cpp b/src/lib/netlist/analog/nlid_twoterm.cpp index fe928782810..c9d94c98f51 100644 --- a/src/lib/netlist/analog/nlid_twoterm.cpp +++ b/src/lib/netlist/analog/nlid_twoterm.cpp @@ -64,7 +64,7 @@ NETLIB_RESET(POT) { nl_fptype v = m_Dial(); if (m_DialIsLog()) - v = (std::exp(v) - 1.0) / (std::exp(1.0) - 1.0); + v = (std::exp(v) - plib::constants<nl_fptype>::one()) / (std::exp(plib::constants<nl_fptype>::one()) - plib::constants<nl_fptype>::one()); m_R1.set_R(std::max(m_R() * v, exec().gmin())); m_R2.set_R(std::max(m_R() * (plib::constants<nl_fptype>::one() - v), exec().gmin())); @@ -77,9 +77,9 @@ NETLIB_UPDATE_PARAM(POT) nl_fptype v = m_Dial(); if (m_DialIsLog()) - v = (std::exp(v) - 1.0) / (std::exp(1.0) - 1.0); + v = (std::exp(v) - plib::constants<nl_fptype>::one()) / (std::exp(plib::constants<nl_fptype>::one()) - plib::constants<nl_fptype>::one()); if (m_Reverse()) - v = 1.0 - v; + v = plib::constants<nl_fptype>::one() - v; m_R1.set_R(std::max(m_R() * v, exec().gmin())); m_R2.set_R(std::max(m_R() * (plib::constants<nl_fptype>::one() - v), exec().gmin())); @@ -94,9 +94,9 @@ NETLIB_RESET(POT2) nl_fptype v = m_Dial(); if (m_DialIsLog()) - v = (std::exp(v) - 1.0) / (std::exp(1.0) - 1.0); + v = (std::exp(v) - plib::constants<nl_fptype>::one()) / (std::exp(plib::constants<nl_fptype>::one()) - plib::constants<nl_fptype>::one()); if (m_Reverse()) - v = 1.0 - v; + v = plib::constants<nl_fptype>::one() - v; m_R1.set_R(std::max(m_R() * v, exec().gmin())); } @@ -108,9 +108,9 @@ NETLIB_UPDATE_PARAM(POT2) nl_fptype v = m_Dial(); if (m_DialIsLog()) - v = (std::exp(v) - 1.0) / (std::exp(1.0) - 1.0); + v = (std::exp(v) - plib::constants<nl_fptype>::one()) / (std::exp(plib::constants<nl_fptype>::one()) - plib::constants<nl_fptype>::one()); if (m_Reverse()) - v = 1.0 - v; + v = plib::constants<nl_fptype>::one() - v; m_R1.set_R(std::max(m_R() * v, exec().gmin())); } @@ -121,7 +121,7 @@ NETLIB_UPDATE_PARAM(POT2) NETLIB_RESET(L) { m_gmin = exec().gmin(); - m_I = 0.0; + m_I = plib::constants<nl_fptype>::zero(); m_G = m_gmin; set_mat( m_G, -m_G, -m_I, -m_G, m_G, m_I); @@ -152,7 +152,7 @@ NETLIB_RESET(D) nl_fptype n = m_model.m_N; m_D.set_param(Is, n, exec().gmin(), constants::T0()); - set_G_V_I(m_D.G(), 0.0, m_D.Ieq()); + set_G_V_I(m_D.G(), plib::constants<nl_fptype>::zero(), m_D.Ieq()); } NETLIB_UPDATE_PARAM(D) |