mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
netlist: Fix Inductor state saving.
This commit is contained in:
parent
6be87b69a1
commit
0dfa500a4a
@ -43,6 +43,7 @@ namespace analog
|
||||
|
||||
NETLIB_RESET(R_base)
|
||||
{
|
||||
// FIXME: this reset is causing issues. Remove.
|
||||
NETLIB_NAME(twoterm)::reset();
|
||||
set_R(plib::reciprocal(exec().gmin()));
|
||||
}
|
||||
@ -135,6 +136,7 @@ namespace analog
|
||||
if (ts_type == timestep_type::FORWARD)
|
||||
{
|
||||
m_last_I = m_I;
|
||||
m_last_G = m_G;
|
||||
// Gpar should support convergence
|
||||
m_I += m_G * deltaV();
|
||||
m_G = step / m_L() + m_gmin;
|
||||
@ -142,7 +144,10 @@ namespace analog
|
||||
-m_G, m_G, m_I);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_I = m_last_I;
|
||||
m_G = m_last_G;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
@ -415,9 +415,10 @@ namespace analog
|
||||
NETLIB_CONSTRUCTOR(L)
|
||||
, m_L(*this, "L", nlconst::magic(1e-6))
|
||||
, m_gmin(nlconst::zero())
|
||||
, m_G(nlconst::zero())
|
||||
, m_I(nlconst::zero())
|
||||
, m_last_I(nlconst::zero())
|
||||
, m_G(*this, "m_G", nlconst::zero())
|
||||
, m_I(*this, "m_I", nlconst::zero())
|
||||
, m_last_I(*this, "m_last_I", nlconst::zero())
|
||||
, m_last_G(*this, "m_last_G", nlconst::zero())
|
||||
{
|
||||
//register_term("1", m_P);
|
||||
//register_term("2", m_N);
|
||||
@ -435,9 +436,10 @@ namespace analog
|
||||
param_fp_t m_L;
|
||||
|
||||
nl_fptype m_gmin;
|
||||
nl_fptype m_G;
|
||||
nl_fptype m_I;
|
||||
nl_fptype m_last_I;
|
||||
state_var<nl_fptype> m_G;
|
||||
state_var<nl_fptype> m_I;
|
||||
state_var<nl_fptype> m_last_I;
|
||||
state_var<nl_fptype> m_last_G;
|
||||
};
|
||||
|
||||
/// \brief Class representing the diode model paramers.
|
||||
|
Loading…
Reference in New Issue
Block a user