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;
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--) {
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;
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;
ses_path_t* path = flow->paths->data[flow->paths->size - 1];
ScfEpin* vip = flow->vip;
- ScfEpin* p0;
ScfEpin* p;
ScfEline* el;