0

速度を制御するための PWM モーター ドライバー用のファジー PID コントローラーを作成するようにコーディングしています。フィードバックは、モーター シャフトに固定されたホール効果エンコーダからの方形波です。

私のコードは、エンコーダからの方形波の 2 つの立ち上がりエッジ間のクロック立ち上がりエッジをカウントして、1 回転の時間を計算できます。コード内の関数は、特定の RPM を 1 回転に必要な時間に変換できます。これがコントローラーの設定値です。

エラーは明らかに設定値と現在の値の差です (1 回転の時間と現在の値)。

これはバック差分 PID 制御アルゴリズムに入り、出力として数値を取得します (基本的には P*エラー + I*(前のエラーの合計) + D (前の現在の速度))。

これは、PWM ドライバー プロセスが PWM 電力出力を増加または減少させるために、特定の PWM デューティ サイクル パーセンテージにマップする必要があります。

このマッピングには概念的な問題があります。出力数値をパーセンテージに変換するにはどうすればよいですか? 私は、最大可能誤差とゼロ誤差のこの値を計算し、これらをそれぞれ 100 と 1% のデューティ サイクルにマッピングする行で考えていました。

コードではなくコンセプトを探しています。ありがとう。

4

1 に答える 1

0

The output of the PID can be in the units required for the process.

Conceptually, think of the P (and the I and D) constants as the conversion factors between the measured error and the output/controlled variable. If you want output in percent from 0 to 100, and the input is in milliseconds, your P term should have units of percents/millisecond. The units of the I and D terms depend on your sampling interval.

If your process variable is "time for one rotation", and you increase the speed (reduce the time) by increasing the duty cycle, then you would need negative coefficients.

于 2014-09-17T07:27:22.103 に答える