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];
ScfEpin* p;
ScfEline* el;
- double tr = flow->neg_r;
- double jtr = flow->neg_jr;
+ double v = dv_vip;
+ double jv = djv_vip;
double da;
double dja;
int i;
int j;
- ses_ur_i(&da, &dja, dv_vip, djv_vip, tr, jtr);
+ ses_ur_i(&da, &dja, dv_vip, djv_vip, flow->neg_r, flow->neg_jr);
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 = 0; j < path->pins->size; j++) {
continue;
}
- __ses_path_pr(f, path, j0, j, NULL, &r, &jr);
+ r += p->r + p->dr;
+ jr += p->jr + p->jdr;
- r = tr - r;
- jr = jtr - jr;
-
- if (p->sr != p->pr)
- j0 = j;
+ if (j & 0x1) {
+ c = f->components[p->cid];
+ r += c->r;
+ jr += c->jr;
- ses_ir_u(&v, &jv, da, dja, r, jr);
+ ses_ir_u(&v, &jv, da, dja, r, jr);
+ }
if (p->lid != Bn->lid) {
p->v += v;
el->jv = p->jv;
}
- 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);
- }
-
- assert(p0);
-
- vip = path->pins->data[j - 1];
-
- if (j - 1 != j0) {
-
- __ses_path_sr(f, path, j0, j, NULL, &r, &jr);
-
- tr -= r;
- jtr -= jr;
+ scf_logw("c%ldp%ld->v: %lg, r: %lg, v: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, v, el->id, el->v);
- ses_ir_u(&v, &jv, da, dja, r, jr);
-
- if (vip->lid != Bn->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[j - 1];
}
return 0;
printf("\n");
k++;
- } while (da > 1e-5);
+ } while (da > 1e-4);
v = p0->v - p1->v;
jv = p0->jv - p1->jv;