From: yu.dongliang <18588496441@163.com> Date: Wed, 25 Oct 2023 08:42:58 +0000 (+0800) Subject: __ses_path_dr_forward() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=db372e218a678b48e6179cc5477e3578e2fd8577;p=ses.git __ses_path_dr_forward() --- diff --git a/ses_step_dc_transistor.c b/ses_step_dc_transistor.c index 156f582..3b3ccd0 100644 --- a/ses_step_dc_transistor.c +++ b/ses_step_dc_transistor.c @@ -52,7 +52,10 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se if (le->v == Bn->v) lb->vconst = 1; - c->status = SCF_EDA_Status_ON; + if (pb->v > Bp->v) + c->status = SCF_EDA_Status_OFF; + else + c->status = SCF_EDA_Status_ON; } else if (le->v < SCF_EDA_V_MIN) { @@ -63,7 +66,10 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se if (lb->v == Bp->v) le->vconst = 1; - c->status = SCF_EDA_Status_ON; + if (pe->v < Bn->v) + c->status = SCF_EDA_Status_OFF; + else + c->status = SCF_EDA_Status_ON; } else if (lb->v >= le->v + SCF_EDA_V_NPN_OFF) { @@ -82,11 +88,18 @@ static int _dc_transistor_handler(ScfEfunction* f, int64_t ns, int64_t count, se pb->v = lb->v; pe->v = le->v; - c->status = SCF_EDA_Status_ON; - } else + if (pb->v > Bp->v) + c->status = SCF_EDA_Status_OFF; + else + c->status = SCF_EDA_Status_ON; + } else { + pb->v = lb->v; + pe->v = le->v; c->status = SCF_EDA_Status_OFF; + } - scf_loge("\033[34mNPN c%ld, status: %d\033[0m\n", c->id, c->status); + scf_loge("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, off: %lg\033[0m\n", + c->id, c->status, pb->v, pe->v, pb->v - pe->v, SCF_EDA_V_NPN_OFF); } return 0; diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 6df9d0e..5dee919 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -120,7 +120,7 @@ void __ses_path_dr_forward(ScfEfunction* f, ses_path_t* path, int i, int j, doub } else if (SCF_EDA_NPN == c->type && SCF_EDA_NPN_B == p->id) { - ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_OFF, 0, a, ja); + ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_ON, 0, a, ja); p->dr -= p->r; p->jdr -= p->jr; @@ -131,7 +131,7 @@ void __ses_path_dr_forward(ScfEfunction* f, ses_path_t* path, int i, int j, doub p1->aconst = 1; scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg, c%ldp%ld->a: %lg\n", - p->cid, p->id, SCF_EDA_V_NPN_OFF, p->r, a, p->dr, p1->cid, p1->id, p1->a); + p->cid, p->id, SCF_EDA_V_NPN_ON, p->r, a, p->dr, p1->cid, p1->id, p1->a); p1 = c->pins[SCF_EDA_NPN_E]; p1->a = (1 + p1->hfe) * a; @@ -189,12 +189,12 @@ void __ses_path_dr_reverse(ScfEfunction* f, ses_path_t* path, int i, int j, doub p1->ja = p1->hfe * ja; p1->aconst = 1; - ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_OFF, 0, a, ja); + ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_ON, 0, a, ja); p->dr -= p->r; p->jdr -= p->jr; - scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg\n", p->cid, p->id, SCF_EDA_V_NPN_OFF, p->r, a, p->dr); + scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg\n", p->cid, p->id, SCF_EDA_V_NPN_ON, p->r, a, p->dr); } } } diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index 370e05f..a54240f 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -67,14 +67,10 @@ int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin* if (c->status != SCF_EDA_Status_OFF) { c->status = SCF_EDA_Status_OFF; - scf_logi("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, Von: %lg, Voff: %lg\033[0m\n", - c->id, c->status, pb->v, pe->v, pb->v - pe->v, Von, Voff); goto _changed; } } else if (SCF_EDA_Status_ON != c->status) { c->status = SCF_EDA_Status_ON; - scf_logi("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, Von: %lg, Voff: %lg\033[0m\n", - c->id, c->status, pb->v, pe->v, pb->v - pe->v, Von, Voff); goto _changed; } diff --git a/ses_steps.c b/ses_steps.c index 2e1c5b7..056a1c1 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -47,7 +47,7 @@ static ses_step_t* ses_steps_1[] = &ses_step_jr, &ses_step_va, &ses_step_va_bridge, - &ses_step_va_balance, +// &ses_step_va_balance, #endif }; @@ -141,7 +141,7 @@ int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count) return ret; int j; - for (j = 0; j < 1; j++) { + for (j = 0; j < 3; j++) { ret = __ses_steps_analyse(f, ns, i, ctx); if (-EAGAIN == ret)