tmp
authoryu.dongliang <18588496441@163.com>
Sun, 10 Sep 2023 15:40:56 +0000 (23:40 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 10 Sep 2023 15:40:56 +0000 (23:40 +0800)
scf_eda_pb.h
ses_step_dc_diode.c
ses_step_dc_input.c
ses_step_dc_transistor.c

index 8f2aecf2cd37c2409bf9655752ef38443b27ad0b..a1586c4998a8ccf6c8fd2e727a49cd8d901b463f 100644 (file)
@@ -27,6 +27,9 @@ enum {
 #define SCF_EDA_V_MIN    -10000000.0
 #define SCF_EDA_V_MAX     10000000.0
 
+#define SCF_EDA_V_Diode_ON  0.69
+#define SCF_EDA_V_Diode_OFF 0.70
+
 enum {
        SCF_EDA_Battery_NEG,
        SCF_EDA_Battery_POS,
index 63d9a459498178c1baba978e7931d4222b563b09..98ea75443185320c8bb5e6cae22cdc2ee013f0fe 100644 (file)
@@ -33,9 +33,9 @@ static int _dc_diode_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx
                        p0->v = el->v;
 
                        if (SCF_EDA_Diode_NEG == p0->id)
-                               p1->v = p0->v + 0.7;
+                               p1->v = p0->v + SCF_EDA_V_Diode_ON;
                        else
-                               p1->v = p0->v - 0.7;
+                               p1->v = p0->v - SCF_EDA_V_Diode_ON;
 
                        if (p1->v > B->v || p1->v < 0)
                                c->status = SCF_EDA_Status_OFF;
index 212beb355abac2816a63997b05603f449252f333..2a280439f9a7a384e31ac8734e98537317b574ce 100644 (file)
@@ -17,7 +17,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx
 
                if (SCF_EDA_PIN_IN & el->flags) {
 
-                       el->v = (0x1) * B->v;
+                       el->v = (rand() & 0x1) * B->v;
                        el->vconst = 1;
 
                        scf_logw("IN el: %ld, V: %lg\n", el->id, el->v);
index d8200bcfd0c0bb6caca0fdbf2d7493f43cace10b..794610e3fdcccc6e364e501b2aa0af4d519b0fc2 100644 (file)
@@ -39,7 +39,7 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                                continue;
 
                        pe->v = le->v;
-                       pb->v = le->v + 0.7;
+                       pb->v = le->v + SCF_EDA_V_Diode_ON;
                        lb->v = pb->v;
 
                        if (le->v == Bn->v)
@@ -50,7 +50,7 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                } else if (le->v < SCF_EDA_V_MIN) {
 
                        pb->v = lb->v;
-                       pe->v = lb->v - 0.7;
+                       pe->v = lb->v - SCF_EDA_V_Diode_ON;
                        le->v = pe->v;
 
                        if (lb->v == Bp->v)
@@ -58,7 +58,7 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
 
                        c->status  = SCF_EDA_Status_ON;
 
-               } else if (lb->v >= le->v + 0.7) {
+               } else if (lb->v >= le->v + SCF_EDA_V_Diode_OFF) {
 
                        if (le->v == Bn->v) {
                                if (lb->v == Bp->v) {
@@ -71,7 +71,7 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se
                        } else if (lb->v == Bp->v)
                                le->vconst = 1;
 
-                       lb->v = le->v + 0.7;
+                       lb->v = le->v + SCF_EDA_V_Diode_ON;
                        pb->v = lb->v;
                        pe->v = le->v;