ses_step_battery.c
authoryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 02:32:20 +0000 (10:32 +0800)
committeryu.dongliang <18588496441@163.com>
Thu, 20 Jul 2023 02:32:20 +0000 (10:32 +0800)
ses_core.h
ses_step_battery.c [new file with mode: 0644]
ses_step_dc_input.c
ses_steps.c

index ca83fd2aa06762372c99250d25ee558faf536230..1f28f05f9cfab66c8162d6d62c7f83e0a3e39c4c 100644 (file)
@@ -44,6 +44,6 @@ int ses_layout_board (ScfEboard*    b);
 
 int ses_loop_function(ScfEfunction* f, scf_vector_t* loops);
 
-int ses_analyse_function(ScfEfunction* f, int64_t ns, int64_t count);
+int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count);
 
 #endif
diff --git a/ses_step_battery.c b/ses_step_battery.c
new file mode 100644 (file)
index 0000000..b8256b6
--- /dev/null
@@ -0,0 +1,33 @@
+#include"ses_core.h"
+
+static int _battery_handler(ScfEfunction* f, int64_t ns, int64_t count)
+{
+       ScfEcomponent*   c;
+       ScfEfunction*    f;
+       ScfEline*        el;
+       ScfEpin*         p;
+
+       size_t i;
+       size_t j;
+       size_t k;
+
+       c     = f->components[0];
+       c->V  = 5;
+
+       p     = c->pins[SCF_EDA_Battery_POS];
+       el    = f->elines[p->lid];
+       el->V = 5;
+
+       p     = c->pins[SCF_EDA_Battery_NEG];
+       el    = f->elines[p->lid];
+       el->V = 0;
+
+       return 0;
+}
+
+ses_step_t   ses_step_battery =
+{
+       .name    = "battery",
+
+       .handler = _battery_handler,
+};
index d52f2c5f0f8043260ed977dcf30ef7d144cd2344..f27e1f3a8278c48c81d4312638ebd40a697fefc9 100644 (file)
@@ -1,8 +1,34 @@
 #include"ses_core.h"
 
+static int _dc_input_handler(ScfEfunction* f, int64_t ns, int64_t count)
+{
+       ScfEcomponent*   c;
+       ScfEfunction*    f;
+       ScfEline*        el;
+       ScfEpin*         p;
+
+       size_t i;
+       size_t j;
+       size_t k;
+
+       for (i = 0; i < f->n_elines; i++) {
+               el =        f->elines[i];
+
+               for (j = 0; j + 1 < el->n_pins; j += 2) {
+
+                       c  = f->components[el->pins[j]];
+                       p  = c->pins      [el->pins[j + 1]];
+
+                       if (SCF_EDA_PIN_IN & p->flags) {
+                       }
+               }
+       }
+
+}
 
-ses_step_t  ses_step_dc_input =
+ses_step_t   ses_step_dc_input =
 {
-       .name = "dc_input",
+       .name    = "dc_input",
 
+       .handler = _dc_input_handler,
 };
index 4e1b1f9f7c04c2a66790d54a6b310980a0140447..05ae5bcfb814cf6367876c39fe0e17ffeddea76a 100644 (file)
@@ -1,5 +1,7 @@
 #include"ses_core.h"
 
+extern ses_step_t   ses_step_battery;
+
 extern ses_step_t   ses_step_dc_input;
 //extern ses_step_t   ses_step_ac_start;
 
@@ -18,8 +20,9 @@ extern ses_step_t   ses_step_output;
 
 static ses_step_t*  ses_steps[] =
 {
-       &ses_step_dc_input,
+       &ses_step_battery,
 
+       &ses_step_dc_input,
        &ses_step_dc_diode,
        &ses_step_dc_transistor,
 
@@ -31,7 +34,7 @@ static ses_step_t*  ses_steps[] =
 };
 
 
-int ses_analyse_function(ScfEfunction* f, int64_t ns, int64_t count)
+int ses_steps_analyse(ScfEfunction* f, int64_t ns, int64_t count)
 {
        if (!f || ns <= 0 || count < 0)
                return -EINVAL;