ses_step_dc_diode.c
authoryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 03:49:44 +0000 (11:49 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 03:49:44 +0000 (11:49 +0800)
scf_eda_pb.h
ses_layout.c
ses_step_battery.c
ses_step_dc_diode.c

index 16aeafc457eba7059c9dfd86b358e5c485a71962..0a30f52d7aaf89069af30530b7567de3ffe96e1c 100644 (file)
@@ -35,6 +35,11 @@ enum {
        SCF_EDA_Diode_NB,
 };
 
+enum {
+       SCF_EDA_Status_ON,
+       SCF_EDA_Status_OFF,
+};
+
 enum {
        SCF_EDA_Transistor_B,
        SCF_EDA_Transistor_E,
index eeebc8c282f065901e5a968518fe6e9929b7e267..7cdc524aa3b910912c9169a10f631920be4cdae3 100644 (file)
@@ -980,7 +980,7 @@ int ses_layout_board(ScfEboard* b)
                        return ret;
                }
 
-               ses_steps_analyse(f, 5, 5);
+               ses_steps_analyse(f, 5, 1);
 
                x = f->x;
                y = f->y;
index 8bdf125b72e1973b9a1a5c49dfb2c8c1d40fdf6c..2357bc66a09d23705456debbe6263d4d6346a560 100644 (file)
@@ -11,11 +11,11 @@ static int _battery_handler(ScfEfunction* f, int64_t ns, int64_t count)
        size_t k;
 
        c     = f->components[0];
-       c->v  = 5;
+       c->v  = 6;
 
        p     = c->pins[SCF_EDA_Battery_POS];
        el    = f->elines[p->lid];
-       el->v = 5;
+       el->v = 6;
 
        p     = c->pins[SCF_EDA_Battery_NEG];
        el    = f->elines[p->lid];
index 78506b5b2821335d5ffd712f71af2efea237c246..245af844fa24b2844d048404c884a2b13988427f 100644 (file)
@@ -5,7 +5,8 @@ static int _dc_diode_handler(ScfEfunction* f, int64_t ns, int64_t count)
        ScfEcomponent*   c;
        ScfEcomponent*   B;
        ScfEline*        el;
-       ScfEpin*         p;
+       ScfEpin*         p0;
+       ScfEpin*         p1;
 
        size_t i;
        size_t j;
@@ -27,6 +28,19 @@ static int _dc_diode_handler(ScfEfunction* f, int64_t ns, int64_t count)
                        if (SCF_EDA_Diode != c->type)
                                continue;
 
+                       p0    = c->pins[ el->pins[j + 1]];
+                       p1    = c->pins[!p0->id];
+                       p0->v = el->v;
+
+                       if (SCF_EDA_Diode_NEG == p0->id)
+                               p1->v = p0->v + 0.7;
+                       else
+                               p1->v = p0->v - 0.7;
+
+                       if (p1->v > B->v || p1->v < 0)
+                               c->status = SCF_EDA_Status_OFF;
+
+                       scf_loge("Diode c%ld, status: %d\n", c->id, c->status);
                }
        }