From 19097182687485b22baf5f05d4ddac663d0782e5 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Wed, 15 Nov 2023 21:27:51 +0800 Subject: [PATCH] __ses_path_va_bridge() --- ses_step_va_bridge.c | 51 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/ses_step_va_bridge.c b/ses_step_va_bridge.c index fdaebc4..6173528 100644 --- a/ses_step_va_bridge.c +++ b/ses_step_va_bridge.c @@ -43,18 +43,11 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change double v = p0->v - p1->v; double jv = p0->jv - p1->jv; - int ret = __ses_path_va(f, bridge, changed); - if (ret < 0) - return ret; - - scf_logw("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); - flow = ses_flow_alloc(); if (!flow) return -ENOMEM; - ret = ses_paths_find_flow(flow, paths, p0, bridge); + int ret = ses_paths_find_flow(flow, paths, p0, bridge); if (ret < 0) { ses_flow_free(flow); return ret; @@ -67,9 +60,49 @@ static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* change fp0 = fpath->pins->data[0]; fp1 = fpath->pins->data[fpath->pins->size - 1]; - scf_loge("flow vip: c%ldp%ld->a: %lg, fp0: c%ldp%ld->a: %lg, fp1: c%ldp%ld->a: %lg\n", + scf_logw("flow vip: c%ldp%ld->a: %lg, fp0: c%ldp%ld->a: %lg, fp1: c%ldp%ld->a: %lg\n", flow->vip->cid, flow->vip->id, flow->vip->a, fp0->cid, fp0->id, fp0->a, fp1->cid, fp1->id, fp1->a); + double da = 0; + double dja = 0; + + double a = 0; + double ja = 0; + + do { + ret = __ses_path_va(f, bridge, changed); + if (ret < 0) + return ret; + + da = bridge->a - a; + dja = bridge->ja - ja; + + a += 0.001 * da; + ja += 0.001 * dja; + + fp0->a = flow->vip->a + a; + fp0->ja = flow->vip->ja + ja; + + double _v; + double _jv; + + double _a; + double _ja; + + ses_ir_u(&_v, &_jv, fp0->a, fp0->ja, flow->pos_r, flow->pos_jr); + + flow->vip->v = fp0->v - _v; + flow->vip->jv = fp0->jv - _jv; + + ses_ur_i(&_a, &_ja, flow->vip->v, flow->vip->jv, flow->neg_r, flow->neg_jr); + + scf_logw("da: %lg, a: %lg, fp0->a: %lg, _v: %lg, vip->v: %lg, _a: %lg\n", + da, a, fp0->a, _v, flow->vip->v, _a); + } while (0); + + scf_logw("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); + return 0; } -- 2.25.1