__ses_path_dr_forward()
authoryu.dongliang <18588496441@163.com>
Wed, 25 Oct 2023 08:42:58 +0000 (16:42 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 25 Oct 2023 08:42:58 +0000 (16:42 +0800)
ses_step_dc_transistor.c
ses_step_va_diode.c
ses_step_va_transistor.c
ses_steps.c

index 156f582f9a13679ec45edf3907e4970a7013e15e..3b3ccd031f9ed7652731570656722394b1ec7b2b 100644 (file)
@@ -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;
index 6df9d0ed310e755789ee8e50ebd99333e5f6496d..5dee919150cb21bc5606287f6d00ff972220af4d 100644 (file)
@@ -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);
                }
        }
 }
index 370e05f40cb3c0cb57aa6912c3c55c32d348b884..a54240f84e28770e7cb716dc5a099947fefdebc6 100644 (file)
@@ -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;
        }
 
index 2e1c5b7f3831cec770f62b5c8051b847265d0e09..056a1c11e7d6d14ffbe785a79fe5f2d0dfe9367d 100644 (file)
@@ -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)