#include"ses_core.h"
+static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path);
+
void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double la, double jla, double* a, double* ja)
{
ScfEcomponent* c;
j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, child->r, r, child->a, la);
} else {
- ses_split_i(&child->a, &child->ja, la, jla, child->r, child->jr, r, jr);
- scf_logw("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, child->r: %lg, r: %lg, child->a: %lg, el->a: %lg\n",
+ int ret = __ses_path_va_diode(f, child);
+ if (ret < 0) {
+ scf_loge("ret: %d\n", ret);
+
+ ses_split_i(&child->a, &child->ja, la, jla, child->r, child->jr, r, jr);
+ }
+
+ scf_loge("j: %d, c%ldp%ld--c%ldp%ld, v: %lg, child->r: %lg, r: %lg, child->a: %lg, el->a: %lg\n",
j, cp0->cid, cp0->id, cp1->cid, cp1->id, v, child->r, r, child->a, la);
}
el = f->elines [pi->lid];
c = f->components[pi->cid];
- if (!el->vconst)
- break;
+// if (!el->vconst)
+// break;
pi->v = el->v;
pi->jv = el->jv;
el = f->elines [pj->lid];
c = f->components[pj->cid];
- if (!el->vconst)
- break;
+// if (!el->vconst)
+// break;
pj->v = el->v;
pj->jv = el->jv;
return -1;
}
+ int __ni = i / 2;
+ int __nj = (path->pins->size - 1 - j) / 2;
+ double __vi = p0->v - SCF_EDA_V_Diode_ON * __ni;
+ double __vj = p1->v + SCF_EDA_V_Diode_ON * __nj;
+
+ scf_logi("i: %d, j: %d, c%ldp%ld--c%ldp%ld, ni: %d, nj: %d, vi: %lg, vj: %lg\n",
+ i, j, pi->cid, pi->id, pj->cid, pj->id, __ni, __nj, __vi, __vj);
+
+ pi->v = __vi;
+ pj->v = __vj;
+
if (j < path->pins->size - 1)
pj = path->pins->data[++j];
+ pj->v = __vj;
double v = pi->v - pj->v;
double jv = pi->jv - pj->jv;
c = f->components[pj->cid];
+ scf_logi("i: %d, j: %d, c%ldp%ld--c%ldp%ld, a: %lg\n", i, j, pi->cid, pi->id, pj->cid, pj->id, a);
+
if (SCF_EDA_Diode == c->type && SCF_EDA_Diode_POS == pj->id) {
el = f->elines[pj->lid];
if (i > 0)
pi = path->pins->data[--i];
+ pi->v = __vi;
c = f->components[pi->cid];
el->jv = pc->jv;
el->a = pc->a;
el->ja = pc->ja;
+ el->vconst = 1;
scf_logw("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, pc->dr: %lg\n",
i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, pc->dr);
- if (path->childs)
+ if (path->childs) {
__ses_path_split_i(f, path, i, path->pins->size - 1, el->a, el->ja, &pc->a, &pc->ja);
- else {
+
+ if (i > 0) {
+ p = path->pins->data[i - 1];
+ p->a = el->a;
+ p->ja = el->ja;
+ p->v = el->v;
+ p->jv = el->jv;
+
+ scf_logi("--------------\n");
+ __ses_path_split_i(f, path, 0, i - 1, el->a, el->ja, &p->a, &p->ja);
+ scf_logi("--------------\n\n");
+ }
+ } else {
p0->a = el->a;
p0->ja = el->ja;
}