From: yu.dongliang <18588496441@163.com> Date: Mon, 13 Nov 2023 05:53:23 +0000 (+0800) Subject: __ses_path_a_diode() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=9a0956a3ffd020d171ec12aebc20b014ac8e7133;p=ses.git __ses_path_a_diode() --- diff --git a/ses_step_jr.c b/ses_step_jr.c index 4e2dfb3..4cfc1ec 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -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; diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index fef78f8..62b8192 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -199,6 +199,62 @@ void __ses_path_dr_reverse(ScfEfunction* f, ses_path_t* path, int i, int j, doub } } +static void __ses_path_a_diode(ScfEfunction* f, ses_path_t* path, int k, double* a, double* ja) +{ + ses_info_t* info; + + ScfEpin* p0 = path->pins->data[0]; + ScfEpin* p1 = path->pins->data[path->pins->size - 1]; + ScfEpin* pi; + ScfEpin* pj; + + double v = p0->v - p1->v; + double jv = p0->jv - p1->jv; + + double r = 0; + double jr = 0; + + int i = 0; + int j; + + for (j = k; j < path->diodes->size; j++) { + info = path->diodes->data[j]; + pi = path->pins->data[i]; + pj = path->pins->data[info->i]; + + v -= info->n_diodes * SCF_EDA_V_Diode_ON; + v -= info->n_NPNs * SCF_EDA_V_NPN_ON; + + double _r; + double _jr; + + __ses_path_pr(f, path, i, info->i, NULL, &_r, &_jr); + + 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); + + i = info->j; + } + + scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg\n", p0->cid, p0->id, p1->cid, p1->id, r, v); + + if (i < path->pins->size - 1) { + pi = path->pins->data[i]; + + r += p1->sr - p1->r - pi->pr; + jr += p1->jsr - p1->jr - pi->jpr; + + scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, pi->pr: %lg, p1->sr: %lg, p1->r: %lg\n", + pi->cid, pi->id, p1->cid, p1->id, r, v, pi->pr, p1->sr, p1->r); + } + + ses_ur_i(a, ja, v, jv, r, jr); + + scf_loge("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, a: %lg\n\n", p0->cid, p0->id, p1->cid, p1->id, r, v, *a); +} + static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) { ses_path_t* child; @@ -243,50 +299,15 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) double a; double ja; - i = 0; - - for (j = 0; j < path->diodes->size; j++) { - info = path->diodes->data[j]; - pi = path->pins->data[i]; - pj = path->pins->data[info->i]; - - v -= info->n_diodes * SCF_EDA_V_Diode_ON; - v -= info->n_NPNs * SCF_EDA_V_NPN_ON; - - double _r; - double _jr; - - __ses_path_pr(f, path, i, info->i, NULL, &_r, &_jr); - - 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); - - i = info->j; - } - - scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg\n", p0->cid, p0->id, p1->cid, p1->id, r, v); - - if (i < path->pins->size - 1) { - pi = path->pins->data[i]; - - r += p1->sr - p1->r - pi->pr; - jr += p1->jsr - p1->jr - pi->jpr; - - scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, pi->pr: %lg, p1->sr: %lg, p1->r: %lg\n", - pi->cid, pi->id, p1->cid, p1->id, r, v, pi->pr, p1->sr, p1->r); - } - - ses_ur_i(&a, &ja, v, jv, r, jr); - - scf_loge("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, a: %lg\n\n", p0->cid, p0->id, p1->cid, p1->id, r, v, a); + __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]; @@ -300,6 +321,8 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) pi->a = a; pi->ja = ja; + scf_logi("j: %d, ---------------\n", j); + __ses_path_pr(f, path, i, info->i, NULL, &r, &jr); ses_ir_u(&v, &jv, a, ja, r, jr); @@ -334,6 +357,7 @@ 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; diff --git a/ses_steps.c b/ses_steps.c index 204bbab..27623ed 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -43,7 +43,7 @@ static ses_step_t* ses_steps_1[] = &ses_step_va_diode, &ses_step_va_transistor, -#if 1 +#if 0 &ses_step_jr, &ses_step_va, &ses_step_va_bridge,