From: yu.dongliang <18588496441@163.com> Date: Mon, 13 Nov 2023 06:34:37 +0000 (+0800) Subject: __ses_path_va_diode() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=967bd8f3f87a271d49155acc6c75ea9cc965357d;p=ses.git __ses_path_va_diode() --- diff --git a/ses_step_dc_input.c b/ses_step_dc_input.c index 835f3e3..736da1e 100644 --- a/ses_step_dc_input.c +++ b/ses_step_dc_input.c @@ -22,7 +22,7 @@ static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count, ses_ctx if (!(SCF_EDA_PIN_IN & el->flags)) continue; - k = 0 % 2; + k = 1 % 2; el2 = f->elines[B->pins[k]->lid]; el->v = k * B->v; diff --git a/ses_step_jr.c b/ses_step_jr.c index 4cfc1ec..b739928 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -64,8 +64,8 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 p1 = path->pins->data[j - 1]; c1 = f->components[p1->cid]; -// if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id) -// p1 = path->pins->data[j - 2]; + if (SCF_EDA_NPN == c1->type && SCF_EDA_NPN_E == p1->id) + p1 = path->pins->data[j - 2]; } else { *r = 0; *jr = 0; @@ -96,7 +96,7 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1 *r = p1->pr - p0->pr; *jr = p1->jpr - p0->jpr; } - scf_loge("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr); + scf_logd("c%ldp%ld-c%ldp%ld, r: %lg, p0->pr: %lg, p1->pr: %lg\n", p0->cid, p0->id, p1->cid, p1->id, *r, p0->pr, p1->pr); } static int __ses_path_jr(ScfEfunction* f, ses_path_t* path) diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index 62b8192..47330d3 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -233,7 +233,7 @@ static void __ses_path_a_diode(ScfEfunction* f, ses_path_t* path, int k, double* r += _r; jr += _jr; - scf_logi("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, _r: %lg\n", pi->cid, pi->id, pj->cid, pj->id, r, v, _r); + scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, _r: %lg\n", pi->cid, pi->id, pj->cid, pj->id, r, v, _r); i = info->j; } @@ -262,13 +262,11 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) ScfEcomponent* c; ScfEline* el; - ScfEpin* p; ScfEpin* p0; ScfEpin* p1; ScfEpin* pi; ScfEpin* pj; - int i; int j; if (path->n_diodes * 2 >= path->pins->size) { @@ -290,24 +288,15 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) p1->v = el->v; p1->jv = el->jv; - double v = p0->v - p1->v; - double jv = p0->jv - p1->jv; + double v; + double jv; - double r = 0; - double jr = 0; + double r; + double jr; double a; double ja; - __ses_path_a_diode(f, path, 0, &a, &ja); - - path->a = a; - path->ja = ja; - - i = 0; - - scf_logi("**************\n"); - for (j = 0; j < path->diodes->size; j++) { info = path->diodes->data[j]; pi = path->pins->data[info->i]; @@ -318,12 +307,17 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) assert((SCF_EDA_Diode == c->type && SCF_EDA_Diode_POS == pi->id) || (SCF_EDA_NPN == c->type && SCF_EDA_NPN_B == pi->id)); + __ses_path_a_diode(f, path, j, &a, &ja); + + if (0 == j) { + path->a = a; + path->ja = ja; + } + pi->a = a; pi->ja = ja; - scf_logi("j: %d, ---------------\n", j); - - __ses_path_pr(f, path, i, info->i, NULL, &r, &jr); + __ses_path_pr(f, path, 0, info->i, NULL, &r, &jr); ses_ir_u(&v, &jv, a, ja, r, jr); @@ -357,7 +351,6 @@ static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path) info->i, info->j, pi->cid, pi->id, pj->cid, pj->id, pi->v, pj->v, pi->a); __ses_path_dr_forward(f, path, info->i, info->j, pi->a, pi->ja); - printf("\n"); } return 0; diff --git a/ses_steps.c b/ses_steps.c index 27623ed..044cbc9 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -43,7 +43,7 @@ static ses_step_t* ses_steps_1[] = &ses_step_va_diode, &ses_step_va_transistor, -#if 0 +#if 1 &ses_step_jr, &ses_step_va, &ses_step_va_bridge, @@ -144,7 +144,7 @@ int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count) return ret; int j; - for (j = 0; j < 1; j++) { + for (j = 0; j < 3; j++) { printf("\n\033[33m%s(), %d(), j: %d\033[0m\n", __func__, __LINE__, j); ret = __ses_steps_analyse(f, ns, i, ctx);