if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
return -EINVAL;
- ses_path_t* path = flow->paths->data[flow->paths->size - 1];
- ScfEpin* vip = flow->vip;
- ScfEpin* p0;
- ScfEpin* p;
- ScfEline* el;
+ 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;
ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr);
- p->v -= v;
- p->jv -= jv;
+ if (p->lid != Bp->lid) {
+ p->v -= v;
+ p->jv -= jv;
- el = f->elines[p->lid];
- el->v = p->v;
- el->jv = p->jv;
+ 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;
ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr);
- vip = path->pins->data[0];
- vip->v -= v;
- vip->jv -= jv;
+ vip = path->pins->data[0];
- el = f->elines[vip->lid];
- el->v = vip->v;
- el->jv = vip->jv;
+ if (vip->lid != Bp->lid) {
+ vip->v -= v;
+ vip->jv -= jv;
+
+ el = f->elines[vip->lid];
+ el->v = vip->v;
+ el->jv = vip->jv;
+ }
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);
}
if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)
return -EINVAL;
- ses_path_t* path = flow->paths->data[flow->paths->size - 1];
- ScfEpin* vip = flow->vip;
- ScfEpin* p0;
- ScfEpin* p;
- ScfEline* el;
+ 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->neg_r;
double jtr = flow->neg_jr;
ses_ir_u(&v, &jv, da, dja, r, jr);
- p->v += v;
- p->jv += jv;
+ if (p->lid != Bn->lid) {
+ p->v += v;
+ p->jv += jv;
- el = f->elines[p->lid];
- el->v = p->v;
- el->jv = p->jv;
+ el = f->elines[p->lid];
+ el->v = p->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);
}
ses_ir_u(&v, &jv, da, dja, r, jr);
- vip->v += v;
- vip->jv += jv;
+ if (vip->lid != Bn->lid) {
+ vip->v += v;
+ vip->jv += jv;
- el = f->elines[vip->lid];
- el->v = vip->v;
- el->jv = vip->jv;
+ el = f->elines[vip->lid];
+ el->v = vip->v;
+ el->jv = vip->jv;
+ }
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);
}
p1->v = el->v;
p1->jv = el->jv;
- double v = p0->v - p1->v;
- double jv = p0->jv - p1->jv;
-
flow = ses_flow_alloc();
if (!flow)
return -ENOMEM;
printf("\n");
k++;
- } while (k < 3);
+ } while (k < 20);
+
+ double v = p0->v - p1->v;
+ double jv = p0->jv - p1->jv;
scf_loge("bridge: %d, c%ldp%ld--c%ldp%ld, v: %lg, p0->v: %lg, p1->v: %lg, n_diodes: %d, p0->a: %lg, p1->a: %lg\n",
bridge->index, p0->cid, p0->id, p1->cid, p1->id, v, p0->v, p1->v, bridge->n_diodes, p0->a, p1->a);