double r;
double jr;
+ scf_logi("path->type: %d\n", path->type);
+
for (i = 0; i < path->pins->size; i++) {
p = path->pins->data[i];
el->ja = ja;
el->aconst = 1;
+ scf_loge("i: %d, c%ldp%ld, v: %lg + j%lg, p->v: %lg + j%lg, r: %lg + j%lg, el->a: %lg + j%lg\n\n", i, p->cid, p->id,
+ v, jv, p->v, p->jv, r, jr, el->a, el->ja);
+
+ v = p->v - p1->v;
+ jv = p->jv - p1->jv;
+
if (path->childs) {
for (j = 0; j < path->childs->size; j++) {
child = path->childs->data[j];
ses_split_i(&child->a, &child->ja, el->a, el->ja, child->r, child->jr, r, jr);
+ a -= child->a;
+ ja -= child->ja;
+
+ scf_loge("j: %d, c%ldp%ld, v: %lg + j%lg, child->r: %lg + j%lg, child->a: %lg + j%lg\n\n", j, cp0->cid, cp0->id,
+ v, jv, child->r, child->jr, child->a, child->ja);
+
+ cp0->a = child->a;
+ cp0->ja = child->ja;
+
double cr;
double jcr;
- v = p->v - p1->v;
- jv = p->jv - p1->jv;
-
ses_ui_r(&cr, &jcr, v, jv, child->a, child->ja);
for (k = 0; k < child->pins->size; k++) {
}
}
+ p->a = a;
+ p->ja = ja;
+
} else {
v = p->v - p1->v;
jv = p->jv - p1->jv;
el->ja = ja;
el->aconst = 1;
}
-
}
printf("\n");
return 0;
}
-static int _va_diode_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
+static int _ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
{
- ses_path_t* path;
ScfEcomponent* B;
ScfEpin* p0;
ScfEpin* p1;
size_t j;
size_t k;
+ if (path->pins->size < 2) {
+ scf_loge("\n");
+ return -EINVAL;
+ }
+
B = f->components[0];
Bp = B->pins[SCF_EDA_Battery_POS];
Bn = B->pins[SCF_EDA_Battery_NEG];
- for (i = 0; i < ctx->paths->size; i++) {
- path = ctx->paths->data[i];
+ p0 = path->pins->data[0];
+ p1 = path->pins->data[path->pins->size - 1];
- scf_logi("i: %ld, path->type: %d\n", i, path->type);
+ if (p0->lid != Bp->lid || p1->lid != Bn->lid)
+ return 0;
+
+ int ret = __ses_path_va_diode(f, path);
+ if (ret < 0)
+ return ret;
+
+ if (path->childs) {
+ for (j = 0; j < path->childs->size; j++) {
- if (path->pins->size < 2) {
- scf_loge("\n");
- return -EINVAL;
+ ret = _ses_path_va_diode(f, path->childs->data[j]);
+ if (ret < 0)
+ return ret;
}
+ }
- p0 = path->pins->data[0];
- p1 = path->pins->data[path->pins->size - 1];
+ return 0;
+}
- if (p0->lid != Bp->lid || p1->lid != Bn->lid)
- continue;
+static int _va_diode_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx_t* ctx)
+{
+ ses_path_t* path;
+
+ size_t i;
+
+ for (i = 0; i < ctx->paths->size; i++) {
+ path = ctx->paths->data[i];
+
+ scf_logi("i: %ld, path->type: %d\n", i, path->type);
- int ret = __ses_path_va_diode(f, path);
+ int ret = _ses_path_va_diode(f, path);
if (ret < 0)
return ret;