From: yu.dongliang <18588496441@163.com> Date: Thu, 16 Nov 2023 06:26:45 +0000 (+0800) Subject: tmp X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=53870e4080ca28860b053325a3a1395e769d6498;p=ses.git tmp --- diff --git a/ses_step_va_bridge.c b/ses_step_va_bridge.c index a5f4e24..63d3bb6 100644 --- a/ses_step_va_bridge.c +++ b/ses_step_va_bridge.c @@ -5,11 +5,15 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip) return -EINVAL; - ses_path_t* path = flow->paths->data[flow->paths->size - 1]; - ScfEpin* vip = flow->vip; - ScfEpin* p0; - ScfEpin* p; - ScfEline* el; + ScfEcomponent* B = f->components[0]; + ScfEpin* Bp = B->pins[SCF_EDA_Battery_POS]; + ScfEpin* Bn = B->pins[SCF_EDA_Battery_NEG]; + + ses_path_t* path = flow->paths->data[flow->paths->size - 1]; + ScfEpin* vip = flow->vip; + ScfEpin* p0; + ScfEpin* p; + ScfEline* el; double tr = flow->pos_r; double jtr = flow->pos_jr; @@ -44,12 +48,15 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ses_ir_u(&v, &jv, a_bridge, ja_bridge, r, jr); - p->v -= v; - p->jv -= jv; + if (p->lid != Bp->lid) { + p->v -= v; + p->jv -= jv; - el = f->elines[p->lid]; - el->v = p->v; - el->jv = p->jv; + el = f->elines[p->lid]; + el->v = p->v; + el->jv = p->jv; + scf_logi("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, el->id, el->v); + } scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, el->id, el->v); break; @@ -64,13 +71,16 @@ int __ses_flow_a_pos(ScfEfunction* f, ses_flow_t* flow, double a_bridge, double ses_ir_u(&v, &jv, a_bridge, ja_bridge, tr, jtr); - vip = path->pins->data[0]; - vip->v -= v; - vip->jv -= jv; + vip = path->pins->data[0]; - el = f->elines[vip->lid]; - el->v = vip->v; - el->jv = vip->jv; + if (vip->lid != Bp->lid) { + vip->v -= v; + vip->jv -= jv; + + el = f->elines[vip->lid]; + el->v = vip->v; + el->jv = vip->jv; + } scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", vip->cid, vip->id, vip->v, tr, el->id, el->v); } @@ -83,11 +93,15 @@ int __ses_flow_v_neg(ScfEfunction* f, ses_flow_t* flow, double dv_vip, double dj if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip) return -EINVAL; - ses_path_t* path = flow->paths->data[flow->paths->size - 1]; - ScfEpin* vip = flow->vip; - ScfEpin* p0; - ScfEpin* p; - ScfEline* el; + ScfEcomponent* B = f->components[0]; + ScfEpin* Bp = B->pins[SCF_EDA_Battery_POS]; + ScfEpin* Bn = B->pins[SCF_EDA_Battery_NEG]; + + ses_path_t* path = flow->paths->data[flow->paths->size - 1]; + ScfEpin* vip = flow->vip; + ScfEpin* p0; + ScfEpin* p; + ScfEline* el; double tr = flow->neg_r; double jtr = flow->neg_jr; @@ -130,12 +144,14 @@ int __ses_flow_v_neg(ScfEfunction* f, ses_flow_t* flow, double dv_vip, double dj ses_ir_u(&v, &jv, da, dja, r, jr); - p->v += v; - p->jv += jv; + if (p->lid != Bn->lid) { + p->v += v; + p->jv += jv; - el = f->elines[p->lid]; - el->v = p->v; - el->jv = p->jv; + el = f->elines[p->lid]; + el->v = p->v; + el->jv = p->jv; + } scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", p->cid, p->id, p->v, r, el->id, el->v); } @@ -153,12 +169,14 @@ int __ses_flow_v_neg(ScfEfunction* f, ses_flow_t* flow, double dv_vip, double dj ses_ir_u(&v, &jv, da, dja, r, jr); - vip->v += v; - vip->jv += jv; + if (vip->lid != Bn->lid) { + vip->v += v; + vip->jv += jv; - el = f->elines[vip->lid]; - el->v = vip->v; - el->jv = vip->jv; + el = f->elines[vip->lid]; + el->v = vip->v; + el->jv = vip->jv; + } scf_logw("c%ldp%ld->v: %lg, r: %lg, l%ld->v: %lg\n", vip->cid, vip->id, vip->v, tr, el->id, el->v); } @@ -282,9 +300,6 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change p1->v = el->v; p1->jv = el->jv; - double v = p0->v - p1->v; - double jv = p0->jv - p1->jv; - flow = ses_flow_alloc(); if (!flow) return -ENOMEM; @@ -347,7 +362,10 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change printf("\n"); k++; - } while (k < 3); + } while (k < 20); + + double v = p0->v - p1->v; + double jv = p0->jv - p1->jv; scf_loge("bridge: %d, c%ldp%ld--c%ldp%ld, v: %lg, p0->v: %lg, p1->v: %lg, n_diodes: %d, p0->a: %lg, p1->a: %lg\n", bridge->index, p0->cid, p0->id, p1->cid, p1->id, v, p0->v, p1->v, bridge->n_diodes, p0->a, p1->a);