From: yu.dongliang <18588496441@163.com> Date: Fri, 17 Nov 2023 05:34:32 +0000 (+0800) Subject: __ses_flow_a_pos() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=93623a31cd7138de7b97c64f0fbadce5ab517fd8;p=ses.git __ses_flow_a_pos() --- diff --git a/ses_step_va_bridge.c b/ses_step_va_bridge.c index 123a254..e149897 100644 --- a/ses_step_va_bridge.c +++ b/ses_step_va_bridge.c @@ -5,18 +5,20 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dj if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip) return -EINVAL; + ScfEcomponent* c; ScfEcomponent* B = f->components[0]; ScfEpin* Bp = B->pins[SCF_EDA_Battery_POS]; ScfEpin* Bn = B->pins[SCF_EDA_Battery_NEG]; ses_path_t* path = flow->paths->data[flow->paths->size - 1]; ScfEpin* vip = flow->vip; - ScfEpin* p0; ScfEpin* p; ScfEline* el; - double tr = flow->pos_r; - double jtr = flow->pos_jr; + double v; + double jv; + + ses_ir_u(&v, &jv, da_vip, dja_vip, flow->pos_r, flow->pos_jr); int i; int j; @@ -24,11 +26,8 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dj for (i = 0; i < flow->paths->size; i++) { path = flow->paths->data[i]; - double v; - double jv; - - double r; - double jr; + double r = 0; + double jr = 0; int j0 = -1; for (j = path->pins->size - 1; j >= 0; j--) { @@ -41,12 +40,16 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dj continue; } - __ses_path_pr(f, path, j, j0, NULL, &r, &jr); + r += p->r + p->dr; + jr += p->jr + p->jdr; - r = tr - r; - jr = jtr - jr; + if (!(j & 0x1)) { + c = f->components[p->cid]; + r += c->r; + jr += c->jr; - ses_ir_u(&v, &jv, da_vip, dja_vip, r, jr); + ses_ir_u(&v, &jv, da_vip, dja_vip, r, jr); + } if (p->lid != Bp->lid) { p->v -= v; @@ -55,34 +58,16 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double da_vip, double dj el = f->elines[p->lid]; el->v = p->v; el->jv = p->jv; - scf_logi("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, el->id, el->v); } - scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, el->id, el->v); - break; - } - - assert(j0 >= 0); - - __ses_path_pr(f, path, j0, j, NULL, &r, &jr); - - tr -= r; - jtr -= jr; - - ses_ir_u(&v, &jv, da_vip, dja_vip, tr, jtr); - - vip = path->pins->data[0]; - - if (vip->lid != Bp->lid) { - vip->v -= v; - vip->jv -= jv; - el = f->elines[vip->lid]; - el->v = vip->v; - el->jv = vip->jv; + if (!(j & 0x1)) { + r = 0; + jr = 0; + } } - scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", vip->cid, vip->id, vip->v, tr, el->id, el->v); + vip = path->pins->data[0]; } return 0; @@ -100,7 +85,6 @@ int __ses_flow_v_neg(ScfEfunction* f, ses_flow_t* flow, double dv_vip, double dj ses_path_t* path = flow->paths->data[flow->paths->size - 1]; ScfEpin* vip = flow->vip; - ScfEpin* p0; ScfEpin* p; ScfEline* el;