tmp
authoryu.dongliang <18588496441@163.com>
Tue, 24 Oct 2023 13:00:26 +0000 (21:00 +0800)
committeryu.dongliang <18588496441@163.com>
Tue, 24 Oct 2023 13:00:26 +0000 (21:00 +0800)
ses_step_va_diode.c
ses_step_va_transistor.c
ses_steps.c

index 1c5156910436b40a0f62bf9b6c8a41e605453db2..ac9cb7f75f57bc31fff87510b2f96d2cca9efe1a 100644 (file)
@@ -1,5 +1,7 @@
 #include"ses_core.h"
 
+static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path);
+
 void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double la, double jla, double* a, double* ja)
 {
        ScfEcomponent* c;
@@ -41,9 +43,15 @@ void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double
                                        j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, child->r, r, child->a, la);
 
                } else {
-                       ses_split_i(&child->a, &child->ja, la, jla, child->r, child->jr, r, jr);
 
-                       scf_logw("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, child->r: %lg, r: %lg, child->a: %lg, el->a: %lg\n",
+                       int ret = __ses_path_va_diode(f, child);
+                       if (ret < 0) {
+                               scf_loge("ret: %d\n", ret);
+
+                               ses_split_i(&child->a, &child->ja, la, jla, child->r, child->jr, r, jr);
+                       }
+
+                       scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, child->r: %lg, r: %lg, child->a: %lg, el->a: %lg\n",
                                        j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, child->r, r, child->a, la);
                }
 
@@ -243,8 +251,8 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                el = f->elines    [pi->lid];
                c  = f->components[pi->cid];
 
-               if (!el->vconst)
-                       break;
+//             if (!el->vconst)
+//                     break;
 
                pi->v  = el->v;
                pi->jv = el->jv;
@@ -265,8 +273,8 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                el = f->elines    [pj->lid];
                c  = f->components[pj->cid];
 
-               if (!el->vconst)
-                       break;
+//             if (!el->vconst)
+//                     break;
 
                pj->v  = el->v;
                pj->jv = el->jv;
@@ -286,8 +294,20 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                return -1;
        }
 
+       int    __ni = i / 2;
+       int    __nj = (path->pins->size - 1 - j) / 2;
+       double __vi = p0->v - SCF_EDA_V_Diode_ON * __ni;
+       double __vj = p1->v + SCF_EDA_V_Diode_ON * __nj;
+
+       scf_logi("i: %d, j: %d, c%ldp%ld--c%ldp%ld, ni: %d, nj: %d, vi: %lg, vj: %lg\n",
+                       i, j, pi->cid, pi->id, pj->cid, pj->id, __ni, __nj, __vi, __vj);
+
+       pi->v = __vi;
+       pj->v = __vj;
+
        if (j  < path->pins->size - 1)
                pj = path->pins->data[++j];
+       pj->v = __vj;
 
        double v   = pi->v   - pj->v;
        double jv  = pi->jv  - pj->jv;
@@ -310,6 +330,8 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
 
        c = f->components[pj->cid];
 
+       scf_logi("i: %d, j: %d, c%ldp%ld--c%ldp%ld, a: %lg\n", i, j, pi->cid, pi->id, pj->cid, pj->id, a);
+
        if (SCF_EDA_Diode == c->type && SCF_EDA_Diode_POS == pj->id) {
 
                el         = f->elines[pj->lid];
@@ -352,6 +374,7 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
 
        if (i  > 0)
                pi = path->pins->data[--i];
+       pi->v = __vi;
 
        c = f->components[pi->cid];
 
index 9124a816aa4d6372f748516dd07ee3d9fe4f7822..6b3016a9d43618f95da4ca678aaf7dbe65d6bf93 100644 (file)
@@ -236,13 +236,26 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
                el->jv = pc->jv;
                el->a  = pc->a;
                el->ja = pc->ja;
+               el->vconst = 1;
 
                scf_logw("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, pc->dr: %lg\n",
                                i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, pc->dr);
 
-               if (path->childs)
+               if (path->childs) {
                        __ses_path_split_i(f, path, i, path->pins->size - 1, el->a, el->ja, &pc->a,  &pc->ja);
-               else {
+
+                       if (i > 0) {
+                               p     = path->pins->data[i - 1];
+                               p->a  = el->a;
+                               p->ja = el->ja;
+                               p->v  = el->v;
+                               p->jv = el->jv;
+
+                               scf_logi("--------------\n");
+                               __ses_path_split_i(f, path, 0, i - 1, el->a, el->ja, &p->a,  &p->ja);
+                               scf_logi("--------------\n\n");
+                       }
+               } else {
                        p0->a  = el->a;
                        p0->ja = el->ja;
                }
index 023125be61ddec8cab3d38400cfcc482648cc037..2e1c5b7f3831cec770f62b5c8051b847265d0e09 100644 (file)
@@ -141,7 +141,7 @@ int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count)
                        return ret;
 
                int j;
-               for (j = 0; j < 2; j++) {
+               for (j = 0; j < 1; j++) {
                        ret = __ses_steps_analyse(f, ns, i, ctx);
 
                        if (-EAGAIN == ret)