From 9e315ee6cdbdb751a23c8ff90557d36ac98b5199 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Mon, 23 Oct 2023 22:20:33 +0800 Subject: [PATCH] __ses_status_check() --- ses_step_va_transistor.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index ec93c57..07c054f 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -25,6 +25,7 @@ void __ses_path_dr_transistor(ScfEfunction* f, ses_path_t* path, int i, int j) int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin* pe) { ScfEcomponent* B = f->components[0]; + ScfEpin* Bp = B->pins[SCF_EDA_Battery_POS]; ScfEpin* Bn = B->pins[SCF_EDA_Battery_NEG]; double DV = SCF_EDA_V_NPN_OFF; @@ -35,7 +36,23 @@ int __ses_status_check(ScfEfunction* f, ScfEcomponent* c, ScfEpin* pb, ScfEpin* pb->v = f->elines[pb->lid]->v; pe->v = f->elines[pe->lid]->v; - if (pe->v < SCF_EDA_V_MIN) { + if (pb->v < SCF_EDA_V_MIN) { + + if (pe->v < SCF_EDA_V_MIN) + return 0; + + pb->v = pe->v + DV; + + if (pb->v > Bp->v) { + pb->v = Bp->v; + c->status = SCF_EDA_Status_OFF; + } else + c->status = SCF_EDA_Status_ON; + + scf_loge("\033[34mc%ld, status: %d\033[0m\n", c->id, c->status); + return 1; + + } else if (pe->v < SCF_EDA_V_MIN) { pe->v = pb->v - DV; if (pe->v < Bn->v) { -- 2.25.1