mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
netlist: Small improvement to visibility in four terms. (nw)
This commit is contained in:
parent
72566426a7
commit
465bceddb9
@ -59,7 +59,7 @@ NETLIB_UPDATE_PARAM(LVCCS)
|
||||
|
||||
NETLIB_UPDATE_TERMINALS(LVCCS)
|
||||
{
|
||||
const nl_fptype m_mult = m_G() * m_gfac; // 1.0 ==> 1V ==> 1A
|
||||
const nl_fptype m_mult = m_G() * get_gfac(); // 1.0 ==> 1V ==> 1A
|
||||
const nl_fptype vi = m_IP.net().Q_Analog() - m_IN.net().Q_Analog();
|
||||
const auto c1(nlconst::magic(0.2));
|
||||
|
||||
@ -101,11 +101,13 @@ NETLIB_UPDATE_PARAM(CCCS)
|
||||
|
||||
NETLIB_RESET(VCVS)
|
||||
{
|
||||
m_gfac = plib::reciprocal(m_RO());
|
||||
const auto gfac(plib::reciprocal(m_RO()));
|
||||
set_gfac(gfac);
|
||||
|
||||
NETLIB_NAME(VCCS)::reset();
|
||||
|
||||
m_OP2.set_conductivity(m_gfac);
|
||||
m_ON2.set_conductivity(m_gfac);
|
||||
m_OP2.set_conductivity(gfac);
|
||||
m_ON2.set_conductivity(gfac);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -114,11 +116,13 @@ NETLIB_RESET(VCVS)
|
||||
|
||||
NETLIB_RESET(CCVS)
|
||||
{
|
||||
m_gfac = plib::reciprocal(m_RO());
|
||||
const auto gfac(plib::reciprocal(m_RO()));
|
||||
set_gfac(gfac);
|
||||
|
||||
NETLIB_NAME(VCCS)::reset();
|
||||
|
||||
m_OP2.set_conductivity(m_gfac);
|
||||
m_ON2.set_conductivity(m_gfac);
|
||||
m_OP2.set_conductivity(gfac);
|
||||
m_ON2.set_conductivity(gfac);
|
||||
}
|
||||
|
||||
} //namespace analog
|
||||
|
@ -36,9 +36,9 @@ namespace analog {
|
||||
NETLIB_OBJECT(VCCS)
|
||||
{
|
||||
public:
|
||||
NETLIB_CONSTRUCTOR_EX(VCCS, nl_fptype ari = nlconst::magic(1e9))
|
||||
NETLIB_CONSTRUCTOR_EX(VCCS, nl_fptype ri = nlconst::magic(1e9))
|
||||
, m_G(*this, "G", nlconst::one())
|
||||
, m_RI(*this, "RI", ari)
|
||||
, m_RI(*this, "RI", ri)
|
||||
, m_OP(*this, "OP", &m_IP)
|
||||
, m_ON(*this, "ON", &m_IP)
|
||||
, m_IP(*this, "IP", &m_IN) // <= this should be NULL and terminal be filtered out prior to solving...
|
||||
@ -49,7 +49,6 @@ namespace analog {
|
||||
{
|
||||
connect(m_OP, m_OP1);
|
||||
connect(m_ON, m_ON1);
|
||||
m_gfac = nlconst::one();
|
||||
}
|
||||
|
||||
NETLIB_RESETI();
|
||||
@ -64,6 +63,15 @@ namespace analog {
|
||||
NETLIB_NAME(VCCS)::reset();
|
||||
}
|
||||
|
||||
void set_gfac(nl_fptype g) noexcept
|
||||
{
|
||||
m_gfac = g;
|
||||
}
|
||||
|
||||
nl_fptype get_gfac() const noexcept
|
||||
{
|
||||
return m_gfac;
|
||||
}
|
||||
|
||||
terminal_t m_OP;
|
||||
terminal_t m_ON;
|
||||
@ -74,6 +82,7 @@ namespace analog {
|
||||
terminal_t m_OP1;
|
||||
terminal_t m_ON1;
|
||||
|
||||
private:
|
||||
nl_fptype m_gfac;
|
||||
};
|
||||
|
||||
@ -111,7 +120,7 @@ namespace analog {
|
||||
// IP ---+ +------> OP
|
||||
// | |
|
||||
// RI I
|
||||
// RI => G => I IOut = (V(IP)-V(IN)) / RI * G
|
||||
// RI => G => I IOut = -(V(IP)-V(IN)) / RI * G
|
||||
// RI I
|
||||
// | |
|
||||
// IN ---+ +------< ON
|
||||
@ -120,6 +129,8 @@ namespace analog {
|
||||
//
|
||||
// RI = 1
|
||||
//
|
||||
// If current flows from IP to IN than output current flows from OP to ON
|
||||
//
|
||||
// This needs high levels of accuracy to work with 1 Ohm RI.
|
||||
//
|
||||
|
||||
@ -128,7 +139,7 @@ namespace analog {
|
||||
public:
|
||||
NETLIB_CONSTRUCTOR_DERIVED_PASS(CCCS, VCCS, nlconst::one())
|
||||
{
|
||||
m_gfac = -plib::reciprocal(m_RI());
|
||||
set_gfac(-plib::reciprocal(m_RI()));
|
||||
}
|
||||
|
||||
NETLIB_RESETI();
|
||||
|
Loading…
Reference in New Issue
Block a user