From 45c589fc97b78546b5f92a3c02d5dc4411d48324 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 10 Oct 2023 22:34:48 +0800 Subject: [PATCH] __ses_path_va_transistor() --- ses_step_va_diode.c | 17 ----------------- ses_step_va_transistor.c | 27 +++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 76f994a..9735a05 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -78,23 +78,6 @@ void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double } } -void __ses_path_dr(ScfEpin* p0, ScfEpin* p1, ScfEpin* p) -{ - double v = p0->v - p1->v; - double jv = p0->jv - p1->jv; - - double r = p1->sr - p0->sr; - double jr = p1->jsr - p0->jsr; - - ses_ui_r(&p->dr, &p->jdr, v, jv, p->a, p->ja); - - scf_logw("c%ldp%ld, v: %lg, r: %lg, p1->sr: %lg, p0->sr: %lg, p->a: %lg, p->dr: %lg\n", - p->cid, p->id, v, r, p1->sr, p0->sr, p->a, p->dr); - - p->dr -= r; - p->jdr -= jr; -} - void __ses_path_dr_forward(ScfEfunction* f, ses_path_t* path, int i, int j, int n_diodes, double a, double ja) { assert(n_diodes > 0); diff --git a/ses_step_va_transistor.c b/ses_step_va_transistor.c index a2213b4..bf07c03 100644 --- a/ses_step_va_transistor.c +++ b/ses_step_va_transistor.c @@ -1,5 +1,27 @@ #include"ses_core.h" +void __ses_path_dr_transistor(ScfEfunction* f, ses_path_t* path, int i, int j) +{ + ScfEpin* p = path->pins->data[i]; + ScfEpin* p1 = path->pins->data[j]; + + double v = p->v - p1->v; + double jv = p->jv - p1->jv; + + double r; + double jr; + + __ses_path_pr(f, path, i, j, NULL, &r, &jr); + + ses_ui_r(&p->dr, &p->jdr, v, jv, p->a, p->ja); + + scf_logd("c%ldp%ld, v: %lg, r: %lg, p1->sr: %lg, p->sr: %lg, p->a: %lg, p->dr: %lg\n", + p->cid, p->id, v, r, p1->sr, p->sr, p->a, p->dr); + + p->dr -= r; + p->jdr -= jr; +} + static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) { ses_path_t* child; @@ -99,10 +121,7 @@ static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path) p0->ja = el->ja; } - scf_logi("i: %d, c%ldp%ld-c%ldp%ld, pc->v: %lg, pc->a: %lg, p->a: %lg\n", - i, p0->cid, p0->id, pc->cid, pc->id, pc->v, pc->a, p->a); - - __ses_path_dr(p, p1, pc); + __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, sr: %lg, pc->dr: %lg\n", i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, sr, pc->dr); -- 2.25.1