}
}
+static void __ses_path_a_diode(ScfEfunction* f, ses_path_t* path, int k, double* a, double* ja)
+{
+ ses_info_t* info;
+
+ ScfEpin* p0 = path->pins->data[0];
+ ScfEpin* p1 = path->pins->data[path->pins->size - 1];
+ ScfEpin* pi;
+ ScfEpin* pj;
+
+ double v = p0->v - p1->v;
+ double jv = p0->jv - p1->jv;
+
+ double r = 0;
+ double jr = 0;
+
+ int i = 0;
+ int j;
+
+ for (j = k; j < path->diodes->size; j++) {
+ info = path->diodes->data[j];
+ pi = path->pins->data[i];
+ pj = path->pins->data[info->i];
+
+ v -= info->n_diodes * SCF_EDA_V_Diode_ON;
+ v -= info->n_NPNs * SCF_EDA_V_NPN_ON;
+
+ double _r;
+ double _jr;
+
+ __ses_path_pr(f, path, i, info->i, NULL, &_r, &_jr);
+
+ 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);
+
+ i = info->j;
+ }
+
+ scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg\n", p0->cid, p0->id, p1->cid, p1->id, r, v);
+
+ if (i < path->pins->size - 1) {
+ pi = path->pins->data[i];
+
+ r += p1->sr - p1->r - pi->pr;
+ jr += p1->jsr - p1->jr - pi->jpr;
+
+ scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, pi->pr: %lg, p1->sr: %lg, p1->r: %lg\n",
+ pi->cid, pi->id, p1->cid, p1->id, r, v, pi->pr, p1->sr, p1->r);
+ }
+
+ ses_ur_i(a, ja, v, jv, r, jr);
+
+ scf_loge("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, a: %lg\n\n", p0->cid, p0->id, p1->cid, p1->id, r, v, *a);
+}
+
static int __ses_path_va_diode(ScfEfunction* f, ses_path_t* path)
{
ses_path_t* child;
double a;
double ja;
- i = 0;
-
- for (j = 0; j < path->diodes->size; j++) {
- info = path->diodes->data[j];
- pi = path->pins->data[i];
- pj = path->pins->data[info->i];
-
- v -= info->n_diodes * SCF_EDA_V_Diode_ON;
- v -= info->n_NPNs * SCF_EDA_V_NPN_ON;
-
- double _r;
- double _jr;
-
- __ses_path_pr(f, path, i, info->i, NULL, &_r, &_jr);
-
- 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);
-
- i = info->j;
- }
-
- scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg\n", p0->cid, p0->id, p1->cid, p1->id, r, v);
-
- if (i < path->pins->size - 1) {
- pi = path->pins->data[i];
-
- r += p1->sr - p1->r - pi->pr;
- jr += p1->jsr - p1->jr - pi->jpr;
-
- scf_logd("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, pi->pr: %lg, p1->sr: %lg, p1->r: %lg\n",
- pi->cid, pi->id, p1->cid, p1->id, r, v, pi->pr, p1->sr, p1->r);
- }
-
- ses_ur_i(&a, &ja, v, jv, r, jr);
-
- scf_loge("c%ldp%ld--c%ldp%ld, r: %lg, v: %lg, a: %lg\n\n", p0->cid, p0->id, p1->cid, p1->id, r, v, a);
+ __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];
pi->a = a;
pi->ja = ja;
+ scf_logi("j: %d, ---------------\n", j);
+
__ses_path_pr(f, path, i, info->i, NULL, &r, &jr);
ses_ir_u(&v, &jv, a, ja, r, jr);
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;