From: yu.dongliang <18588496441@163.com> Date: Sun, 10 Sep 2023 15:40:56 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=1cffb7c43ef636506c609710401f2149c1fec903;p=ses.git tmp --- diff --git a/scf_eda_pb.h b/scf_eda_pb.h index 8f2aecf..a1586c4 100644 --- a/scf_eda_pb.h +++ b/scf_eda_pb.h @@ -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, diff --git a/ses_step_dc_diode.c b/ses_step_dc_diode.c index 63d9a45..98ea754 100644 --- a/ses_step_dc_diode.c +++ b/ses_step_dc_diode.c @@ -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; diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index 212beb3..2a28043 100644 --- a/ses_step_dc_input.c +++ b/ses_step_dc_input.c @@ -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); diff --git a/ses_step_dc_transistor.c b/ses_step_dc_transistor.c index d8200bc..794610e 100644 --- a/ses_step_dc_transistor.c +++ b/ses_step_dc_transistor.c @@ -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;