pe->v = le->v;
c->status = SCF_EDA_Status_ON;
- } else
+ } else {
c->status = SCF_EDA_Status_OFF;
- scf_loge("NPN c%ld, status: %d\n", c->id, c->status);
+ scf_logi("NPN c%ld, status: %d, lb->v: %lg, le->v: %lg\n", c->id, c->status, lb->v, le->v);
+ }
+ scf_loge("\033[34mNPN c%ld, status: %d\033[0m\n", c->id, c->status);
}
return 0;
scf_logw("path: %d, c%ldp%ld--c%ldp%ld, v: %lg, p0->v: %lg, p1->v: %lg, n_diodes: %d\n",
path->index, p0->cid, p0->id, p1->cid, p1->id, v, p0->v, p1->v, path->n_diodes);
- int ret = __ses_path_va(f, path, changed);
- if (ret < 0)
- return ret;
-#if 0
- B = f->components[0];
- Bn = B->pins[SCF_EDA_Battery_NEG];
-
- for (i = 0; i < path->pins->size; i++) {
- p0 = path->pins->data[i];
-
- c = f->components[p0->cid];
-
- if (SCF_EDA_NPN == c->type) {
- if (SCF_EDA_NPN_B == p0->id) {
-
- p1 = c->pins[SCF_EDA_NPN_E];
- *changed += __ses_status_check(f, c, p0, p1);
- }
-
- } else if (SCF_EDA_Diode == c->type) {
-
- if (SCF_EDA_Diode_POS == p0->id) {
-
- p1 = c->pins[SCF_EDA_Diode_NEG];
- *changed += __ses_status_check(f, c, p0, p1);
- }
- }
- }
-#endif
- return 0;
+ return __ses_path_va(f, path, changed);
}
static int ses_path_va_bridge(ScfEfunction* f, ses_path_t* path, int* changed)
_changed:
if (SCF_EDA_NPN == c->type) {
- p2 = c->pins[SCF_EDA_NPN_C];
- el = f->elines[p2->lid];
+
+ p2 = c->pins [SCF_EDA_NPN_C];
+ el = f->elines[p2->lid];
+ el->v = SCF_EDA_V_INIT;
for (i = 0; i + 1 < el->n_pins; i += 2) {
return changed;
}
-static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path, int* changed)
+static int __ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
{
ses_path_t* parent = path->parent;
ses_path_t* child;
scf_loge("i: %d, c%ldp%ld--c%ldp%ld, v: %lg, pc->v: %lg, pc->a: %lg, pr: %lg, pc->dr: %lg\n\n",
i, p0->cid, p0->id, pc->cid, pc->id, v, pc->v, pc->a, pr, pc->dr);
-
- *changed += __ses_status_change(f, el);
}
return 0;
}
-static int ses_path_va_transistor(ScfEfunction* f, ses_path_t* path, int* changed)
+static int ses_path_va_transistor(ScfEfunction* f, ses_path_t* path)
{
ses_path_t* child;
ScfEcomponent* B;
p0 = path->pins->data[0];
p1 = path->pins->data[path->pins->size - 1];
- int ret = __ses_path_va_transistor(f, path, changed);
+ int ret = __ses_path_va_transistor(f, path);
if (ret < 0)
return ret;
for (j = 0; j < path->childs->size; j++) {
child = path->childs->data[j];
- ret = ses_path_va_transistor(f, child, changed);
+ ret = ses_path_va_transistor(f, child);
if (ret < 0)
return ret;
}
{
ses_path_t* path;
- int changed = 0;
int i;
for (i = 0; i < ctx->paths->size; i++) {
scf_logi("i: %d, path->index: %d\n", i, path->index);
- int ret = ses_path_va_transistor(f, path, &changed);
+ int ret = ses_path_va_transistor(f, path);
if (ret < 0)
return ret;
printf("\n");
}
- return changed > 0 ? -EAGAIN : 0;
+ return 0;
}
ses_step_t ses_step_va_transistor =
&ses_step_dc_input,
&ses_step_dc_diode,
- &ses_step_dc_transistor,
};
static ses_step_t* ses_steps_1[] =
{
+ &ses_step_dc_transistor,
+
&ses_step_simplify,
&ses_step_topo,
return ret;
int j;
- for (j = 0; j < 3; j++) {
+ for (j = 0; j < 2; j++) {
ret = __ses_steps_analyse(f, ns, i, ctx);
if (-EAGAIN == ret)