summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2020-11-24 17:58:30 +1100
committerDamien Zammit <damien@zamaudio.com>2020-12-01 14:08:00 +1100
commite25f001825f04d96419a0306be80aa4c21463e31 (patch)
treeb004ce4b92a1d6811c09d288031dc92116d2d948
parent30ac8e0de1ad650edfa068cde562f6b613dd2fb9 (diff)
ZamTube: Introduce diode to attain grid bias
-rw-r--r--plugins/ZamTube/wdfcircuits.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/ZamTube/wdfcircuits.h b/plugins/ZamTube/wdfcircuits.h
index 5bf2e93..99c5eb7 100644
--- a/plugins/ZamTube/wdfcircuits.h
+++ b/plugins/ZamTube/wdfcircuits.h
@@ -118,12 +118,14 @@ public:
//RkGetB
//P1_2SetA
//Call tube model
- Vg = -S1_3b3;
- Vk = -P1_3b3;
- Real b = -t.compute(S2_3b3, S2_3Gamma1, Vg, Vk);
+ Real Vd = Vg-Vk;
+ Real Rd = (Vd > 0.) ? 2e+3 : 100e+9;
+ Vg = (S1_3b3);
+ Vk = -(P1_3b3 - Vg * S1_3Gamma1 / Rd);
+ Real b = t.compute(S2_3b3, S2_3Gamma1, Vg, Vk);
//Set As
//S2_3SetA
- Real S2_3b1 = P2_3b3 - S2_3Gamma1*(P2_3b3 + P1_3b3 + b);
+ Real S2_3b1 = P2_3b3 - S2_3Gamma1*(P2_3b3 - Vk + b);
//P2_3SetA
Real P2_3b1 = S2_3b1 + E500E - S3_3b3 - P2_3Gamma1*(E500E - S3_3b3);
//S3_3SetA
@@ -132,7 +134,7 @@ public:
Real S3_3b2 = Cob + P2_3b1 - S3_3Gamma1*(Cob + P2_3b1);
//RoSetA
Real Roa = S3_3b2;
- Real S2_3b2 = P2_3b3 + b - S2_3Gamma1*(P2_3b3 + P1_3b3 + b);
+ Real S2_3b2 = P2_3b3 + b - S2_3Gamma1*(P2_3b3 - Vk + b);
//P1_3SetA
Real P1_3b1 = S2_3b2 - Ckb - P1_3Gamma1*(-Ckb);
Cka = P1_3b1;
@@ -143,7 +145,7 @@ public:
//S0_3SetA
//Cia = S0_3b1;
//RiSetA
- //printf("Vk=%f Vg=%f Vpk=%f in=%f out=%f\n", Vk,Vg,S2_3b3, ViE,Roa);
+ //printf("Vk=%f Vg=%f Vd=%f in=%f out=%f\n", Vk,Vg,Vd, ViE,Roa);
return Roa;
}