if (le->v == Bn->v)
lb->vconst = 1;
- c->status = SCF_EDA_Status_ON;
+ if (pb->v > Bp->v)
+ c->status = SCF_EDA_Status_OFF;
+ else
+ c->status = SCF_EDA_Status_ON;
} else if (le->v < SCF_EDA_V_MIN) {
if (lb->v == Bp->v)
le->vconst = 1;
- c->status = SCF_EDA_Status_ON;
+ if (pe->v < Bn->v)
+ c->status = SCF_EDA_Status_OFF;
+ else
+ c->status = SCF_EDA_Status_ON;
} else if (lb->v >= le->v + SCF_EDA_V_NPN_OFF) {
pb->v = lb->v;
pe->v = le->v;
- c->status = SCF_EDA_Status_ON;
- } else
+ if (pb->v > Bp->v)
+ c->status = SCF_EDA_Status_OFF;
+ else
+ c->status = SCF_EDA_Status_ON;
+ } else {
+ pb->v = lb->v;
+ pe->v = le->v;
c->status = SCF_EDA_Status_OFF;
+ }
- scf_loge("\033[34mNPN c%ld, status: %d\033[0m\n", c->id, c->status);
+ scf_loge("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, off: %lg\033[0m\n",
+ c->id, c->status, pb->v, pe->v, pb->v - pe->v, SCF_EDA_V_NPN_OFF);
}
return 0;
} else if (SCF_EDA_NPN == c->type && SCF_EDA_NPN_B == p->id) {
- ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_OFF, 0, a, ja);
+ ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_ON, 0, a, ja);
p->dr -= p->r;
p->jdr -= p->jr;
p1->aconst = 1;
scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg, c%ldp%ld->a: %lg\n",
- p->cid, p->id, SCF_EDA_V_NPN_OFF, p->r, a, p->dr, p1->cid, p1->id, p1->a);
+ p->cid, p->id, SCF_EDA_V_NPN_ON, p->r, a, p->dr, p1->cid, p1->id, p1->a);
p1 = c->pins[SCF_EDA_NPN_E];
p1->a = (1 + p1->hfe) * a;
p1->ja = p1->hfe * ja;
p1->aconst = 1;
- ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_OFF, 0, a, ja);
+ ses_ui_r(&p->dr, &p->jdr, SCF_EDA_V_NPN_ON, 0, a, ja);
p->dr -= p->r;
p->jdr -= p->jr;
- scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg\n", p->cid, p->id, SCF_EDA_V_NPN_OFF, p->r, a, p->dr);
+ scf_logw("c%ldp%ld, v: %lg, r: %lg, a: %lg, dr: %lg\n", p->cid, p->id, SCF_EDA_V_NPN_ON, p->r, a, p->dr);
}
}
}
if (c->status != SCF_EDA_Status_OFF) {
c->status = SCF_EDA_Status_OFF;
- scf_logi("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, Von: %lg, Voff: %lg\033[0m\n",
- c->id, c->status, pb->v, pe->v, pb->v - pe->v, Von, Voff);
goto _changed;
}
} else if (SCF_EDA_Status_ON != c->status) {
c->status = SCF_EDA_Status_ON;
- scf_logi("\033[34mc%ld, status: %d, pb->v: %lg, pe->v: %lg, diff: %lg, Von: %lg, Voff: %lg\033[0m\n",
- c->id, c->status, pb->v, pe->v, pb->v - pe->v, Von, Voff);
goto _changed;
}
&ses_step_jr,
&ses_step_va,
&ses_step_va_bridge,
- &ses_step_va_balance,
+// &ses_step_va_balance,
#endif
};
return ret;
int j;
- for (j = 0; j < 1; j++) {
+ for (j = 0; j < 3; j++) {
ret = __ses_steps_analyse(f, ns, i, ctx);
if (-EAGAIN == ret)