__ses_status_check()
authoryu.dongliang <18588496441@163.com>
Mon, 23 Oct 2023 14:20:33 +0000 (22:20 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 23 Oct 2023 14:20:33 +0000 (22:20 +0800)
ses_step_va_transistor.c

index ec93c5726bfb86e7e94256186c9623e31079ea18..07c054f83b1b02895fcf6e9f74c2637b3840e386 100644 (file)
@@ -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) {