From: yu.dongliang <18588496441@163.com> Date: Fri, 6 Oct 2023 10:44:44 +0000 (+0800) Subject: jr of transistor X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=ba9ab89a504f63ad10d79f60075ffe4db945d2f0;p=ses.git jr of transistor --- diff --git a/ses_core.h b/ses_core.h index 0a11187..b5b3817 100644 --- a/ses_core.h +++ b/ses_core.h @@ -107,7 +107,7 @@ int ses_loop_function(ScfEfunction* f, scf_vector_t* loops); int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count); void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double la, double jla, double* a, double* ja); -void __ses_path_pr (ScfEfunction* f, ses_path_t* path, int i, int j, double* r, double* jr); +void __ses_path_pr (ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr); void __ses_path_dr (ScfEpin* p0, ScfEpin* p1, ScfEpin* p); static inline void vertical(int* px, int* py, int dx, int dy, int d) diff --git a/ses_step_jr.c b/ses_step_jr.c index d9c444b..c1b4e9c 100644 --- a/ses_step_jr.c +++ b/ses_step_jr.c @@ -1,6 +1,6 @@ #include"ses_core.h" -void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, double* r, double* jr) +void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, ScfEpin* cp1, double* r, double* jr) { ScfEpin* p0 = path->pins->data[i]; ScfEpin* p1 = path->pins->data[j]; @@ -8,7 +8,7 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, double* r, d ScfEcomponent* c0 = f->components[p0->cid]; ScfEcomponent* c1 = f->components[p1->cid]; - if (SCF_EDA_Transistor == c1->type && SCF_EDA_Transistor_E == p1->id) + if (SCF_EDA_Transistor == c1->type && SCF_EDA_Transistor_E == p1->id && cp1 != p1) p1 = path->pins->data[j - 1]; if (SCF_EDA_Transistor == c0->type) { @@ -25,6 +25,8 @@ void __ses_path_pr(ScfEfunction* f, ses_path_t* path, int i, int j, double* r, d *r = p1->pr - p0->pr; *jr = p1->jpr - p0->jpr; } + + 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) @@ -123,7 +125,7 @@ static int __ses_path_jr(ScfEfunction* f, ses_path_t* path) double _r = child->r / R; double _jr = -child->jr / R; - __ses_path_pr(f, path, k, j, &r, &jr); + __ses_path_pr(f, path, k, j, NULL, &r, &jr); R = r * r + jr * jr; r = r / R; diff --git a/ses_step_va.c b/ses_step_va.c index 86e302e..943b819 100644 --- a/ses_step_va.c +++ b/ses_step_va.c @@ -7,6 +7,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path); static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* a, double *ja) { ses_path_t* child; + + ScfEcomponent* c; ScfEline* el; ScfEpin* p; ScfEpin* p2; @@ -48,10 +50,12 @@ static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* double _a = 0; double _ja = 0; - ses_ir_u(&_v, &_jv, *a, *ja, _r, _jr); + __ses_path_pr(f, path, i, k, cp1, &_r, &_jr); + + ses_ir_u(&_v, &_jv, *a, *ja, _r, _jr); - scf_logw("child: %d, c%ldp%ld, c%ldp%ld, _v: %lg + j%lg, a: %lg + j%lg, _r: %lg + j%lg, p->pr: %lg + j%lg, p->dr: %lg + j%lg, p2->pr: %lg + j%lg\n", - child->index, p->cid, p->id, p2->cid, p2->id, _v, _jv, *a, *ja, _r, _jr, p->pr, p->jpr, p->dr, p->jdr, p2->pr, p2->jpr); + scf_logw("child: %d, c%ldp%ld-c%ldp%ld (c%ldp%ld-c%ldp%ld), _v: %lg, a: %lg, _r: %lg, p->pr: %lg, p->dr: %lg, p2->pr: %lg\n", + child->index, p->cid, p->id, p2->cid, p2->id, cp0->cid, cp0->id, cp1->cid, cp1->id, _v, *a, _r, p->pr, p->dr, p2->pr); ses_ur_i(&_a, &_ja, _v, _jv, child->r, child->jr); @@ -62,8 +66,8 @@ static int __ses_path_split_a(ScfEfunction* f, ses_path_t* path, int i, double* el->v = p->v - _v; el->jv = p->jv - _jv; - scf_loge("child: %d, c%ldp%ld, c%ldp%ld, p->v: %lg + j%lg, el->v: %lg + j%lg, _v: %lg + j%lg\n", - child->index, p->cid, p->id, p2->cid, p2->id, p->v, p->jv, el->v, el->jv, _v, _jv); + scf_loge("child: %d, c%ldp%ld, c%ldp%ld, p->v: %lg, el->v: %lg, _v: %lg\n", + child->index, p->cid, p->id, p2->cid, p2->id, p->v, el->v, _v); int ret = __ses_path_va(f, child); if (ret < 0) @@ -95,6 +99,8 @@ static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, in ses_ir_u(&v, &jv, a, ja, r, jr); + scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv); + } else if (i >= 1) { p2 = path->pins->data[i - 1]; @@ -102,6 +108,8 @@ static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, in jr = p2->jsr - p0->jsr; ses_ir_u(&v, &jv, a, ja, r, jr); + + scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv); } else return -EINVAL; @@ -110,8 +118,6 @@ static int __ses_path_split_v(ScfEfunction* f, ses_path_t* path, ScfEpin* p0, in jr = p->jsr - p0->jsr; ses_ir_u(&v, &jv, a, ja, r, jr); - - scf_logd("c%ldp%ld, c%ldp%ld, a: %lg + j%lg, r: %lg + j%lg, v: %lg + j%lg\n", p0->cid, p0->id, p->cid, p->id, a, ja, r, jr, v, jv); } p->v = p0->v - v; @@ -160,7 +166,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) ses_ur_i(&path->a, &path->ja, v, jv, path->r, path->jr); - scf_loge("path: %d, v: %lg + j%lg, r: %lg + j%lg, a: %lg + j%lg\n\n", path->index, v, jv, path->r, path->jr, path->a, path->ja); + scf_loge("path: %d, v: %lg, r: %lg, a: %lg\n\n", path->index, v, path->r, path->a); double a = path->a; double ja = path->ja; @@ -227,8 +233,8 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) } } - scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, r: %lg + j%lg, p->a: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + j%lg\n\n", path->index, i, p->cid, p->id, - p->v, p->jv, dv, jdv, r, jr, p->a, p->ja, a, ja, p->pr, p->jpr); + scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg, dv: %lg, r: %lg, p->a: %lg, a: %lg, p->pr: %lg\n\n", path->index, i, p->cid, p->id, + p->v, dv, r, p->a, a, p->pr); r = 0; jr = 0; @@ -237,8 +243,7 @@ static int __ses_path_va(ScfEfunction* f, ses_path_t* path) dv = p->v; jdv = p->jv; - scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg + j%lg, dv: %lg + j%lg, a: %lg + j%lg, p->pr: %lg + %lg\n", - path->index, i, p->cid, p->id, p->v, p->jv, dv, jdv, a, ja, p->pr, p->jpr); + scf_loge("path: %d, i: %d, c%ldp%ld, p->v: %lg, dv: %lg, a: %lg, p->pr: %lg\n", path->index, i, p->cid, p->id, p->v, dv, a, p->pr); } } printf("\n"); diff --git a/ses_step_va_diode.c b/ses_step_va_diode.c index efd7207..3bffa25 100644 --- a/ses_step_va_diode.c +++ b/ses_step_va_diode.c @@ -16,7 +16,7 @@ void __ses_path_split_i(ScfEfunction* f, ses_path_t* path, int i, int j, double double r; double jr; - __ses_path_pr(f, path, i, j, &r, &jr); + __ses_path_pr(f, path, i, j, NULL, &r, &jr); int k; for (k = 0; k < path->childs->size; k++) { diff --git a/ses_steps.c b/ses_steps.c index ca14cfc..1afadcb 100644 --- a/ses_steps.c +++ b/ses_steps.c @@ -37,13 +37,12 @@ static ses_step_t* ses_steps[] = &ses_step_jr, &ses_step_va_diode, &ses_step_va_transistor, -#if 0 + &ses_step_jr, &ses_step_va, &ses_step_va_balance, &ses_step_output, -#endif }; ses_flow_t* ses_flow_alloc()