__ses_path_va_diode()
authoryu.dongliang <18588496441@163.com>
Mon, 13 Nov 2023 06:34:37 +0000 (14:34 +0800)
committeryu.dongliang <18588496441@163.com>
Mon, 13 Nov 2023 06:34:37 +0000 (14:34 +0800)
ses_step_dc_input.c
ses_step_jr.c
ses_step_va_diode.c
ses_steps.c

index 835f3e30ef098085e8146cd65ec9fdca8be1c147..736da1ee1de8fe327ad017564194d6f0ccd292f1 100644 (file)
@@ -22,7 +22,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx
                if (!(SCF_EDA_PIN_IN & el->flags))
                        continue;
 
-               k   = 0 % 2;
+               k   = 1 % 2;
                el2 = f->elines[B->pins[k]->lid];
 
                el->v      = k * B->v;
index 4cfc1ec8f8e90135599b1b5fe5e35612b0cdbff2..b7399282b8f1dcd60b19ab40af81d117e182d2d8 100644 (file)
@@ -64,8 +64,8 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
                        p1 = path->pins->data[j - 1];
                        c1 = f->components[p1->cid];
 
-//                     if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id)
-//                             p1 = path->pins->data[j - 2];
+                       if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id)
+                               p1 = path->pins->data[j - 2];
                } else {
                        *r  = 0;
                        *jr = 0;
@@ -96,7 +96,7 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1
                *r  = p1->pr  - p0->pr;
                *jr = p1->jpr - p0->jpr;
        }
-       scf_loge("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr);
+       scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr);
 }
 
 static int __ses_path_jr(ScfEfunction* f, ses_path_t* path)
index 62b81924c848476670407c3c69facc520613fc07..47330d35fa4e444d45f987af10e87cc4822fe18b 100644 (file)
@@ -233,7 +233,7 @@ static void __ses_path_a_diode(ScfEfunction* f, ses_path_t* path, int k, double*
                r  += _r;
                jr += _jr;
 
-               scf_logi("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, _r: %lg\n", pi->cid, pi->id, pj->cid, pj->id, r, v, _r);
+               scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, _r: %lg\n", pi->cid, pi->id, pj->cid, pj->id, r, v, _r);
 
                i = info->j;
        }
@@ -262,13 +262,11 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
 
        ScfEcomponent* c;
        ScfEline*      el;
-       ScfEpin*       p;
        ScfEpin*       p0;
        ScfEpin*       p1;
        ScfEpin*       pi;
        ScfEpin*       pj;
 
-       int i;
        int j;
 
        if (path->n_diodes * 2 >= path->pins->size) {
@@ -290,24 +288,15 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
        p1->v  = el->v;
        p1->jv = el->jv;
 
-       double v  = p0->v   - p1->v;
-       double jv = p0->jv  - p1->jv;
+       double v;
+       double jv;
 
-       double r  = 0;
-       double jr = 0;
+       double r;
+       double jr;
 
        double a;
        double ja;
 
-       __ses_path_a_diode(f, path, 0, &a, &ja);
-
-       path->a  = a;
-       path->ja = ja;
-
-       i = 0;
-
-       scf_logi("**************\n");
-
        for (j = 0; j < path->diodes->size; j++) {
                info      = path->diodes->data[j];
                pi        = path->pins->data[info->i];
@@ -318,12 +307,17 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                assert((SCF_EDA_Diode == c->type && SCF_EDA_Diode_POS == pi->id)
                        || (SCF_EDA_NPN   == c->type && SCF_EDA_NPN_B     == pi->id));
 
+               __ses_path_a_diode(f, path, j, &a, &ja);
+
+               if (0 == j) {
+                       path->a  = a;
+                       path->ja = ja;
+               }
+
                pi->a  = a;
                pi->ja = ja;
 
-               scf_logi("j: %d, ---------------\n", j);
-
-               __ses_path_pr(f, path, i, info->i, NULL, &r, &jr);
+               __ses_path_pr(f, path, 0, info->i, NULL, &r, &jr);
 
                ses_ir_u(&v, &jv, a, ja, r, jr);
 
@@ -357,7 +351,6 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
                                info->i, info->j, pi->cid, pi->id, pj->cid, pj->id, pi->v, pj->v, pi->a);
 
                __ses_path_dr_forward(f, path, info->i, info->j, pi->a, pi->ja);
-               printf("\n");
        }
 
        return 0;
index 27623ed1a35347bb17b9332f4904bda6ae96e3b8..044cbc92bcf8c946bf7e101167eb50e19858cc48 100644 (file)
@@ -43,7 +43,7 @@ static ses_step_t*  ses_steps_1[] =
 
        &ses_step_va_diode,
        &ses_step_va_transistor,
-#if 0
+#if 1
        &ses_step_jr,
        &ses_step_va,
        &ses_step_va_bridge,
@@ -144,7 +144,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++) {
                        printf("\n\033[33m%s(), %d(), j: %d\033[0m\n", __func__, __LINE__, j);
 
                        ret = __ses_steps_analyse(f, ns, i, ctx);