Tennis Programming - Gremlin SPICE reconstruction 0.3.1 * Basis: BNL EH1-900-1-3 A (1958), computing/relay diagram. * See docs/model.json and docs/corrections.json for model boundaries. * No host code changes a ball coordinate, capacitor charge or inductor current. * Raw U2 voltage is zero at the net top; displayed height is V(y)+20 V. * Electronic display sheet EH1-900-2-3 A is NOT represented by this plant. .param RI=1meg CI=1u RFB=10meg CHF=10n RPOT=50k .param NH=20 COURT=75 SERVE=62 G=60 .param A0=10k FP=1 VRAIL=110 ROUT=100 .param RCOIL=10k LCOIL=10 IPICK=50u IHYS=15u .func hi(a) {(1+tanh((a-50)/2))/2} .func positive(a) {(1+tanh(a/.2))/2} .global logic railp railm Vlogic logic 0 100 Vp railp 0 {VRAIL} Vm railm 0 {-VRAIL} Vgravity grav 0 {-G} VknobL knob_l 0 .65 VknobR knob_r 0 .65 VbuttonL button_l_input 0 PWL(0 0 .25 0 .25000001 10 .31 10 .31000001 0) VbuttonR button_r_input 0 PWL(0 0 1.75 0 1.75000001 10 1.81 10 1.81000001 0) Vreset reset_input 0 0 RbuttonL button_l_input button_l 1k CbuttonL button_l 0 100n RbuttonR button_r_input button_r 1k CbuttonR button_r 0 100n Rreset reset_input reset 1k Creset reset 0 100n * Finite-gain, dominant-pole amplifier macro-model. Explicit engineering * substitute: the transistor/tube implementation of a Donner 30 is unresolved. .subckt OA s out Berror target 0 V=min(max(-{A0}*V(s),-10000),10000) Rpole target pole {1/(6.283185307179586*FP*1u)} Cpole pole 0 1u Dpositive pole railp DCLAMP Dnegative railm pole DCLAMP Ebuffer buffer 0 pole 0 1 Rout buffer out {ROUT} .ends OA .model DCLAMP D(Is=1e-12 N=1 Rs=1) .model DGE D(Is=1u N=1.5 Rs=20) .subckt CONTACT a b control Bcontact a b I=V(a,b)*(1p+(.02-1p)*(1+tanh((V(control)-55)/.8))/2) .ends CONTACT * Sensitive relay: rectifier, measured-current R-L coil, flyback path, * continuous hysteretic pickup and RC armature surrogate. R/L/thresholds are unmeasured. .subckt RELAY drive contact params: I0=0 Ddrive drive cp DGE Dflyback 0 cp DGE Rcoil cp cn {RCOIL} Lcoil cn sense {LCOIL} ic={I0} Vsense sense 0 0 Bpickup target 0 V=100*(1+tanh((I(Vsense)-{IPICK}+{IHYS}*(V(contact)/50-1))/5u))/2 Rarmature target contact 1k Rrelease contact 0 2k Carmature contact 0 1u .ends RELAY * Bistable contact macro-model. Reset has priority. Charge on Q is retained through * a finite-conductance feedback contact; all memory is capacitor charge. .subckt LATCH set reset q Bkeep logic q I=V(logic,q)*(1p+.001*hi(V(q))) Bset logic q I=V(logic,q)*(1p+.001*hi(V(set))*(1-hi(V(reset)))) Breset q 0 I=V(q)*(1p+.1*hi(V(reset))) Rpull q 0 100k Cmemory q 0 1u .ends LATCH * RY1B..J: four 1 uF controller banks. A capacitor is either charging through * its 50 kOhm path, or connected to the amplifier feedback by two contacts. .subckt BANK sum out ref active p n Vsense cp p 0 Cbank cp n {CI} XfeedbackP p sum active CONTACT XfeedbackN n out active CONTACT Bnot off 0 V=100-V(active) XchargeP p charging off CONTACT Rcharge charging ref {RPOT} XchargeN n 0 off CONTACT .ends BANK * Linked control transfers: explicit adjustable reconstruction calibration. BleftX ref_lx 0 V=100-50*V(knob_l) BleftY ref_ly 0 V=20+85*V(knob_l) BrightX ref_rx 0 V=-(100-50*V(knob_r)) BrightY ref_ry 0 V=20+85*V(knob_r) BselL active_l 0 V=100*hi(V(run_contact))*(1-hi(V(bank))) BselR active_r 0 V=100*hi(V(run_contact))*hi(V(bank)) Xly sy u1 ref_ly active_l lyp lyn BANK Xry sy u1 ref_ry active_r ryp ryn BANK Xlx sx u6 ref_lx active_l lxp lxn BANK Xrx sx u6 ref_rx active_r rxp rxn BANK * U1/U2 and U6/U7: archival 1 megOhm / 1 uF computing chain, with the * 10 megOhm || .01 uF high-frequency feedback branches retained. Rg grav sy {RI} Ryfb sy u1 {RFB} Cyhf sy u1 {CHF} XU1 sy u1 OA Rypos u1 py {RI} Cypos py y {CI} XU2 py y OA Rxfb sx u6 {RFB} Cxhf sx u6 {CHF} XU6 sx u6 OA Rxpos u6 px {RI} Cxpos px x {CI} XU7 px x OA * RY3A/B: 10 uF ground holding network. In sample mode A=0, B=U1 through * 10 kOhm. In bounce mode A=U1, B=sum. Charge redistribution performs bounce. Cground ga gb 10u Rgsample u1 gs 10k BgroundNot ground_not 0 V=100-V(ground_contact) XgroundA0 ga 0 ground_not CONTACT XgroundB0 gb gs ground_not CONTACT XgroundA1 ga u1 ground_contact CONTACT XgroundB1 gb sy ground_contact CONTACT * RY4A/B: 5 uF net holding capacitor, likewise switched with its polarity * reversed into the horizontal feedback path. No restitution multiplier. Cnet na nb 5u BnetNot net_not 0 V=100-V(net_contact) XnetA0 na u6 net_not CONTACT XnetB0 nb 0 net_not CONTACT XnetA1 na sx net_contact CONTACT XnetB1 nb u6 net_contact CONTACT * U3 - unity inverter below the net plane. U4 - adjustable ground detector. Ru3 y s3 1meg Rf3 s3 u3 1meg XU3 s3 u3 OA Vheight h_ref 0 {NH} Ru4a y s4 100k Ru4b h_ref s4 100k Rf4 s4 u4 1meg XU4 s4 u4 OA Xground u4 ground_contact RELAY * U8/U9: symmetric end references. Comparator macro-model polarity is an * explicit working interpretation of the archival diode OR, correction C02. BendR end_r 0 V=min(max(10000*(V(x)-{COURT}),-100),100) BendL end_l 0 V=min(max(10000*(-V(x)-{COURT}),-100),100) DendR end_r end_drive DGE DendL end_l end_drive DGE Rend end_drive 0 1meg Xend end_drive end_contact RELAY * U10/RY5 centre detector. The symmetric RC edge gate corrects the incomplete * one-sided net gating of the surviving drawing (C03); no position is clamped. Bcentre centre_drive 0 V=min(max(10000*V(x),-100),100) Xcentre centre_drive centre_contact RELAY Bedgestep edge_source 0 V=V(centre_contact) Cedge edge_source edge 1n Redge edge 0 10meg Bedgeabs edge_abs 0 V=abs(V(edge)) BnetGate u3 net_drive I=V(u3,net_drive)*(1p+(.02-1p)*(1+tanh((V(edge_abs)-1)/.05))/2) RnetDrive net_drive 0 1meg Xnet net_drive net_contact RELAY * Electrical button conditioning and player interlock. The B sources are * documented logic macro-models (C04), not a transcription of every RY1 wire. BhitL hit_l_drive 0 V=60*hi(10*V(button_l))*hi(V(can_l)) BhitR hit_r_drive 0 V=60*hi(10*V(button_r))*hi(V(can_r)) XhitL hit_l_drive hit_l_contact RELAY XhitR hit_r_drive hit_r_contact RELAY BsetRun set_run 0 V=max(V(hit_l_contact),V(hit_r_contact)) BresetRun reset_run 0 V=max(V(end_contact),V(reset)) XrunLatch set_run reset_run run LATCH BrunDrive run_drive 0 V=.6*V(run) Xrun run_drive run_contact RELAY Xbank hit_r_contact hit_l_contact bank LATCH BsetServer set_server 0 V=100*hi(V(end_contact))*positive(V(end_r)) BresetServer reset_server 0 V=max(V(reset),100*hi(V(end_contact))*positive(V(end_l))) Xserver set_server reset_server server LATCH BresetPermits reset_permits 0 V=max(V(reset_run),100-V(run)) BsetL set_l 0 V=100*hi(V(bank))*(1-hi(V(centre_contact)))*positive(V(y)) BsetR set_r 0 V=100*(1-hi(V(bank)))*hi(V(centre_contact))*positive(V(y)) BresetL reset_l 0 V=max(V(reset_permits),V(hit_l_contact)) BresetR reset_r 0 V=max(V(reset_permits),V(hit_r_contact)) XpermitL set_l reset_l permit_l LATCH XpermitR set_r reset_r permit_r LATCH BcanL can_l 0 V=100*(1-hi(V(run_contact)))*(1-hi(V(server)))+hi(V(run_contact))*V(permit_l) BcanR can_r 0 V=100*(1-hi(V(run_contact)))*hi(V(server))+hi(V(run_contact))*V(permit_r) * RY2 reset/hold contacts. They establish starting voltages by current flow. * X offset source is an explicit serve-position calibration (C05). Bhold hold 0 V=100-V(run_contact) XholdY sy u1 hold CONTACT XholdX sx u6 hold CONTACT XholdPosY py y hold CONTACT Bserve x x_hold V={SERVE}*(2*hi(V(server))-1) XholdPosX px x_hold hold CONTACT * Named telemetry. These voltage probes do not feed the plant. BpreLX pre_lx 0 V=-V(lxp,lxn) BpreLY pre_ly 0 V=-V(lyp,lyn) BpreRX pre_rx 0 V=-V(rxp,rxn) BpreRY pre_ry 0 V=-V(ryp,ryn) .save v(u1) v(y) v(u6) v(x) v(pre_lx) v(pre_ly) v(pre_rx) v(pre_ry) + v(run) v(run_contact) v(can_l) v(can_r) v(server) v(bank) + v(ground_contact) v(net_contact) v(centre_contact) v(end_contact) + i(v.xground.vsense) i(v.xnet.vsense) i(v.xrun.vsense) + i(v.xly.vsense) i(v.xry.vsense) i(v.xlx.vsense) i(v.xrx.vsense) .save v(sy) v(sx) v(py) v(px) v(ga) v(gb) v(na) v(nb) v(edge_source) v(edge) v(button_l) v(button_r) v(reset) v(permit_l) v(permit_r) v(xly.cp) v(lyn) v(xry.cp) v(ryn) v(xlx.cp) v(lxn) v(xrx.cp) v(rxn) v(xu1.pole) v(xu2.pole) v(xu3.pole) v(xu4.pole) v(xu6.pole) v(xu7.pole) v(hit_l_contact) v(hit_r_contact) i(v.xend.vsense) i(v.xcentre.vsense) i(v.xhitl.vsense) i(v.xhitr.vsense) v(railp) v(railm) v(logic) v(grav) .options method=gear maxord=2 reltol=1e-5 abstol=1e-9 vntol=1e-6 chgtol=1p .options interp .control set numdgt=15 tran 1m 4 0 1m uic set wr_singlescale set wr_vecnames wrdata tennis-demo.dat v(x) v(y) v(u1) v(u6) quit .endc .end