]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blobdiff - pmsm-control/test_sw/controllers.h
Controllers moved to separate file.
[fpga/rpi-motor-control.git] / pmsm-control / test_sw / controllers.h
diff --git a/pmsm-control/test_sw/controllers.h b/pmsm-control/test_sw/controllers.h
new file mode 100644 (file)
index 0000000..520745e
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * \brief
+ * Speed and position regulators.
+ * \author Martin Prudek
+ * \file controllers.h
+ *
+ */
+#ifndef CONTROLLERS
+#define CONTROLLERS
+
+#include "pmsm_state.h"        /*pmsm state*/
+#include "rp_spi.h"    /*spi struct*/
+
+#define PID_P          0.3
+
+/*     RL-tool results from first order system approx  */
+/*     P=0.16 I=13,4/freq=0.013                        */
+/*     Hodnoty upraveny podle skutecnych vysledku      */
+/*     P=0.8   I=0.01                                  */
+
+#define PID_P_S                0.16            /*2.3 kmita*/ /*1.4 vhodne jen pro P regulator*/
+#define PID_I_S                0.0134
+
+/**
+ * \brief
+ * Very simple position P regulator.
+ * Now only with P-part so that the error doesnt go to zero.
+ */
+void pos_pid(struct rpi_state* state);
+
+/**
+ * \brief
+ * Very simple PI speed regulator.
+ */
+void spd_pid(struct rpi_state* state);
+
+
+#endif /*CONTROLLERS*/