From 09fd31a5c46b4d92156760258931bb3000597230 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Tue, 10 Oct 2023 18:44:27 +0800 Subject: [PATCH] __ses_path_va_balance() --- ses_step_simplify.c | 4 ++-- ses_step_va_balance.c | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ses_step_simplify.c b/ses_step_simplify.c index 9947b13..20be0e1 100644 --- a/ses_step_simplify.c +++ b/ses_step_simplify.c @@ -33,10 +33,10 @@ static int _simplify_draw(ScfEfunction* f, uint32_t bx, uint32_t by, uint32_t bw for (j = 0; j < f->n_elines; j++) { el = f->elines[j]; - if (el->v == B->pins[SCF_EDA_Battery_POS]->v) + if ((SCF_EDA_PIN_POS & el->flags) || el->v == B->pins[SCF_EDA_Battery_POS]->v) cairo_set_source_rgb(cr, 1, 0, 0); - else if (el->v == B->pins[SCF_EDA_Battery_NEG]->v) + else if ((SCF_EDA_PIN_NEG & el->flags) || el->v == B->pins[SCF_EDA_Battery_NEG]->v) cairo_set_source_rgb(cr, 0, 0, 1); else if (SCF_EDA_PIN_IN & el->flags) diff --git a/ses_step_va_balance.c b/ses_step_va_balance.c index 5365b9a..948e37e 100644 --- a/ses_step_va_balance.c +++ b/ses_step_va_balance.c @@ -70,6 +70,7 @@ static void inline __ses_bridge_i(double* i0, double* i1, double* i2, double* i3 static size_t __ses_line_update(ScfEfunction* f, ScfEline* el) { ScfEcomponent* c; + ScfEline* el2; ScfEpin* p; ScfEpin* p2; @@ -86,19 +87,27 @@ static size_t __ses_line_update(ScfEfunction* f, ScfEline* el) if (SCF_EDA_Diode_POS == p->id) { - p2 = c->pins[SCF_EDA_Diode_NEG]; + p2 = c->pins[SCF_EDA_Diode_NEG]; + el2 = f->elines[p2->lid]; + p2->v = el2->v; if (p->v - p2->v < SCF_EDA_V_Diode_ON) { c->status = SCF_EDA_Status_OFF; n++; + + scf_loge("c%ld off, p%ld->v: %lg, p%ld->v: %lg, diff: %lg\n", c->id, p->id, p->v, p2->id, p2->v, p->v - p2->v); } } else { - p2 = c->pins[SCF_EDA_Diode_POS]; + p2 = c->pins[SCF_EDA_Diode_POS]; + el2 = f->elines[p2->lid]; + p2->v = el2->v; if (p2->v - p->v < SCF_EDA_V_Diode_ON) { c->status = SCF_EDA_Status_OFF; n++; + + scf_loge("c%ld off, p%ld->v: %lg, p%ld->v: %lg, diff: %lg\n", c->id, p->id, p->v, p2->id, p2->v, p2->v - p->v); } } @@ -106,20 +115,28 @@ static size_t __ses_line_update(ScfEfunction* f, ScfEline* el) if (SCF_EDA_Transistor_B == p->id) { - p2 = c->pins[SCF_EDA_Transistor_E]; + p2 = c->pins[SCF_EDA_Transistor_E]; + el2 = f->elines[p2->lid]; + p2->v = el2->v; if (p->v - p2->v < SCF_EDA_V_Diode_ON) { c->status = SCF_EDA_Status_OFF; n++; + + scf_loge("c%ld off, p%ld->v: %lg, p%ld->v: %lg, diff: %lg\n", c->id, p->id, p->v, p2->id, p2->v, p->v - p2->v); } } else if (SCF_EDA_Transistor_E == p->id) { - p2 = c->pins[SCF_EDA_Transistor_B]; + p2 = c->pins[SCF_EDA_Transistor_B]; + el2 = f->elines[p2->lid]; + p2->v = el2->v; if (p2->v - p->v < SCF_EDA_V_Diode_ON) { c->status = SCF_EDA_Status_OFF; n++; + + scf_loge("c%ld off, p%ld->v: %lg, p%ld->v: %lg, diff: %lg\n", c->id, p->id, p->v, p2->id, p2->v, p2->v - p->v); } } } @@ -193,10 +210,10 @@ static int __ses_path_va_balance(ScfEfunction* f, ses_path_t* bridge, ses_flow_t scf_loge("v0: %lg, v1: %lg, v4: %lg, v1 - v0: %lg\n", v0, v1, v4, v1 - v0); el = f->elines[p0->lid]; - el->v = v0; + el->v = v1; el = f->elines[p1->lid]; - el->v = v1; + el->v = v0; size_t n0 = __ses_line_update(f, f->elines[p0->lid]); size_t n1 = __ses_line_update(f, f->elines[p1->lid]); -- 2.25.1