Use a more realistic resistance in dump mode.

This commit is contained in:
Christian Speckner 2021-04-04 00:36:20 +02:00
parent 31260facef
commit 0ea4515bbf
2 changed files with 7 additions and 6 deletions

View File

@ -83,17 +83,17 @@ void PaddleReader::setConsoleTiming(ConsoleTiming consoleTiming)
myConsoleTiming = consoleTiming;
myClockFreq = myConsoleTiming == ConsoleTiming::ntsc ? 60 * 228 * 262 : 50 * 228 * 312;
myUThresh = USUPP * (1. - exp(-TRIPPOINT_LINES * 228 / myClockFreq / (RPOT + R0) / C));
myUThresh = U_SUPP * (1. - exp(-TRIPPOINT_LINES * 228 / myClockFreq / (R_POT + R0) / C));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaddleReader::updateCharge(uInt64 timestamp)
{
if (myValue >= 0 && !myIsDumped)
myU = USUPP * (1 - (1 - myU / USUPP) *
exp(-static_cast<double>(timestamp - myTimestamp) / (myValue * RPOT + R0) / C / myClockFreq));
myU = U_SUPP * (1 - (1 - myU / U_SUPP) *
exp(-static_cast<double>(timestamp - myTimestamp) / (myValue * R_POT + R0) / C / myClockFreq));
else
myU *= exp(-static_cast<double>(timestamp - myTimestamp) / R0 / C / myClockFreq);
myU *= exp(-static_cast<double>(timestamp - myTimestamp) / (myIsDumped ? R_DUMP : R0) / C / myClockFreq);
myTimestamp = timestamp;
}

View File

@ -67,8 +67,9 @@ class PaddleReader : public Serializable
static constexpr double
R0 = 1.8e3,
C = 68e-9,
RPOT = 1e6,
USUPP = 5;
R_POT = 1e6,
R_DUMP = 50,
U_SUPP = 5;
static constexpr double TRIPPOINT_LINES = 379;