diff options
author | couriersud <couriersud@gmx.org> | 2020-05-02 18:00:32 +0200 |
---|---|---|
committer | couriersud <couriersud@gmx.org> | 2020-05-02 18:00:32 +0200 |
commit | fb2839ba10e89f58d26011b46ba436b7e2bd953d (patch) | |
tree | c630b5de162d66aa455458505593cf4d8034ac30 /src/lib/netlist/analog/nlid_twoterm.cpp | |
parent | 4dde812af80708b6c1df6d77c46941ca2fab9aad (diff) |
netlist: Add simple ZDIODE model. [Couriersud]
The model is driven by three additional model parameters: NBV, IBV, BV.
Example code how to define a typical 7.5V Zener diode:
ZDIODE(ZD, "D(BV=7.5 IBV=0.01 NBV=3)")
or
NET_MODEL("A1234 D(BV=7.5 IBV=0.01 NBV=3)")
ZDIODE(ZD, "A1234")
Diffstat (limited to 'src/lib/netlist/analog/nlid_twoterm.cpp')
-rw-r--r-- | src/lib/netlist/analog/nlid_twoterm.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/netlist/analog/nlid_twoterm.cpp b/src/lib/netlist/analog/nlid_twoterm.cpp index e60f39ea202..82fdf0f5691 100644 --- a/src/lib/netlist/analog/nlid_twoterm.cpp +++ b/src/lib/netlist/analog/nlid_twoterm.cpp @@ -170,6 +170,39 @@ namespace analog //set(m_D.G(), 0.0, m_D.Ieq()); } + // ---------------------------------------------------------------------------------------- + // nld_Z + // ---------------------------------------------------------------------------------------- + + NETLIB_RESET(Z) + { + nl_fptype IsBV = m_model.m_IBV / (plib::exp(m_model.m_BV / nlconst::np_VT(m_model.m_NBV)) - nlconst::one()); + + m_D.set_param(m_model.m_IS, m_model.m_N, exec().gmin(), nlconst::T0()); + m_R.set_param(IsBV, m_model.m_NBV, exec().gmin(), nlconst::T0()); + set_G_V_I(m_D.G(), nlconst::zero(), m_D.Ieq()); + } + + NETLIB_UPDATE_PARAM(Z) + { + nl_fptype IsBV = m_model.m_IBV / (plib::exp(m_model.m_BV / nlconst::np_VT(m_model.m_NBV)) - nlconst::one()); + + m_D.set_param(m_model.m_IS, m_model.m_N, exec().gmin(), nlconst::T0()); + m_R.set_param(IsBV, m_model.m_NBV, exec().gmin(), nlconst::T0()); + set_G_V_I(m_D.G(), nlconst::zero(), m_D.Ieq()); + } + + NETLIB_UPDATE_TERMINALS(Z) + { + m_D.update_diode(deltaV()); + m_R.update_diode(-deltaV()); + const nl_fptype G(m_D.G() + m_R.G()); + const nl_fptype I(m_D.Ieq() - m_R.Ieq()); + set_mat( G, -G, -I, + -G, G, I); + } + + } //namespace analog @@ -180,6 +213,7 @@ namespace devices { NETLIB_DEVICE_IMPL_NS(analog, C, "CAP", "C") NETLIB_DEVICE_IMPL_NS(analog, L, "IND", "L") NETLIB_DEVICE_IMPL_NS(analog, D, "DIODE", "MODEL") + NETLIB_DEVICE_IMPL_NS(analog, Z, "ZDIODE", "MODEL") NETLIB_DEVICE_IMPL_NS(analog, VS, "VS", "V") NETLIB_DEVICE_IMPL_NS(analog, CS, "CS", "I") } // namespace devices |