__ses_path_va_transistor()
authoryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 09:34:38 +0000 (17:34 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 19 Oct 2023 09:34:38 +0000 (17:34 +0800)
ses_step_va_transistor.c

index f1ee3e0c85f48eca8c5f63f66eca5abc4c097817..4409be63a9a881b6bab6e991ada4fc2ad9db7cc5 100644 (file)
@@ -26,9 +26,12 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
 {
        ses_path_t*    child;
        ScfEcomponent* c;
+       ScfEcomponent* B;
        ScfEline*      el;
        ScfEpin*       p0;
        ScfEpin*       p1;
+       ScfEpin*       Bp;
+       ScfEpin*       Bn;
 
        ScfEpin*       p;
        ScfEpin*       pb;
@@ -39,6 +42,10 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
        int j;
        int k;
 
+       B  = f->components[0];
+       Bp = B->pins[SCF_EDA_Battery_POS];
+       Bn = B->pins[SCF_EDA_Battery_NEG];
+
        p0 = path->pins->data[0];
        p1 = path->pins->data[path->pins->size - 1];
 
@@ -65,7 +72,7 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
                if (!pc->aconst)
                        continue;
 
-               p   = path->pins->data[i - 1];
+               p = path->pins->data[i - 1];
 
                double v;
                double jv;
@@ -73,37 +80,42 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
                double pr;
                double jpr;
 
-               pr  = p->pr  - p0->pr;
-               jpr = p->jpr - p0->jpr;
+               double _pr;
+               double _jpr;
+
+               __ses_path_pr(f, path, 0, i, NULL, &pr, &jpr);
+
+               pr  += path->parent_r0;
+               jpr += path->parent_jr0;
 
                ses_ir_u(&v, &jv, pc->a, pc->ja, pr, jpr);
 
-               pc->v  = p0->v  - v;
-               pc->jv = p0->jv - jv;
+               pc->v  = Bp->v  - v;
+               pc->jv = Bp->jv - jv;
 
                if (pc->v < p1->v) {
-                       v     = p0->v   - p1->v;
-                       jv    = p0->jv  - p1->jv;
+                       v     = Bp->v  - p1->v;
+                       jv    = Bp->jv - p1->jv;
 
-                       pr    = pc->sr  - p0->pr;
-                       jpr   = pc->jsr - p0->jpr;
+                       _pr   = pc->pr  + path->parent_r0;
+                       _jpr  = pc->jpr + path->parent_jr0;
 
-                       ses_ur_i(&pc->a, &pc->ja, v, jv, pr, jpr);
+                       ses_ur_i(&pc->a, &pc->ja, v, jv, _pr, _jpr);
 
-                       pr    = p->pr  - p0->pr;
-                       jpr   = p->jpr - p0->jpr;
+                       scf_logi("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, _pr: %lg pc->pr: %lg\n",
+                                       i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, _pr, pc->pr);
 
                        ses_ir_u(&v, &jv, pc->a, pc->ja, pr, jpr);
 
-                       pc->v  = p0->v  - v;
-                       pc->jv = p0->jv - jv;
+                       pc->v  = Bp->v  - v;
+                       pc->jv = Bp->jv - jv;
                }
 
                el->v  = pc->v;
                el->jv = pc->jv;
                el->a  = pc->a;
                el->ja = pc->ja;
-
+#if 0
                p->v   = el->v;
                p->jv  = el->jv;
                p->a   = el->a;
@@ -115,7 +127,7 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
                        p0->a  = el->a;
                        p0->ja = el->ja;
                }
-
+#endif
                __ses_path_dr_transistor(f, path, i, path->pins->size - 1);
 
                scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, pc->dr: %lg\n",