From 4a32cb581490e463027c22f50fb39d55f12998f2 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 24 Oct 2023 21:00:26 +0800 Subject: [PATCH] tmp --- ses_step_va_diode.c | 35 +++++++++++++++++++++++++++++------ ses_step_va_transistor.c | 17 +++++++++++++++-- ses_steps.c | 2 +- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 1c51569..ac9cb7f 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -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]; diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index 9124a81..6b3016a 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -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; } diff --git a/ses_steps.c b/ses_steps.c index 023125b..2e1c5b7 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -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) -- 2.25.1