From 11ce90e8a47b21a2f29d818c5145c7ad2a716c60 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 27 May 2017 00:07:07 +0200 Subject: Explain the pest and hammer circuits. Increase solver accuracy to reduce number of false solutions. The usual 1e-8 is not enough here, we need 1e-10. (nw) --- src/mame/audio/nl_cheekyms.cpp | 50 +++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/src/mame/audio/nl_cheekyms.cpp b/src/mame/audio/nl_cheekyms.cpp index 7c070bbaa9a..9effd3bf83b 100644 --- a/src/mame/audio/nl_cheekyms.cpp +++ b/src/mame/audio/nl_cheekyms.cpp @@ -9,6 +9,34 @@ #endif +/* Couriersud, 2013-05-26 + * + * Vas left the following commit comment: + * It doesn't work quite right yet. The "Hammer" and "Pest" sounds + * are generated by free-running 555/556 timers and gated with LM324 + * applifiers. For whatever reason, the netlist system produces a kind of + * buzzing from the "Hammer" circuit when it's supposed to be suppressed, + * and it doesn't think the pest sound should be suppressed completely so + * you can always hear it at a low level in the background. + * + * I modelled the LM324 sub-circuit using LTSpice and a National Semiconductor + * spice model. + * This model confirms that the two sounds are always audible. There is also a + * quantitative explanation: The LM324 sub-circuit is an inverting amplifier with + * Vout = max(Vx - V555, 0) + * Vx is either 5V or ~1.4V, depending on the state of the 7404 output. This + * causes max. amplitude to be 0 to 5 for Vx=5V or 1.4V for VX=1.4V. + * + * Further comments: + * The "Cheese" circuit is a bit weird - either they're using the + * base-emitter junction of a 2SC945 as a signal diode, or there's an error + * in the schematic (collector is shown unconnected). + * + * This looks like a noise generating circuit. Amplification is ~100. The open + * collector of the transistor will create the noise. Currently, there is no + * support for noise in the resistor, diode or transistor models so currently + * there is nothing to amplify currently. + */ NETLIST_START(cheekyms_schematics) @@ -30,10 +58,16 @@ NETLIST_START(cheekyms_schematics) NET_C(C10.2, Q1.E, GND) // Cheese -#if 0 - // FIXME: Not working right, causes the netlist system to die - // Note that the collector of Q2 is not connected, they're just using the base-emitter junction as a diode - // Well, either that or there's an error in the schematic +#if 1 + // FIXME: We need a generic noise voltage or current source which be can + // place in parallel to B-E so simulate device noise. + + // RDUMMY will ensure the circuit does not become singular. + + RES(RDUMMY, RES_M(1000)) + NET_C(RDUMMY.1, GND) + NET_C(RDUMMY.2, Q2.C) + RES(R2, RES_M(1)) RES(R3, RES_K(1)) RES(R4, RES_K(100)) @@ -224,13 +258,11 @@ NETLIST_END() NETLIST_START(cheekyms) - SOLVER(Solver, 180000) - PARAM(Solver.ACCURACY, 1e-8) + SOLVER(Solver, 48000) + PARAM(Solver.ACCURACY, 1e-10) PARAM(Solver.NR_LOOPS, 300) - PARAM(Solver.GS_LOOPS, 1) PARAM(Solver.METHOD, "MAT_CR") PARAM(Solver.PARALLEL, 0) - PARAM(Solver.SOR_FACTOR, 1.00) PARAM(Solver.DYNAMIC_TS, 0) PARAM(Solver.DYNAMIC_LTE, 5e-4) PARAM(Solver.DYNAMIC_MIN_TIMESTEP, 20e-6) @@ -239,8 +271,6 @@ NETLIST_START(cheekyms) ANALOG_INPUT(I_V5, 5) ANALOG_INPUT(I_VPLUS, 12.9) // very approximate - 15V dropped by three diodes and filtered - //ANALOG_INPUT(I_V0, 0) - ALIAS(I_V0.Q, GND) INCLUDE(cheekyms_schematics) -- cgit v1.2.3