Skip to content

Commit

Permalink
Merge pull request #82 from ryanvergel/gh-pages
Browse files Browse the repository at this point in the history
updated kv260
  • Loading branch information
ryanvergel authored Mar 21, 2024
2 parents 1575728 + abe7c6e commit bb9b67b
Show file tree
Hide file tree
Showing 260 changed files with 1,319 additions and 2,532 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified kd240/build/doctrees/docs/foc-motor-ctrl/docs/sw_arch.doctree
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion kd240/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d742fb1f9285d575e23c23d8e366b91a
config: 6b797e8bc20ff47f8c77cbb343942e41
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file modified kd240/build/html/_images/sw_arch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
191 changes: 68 additions & 123 deletions kd240/build/html/_sources/docs/foc-motor-ctrl/docs/app_deployment.md.txt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,100 +13,54 @@

# Introduction

The KD240 Field Oriented Control (FOC) Motor Control Application is intended to
capture general inverter and motor control examples using AMD-Xilinx standard
IP/libraries. The IPs, libraries, and drivers serve as a design example
demonstrating the K24 SOMs capabilities in implementing applications that
require precise control of the motor's speed and torque while minimizing energy
losses and reducing system noise. The IPs, libraries and drivers created are to
be general in the sense they do not assume specific board level hardware for
implementing the necessary cyber-physical boundaries around a given application.

An overview of the motor field orientated control library functionality is
summarized in the following three types of FOC based motor control that are
to be implemented for supporting the KD240. Each focuses on either controlling
the torque or speed of the motor.

* Torque Control - Default FOC control is focused on maximizing the torque output
of a motor by optimizing the quadrature (q) vector which represents the useful
motor torque and minimizing the direct (d) vector component. In this mode of
operation the goal is to keep motor torque constant by adjusting motor speed.

* Speed Control - Speed control is implemented through an additional PI control
that adjusts the motor torque to the motor to maintain a constant speed.

* Field Weakening Control - The field weakening control method trades off optimal
torque in order to increase the speed of the motor. This is accomplished by
adjusting the relationship of the q-vector and d-vector in FOC.
The KD240 Field Oriented Control (FOC) Motor Control Application is intended to capture general inverter and motor control examples using AMD-Xilinx standard IP/libraries. The IPs, libraries, and drivers serve as a design example demonstrating the K240 SOM capabilities in implementing applications that require precise control of the motor's speed and torque while minimizing energy losses and reducing system noise. The IPs, libraries, and drivers created are general in the sense they do not assume specific board level hardware for implementing the necessary cyber-physical boundaries around a given application.

An overview of the motor field orientated control library functionality is summarized in the following three types of FOC based motor control that are to be implemented for supporting the KD240. Each focuses on either controlling the torque or speed of the motor.

* Torque Control: Default FOC control is focused on maximizing the torque output of a motor by optimizing the quadrature (q) vector which represents the useful motor torque and minimizing the direct (d) vector component. In this mode of operation, the goal is to keep motor torque constant by adjusting motor speed.

* Speed Control: Speed control is implemented through an additional PI control that adjusts the motor torque to the motor to maintain a constant speed.

* Field Weakening Control: The field weakening control method trades off optimal torque to increase the speed of the motor. This is accomplished by adjusting the relationship of the q-vector and d-vector in FOC.

## Design and Implementation

The following provide more detailed definitions around the defined motor control
modes of operation.
The following provide more detailed definitions around the defined motor control modes of operation.

### Torque Control
Torque control implements a closed loop control focused on maintaining a specified
torque value. In this mode of operation the q-vector provides the useful torque output
of the motor and the d-vector the force that is parallel to the rotor. The d-vector
represents non-useful force and thus any non-zero value is considered an error.

![Torque-Control](./media/torqc.png)
Torque control implements a closed loop control focused on maintaining a specified torque value In this mode of operation, the q-vector provides the useful torque output of the motor, and the d-vector provides the force that is parallel to the rotor. The d-vector represents non-useful force, and thus any non-zero value is considered an error.

![Torque-Control](./media/torqc.png)

### Speed Control
Constant speed control is achieved through a PI controller that adjusts the motor
torque to maintain a specified motor speed.

Constant speed control is achieved through a PI controller that adjusts the motor torque to maintain a specified motor speed.

![Speed-Control](./media/speedc.png)

## Sensored FOC Application

The block diagram below shows the implementation of the Sensored FOC application.

Motor Voltage and Current Feedbacks are provided by the ADC-HUB. QEI Encoder
provides the measured RPM from the BLDC motor as a feedback to the FOC control
block. The generic PWM block is to provide a series of commands for each
switch of a three leg inverter, with discrete on/off commands for each device.
The Gate drive Pin control (GD Pin Control) & enable block is intended to
implement the translation from PWM functionality provided by the SVM PWM HLS
IP to the KD240 specific gate drive circuit implementation. The gate drive
enable signal is used to enable the power stage. This signal is shared across
all three power bridge phases. The KD240 Motor Control block provides motor
fault generation and system fault protection logic, which is used to check for
gross failures in the system such as shorted motor winding or failed phase leg.

As seen by the block diagram in the kernel space, All the soft IPs are supported
by kernel drivers using the industrial I/O framework. The drivers provide a
number of features that make the HW easier to configure and use these devices.
It has support for buffers, common sysfs interface and integration with libiio
framework in the user-space. A Motor Control application library is integrated
with the device drivers to seamlessly operate different modes set by the user.
User can control various set points and gain parameters using the Dashboard GUI,
as well as observe live plots of important metrics such as speed, feedback
current/voltages and torque. Instructions to test demo application is presented
in the next section.
The following block diagram shows the implementation of the Sensored FOC application.

Motor Voltage and Current Feedbacks are provided by the ADC-HUB. The QEI Encoder provides the measured RPM from the BLDC motor as a feedback to the FOC control block. The generic PWM block is to provide a series of commands for each switch of a three leg inverter, with discrete on/off commands for each device. The Gate drive Pin control (GD Pin Control) and enable block is intended to implement the translation from the PWM functionality provided by the SVM PWM HLS IP to the KD240 specific gate drive circuit implementation. The gate drive enable signal is used to enable the power stage. This signal is shared across all three power bridge phases. The KD240 Motor Control block provides motor fault generation and system fault protection logic, which is used to check for gross failures in the system, such as shorted motor winding or failed phase leg.

![Sensored-FOC](./media/sensor-foc-blk.png)
As seen by the block diagram in the kernel space, all the soft IPs are supported by kernel drivers using the industrial I/O framework. The drivers provide a number of features that make the hardware easier to configure and use these devices. It has support for buffers, common sysfs interface and integration with libiio framework in the user-space. A Motor Control application library is integrated with the device drivers to seamlessly operate different modes you set. You can control the various set points and gain parameters using the Dashboard GUI, as well as observe live plots of important metrics such as speed, feedback current/voltages, and torque. Instructions to test demo application are presented in the next section.

![Sensored-FOC](./media/sensor-foc-blk.png)

## Next Steps

* [Application Deployment](app_deployment.md)
* Go back to the [KD240 FOC Motor Control application start page](../foc_motor_control_landing)
* Go back to the [KD240 FOC Motor Control Application Start Page](../foc_motor_control_landing)

<!---

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.


Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,102 +4,72 @@
</td>
</tr>
<tr>
<td align="center"><h1>Known Issues and Debug help</h1>
<td align="center"><h1>Known Issues and Debug Help</h1>

</td>
</tr>
</table>

# Known issues & limitations
# Known Issues and Limitations

* QEI reported speed is showing glitches. QEI library computation of the speed
has a known issue and will be addressed with a QEI library update.
* QEI reported speed is showing glitches. The QEI library computation of the speed has a known issue and will be addressed with a QEI library update.
* Motor lower speed mode control capability is approximately 250 rpms.
* Default motor tuning values are provided for the KD240 Motor Accessory Kit
based the Anaheim motor with the plastic disk visual load. This load disk
primarily acts as an inertial load and thus if users are connecting other loads
to their motor they should plan on conducting their own tuning process and
defining custom tuning defaults based on their load testing.
* Open-loop control mode is intended as a test mode and thus does not implement
any SW based ramp control. Users will see fault protections triggered if immediately
trying to set open-loop mode control with a Vq voltage > ~10V. If using open-loop
user is responsible for incrementally stepping up the Vq command to their desired
voltage setting. Typical use-cases of open-loop mode have Vd set to 0V.
* DC link current reading is limited to reading analog values > ~0.5A due to a
limitation in the KD240 HW. Users should not assume DC link current feedback is
accurate until it is > ~0.5A.
* If the bokeh server is stopped while the motor is running, the motor will not
stop. The motor should be stopped through the GUI by switching to Off mode
before stopping the bokeh server.
* Default motor tuning values are provided for the KD240 Motor Accessory Kit based the Anaheim motor with the plastic disk visual load. This load disk primarily acts as an inertial load and thus if you are connecting other loads to your motor, you should plan on conducting your own tuning process and defining custom tuning defaults based on your load testing.
* Open-loop control mode is intended as a test mode and thus does not implement any software based ramp control. You will see fault protections triggered if immediately trying to set open-loop mode control with a Vq voltage > ~10V. If using an open-loop, you are responsible for incrementally stepping up the Vq command to your desired voltage setting. Typical use cases of open-loop mode have Vd set to 0V.
* DC link current reading is limited to reading analog values > ~0.5A due to a limitation in the KD240 hardware. You should not assume the DC link current feedback is accurate until it is > ~0.5A.
* If the bokeh server is stopped while the motor is running, the motor will not stop. The motor should be stopped through the GUI by switching to Off mode before stopping the bokeh server.

# Debugging Motor Control Application

If the motor control application is not functioning as intended, follow these
debugging steps to diagnose and resolve issues.
If the motor control application is not functioning as intended, follow these debugging steps to diagnose and resolve issues.

1. **Check Wire Connections**
- Ensure that wire connections matches the configuration shown in
the application deployment page.
- Verify that the 24V DC supply is connected and the wall power is up.
- Check DS9 LED, which represents the DC link; it should be in a high state.
- Confirm that the Quadrature Encoder Interface (QEI) encoder from the motor
is properly connected to the board.
* Ensure that wire connections matches the configuration shown in the application deployment page.
* Verify that the 24V DC supply is connected and the wall power is up.
* Check DS9 LED, which represents the DC link; it should be in a high state.
* Confirm that the Quadrature Encoder Interface (QEI) encoder from the motor is properly connected to the board.

2. **Read DC Link Voltage**
- If the application repeatedly fails to start with system faults,
measure the DC link voltage by reading data from the ADC interface
(ADC-HUB voltage channel 6).
- Use the command `iio_attr -c xilinx_adc_hub voltage6` to check the
voltage reading and should read around 24V.
* If the application repeatedly fails to start with system faults, measure the DC link voltage by reading data from the ADC interface (ADC-HUB voltage channel 6).
* Use the command `iio_attr -c xilinx_adc_hub voltage6` to check the voltage reading and should read around 24V.

```bash
iio_attr -c xilinx_adc_hub voltage6
dev 'xilinx_adc_hub', channel 'voltage6' (input), attr 'input', value '25.116806030'
```
A reading significantly lower or higher than the tolerance range of the power
supply could indicate a hardware failure on the board.

A reading significantly lower or higher than the tolerance range of the power supply could indicate a hardware failure on the board.

3. **Debug PL Interfaces**
- If unexpected behavior occurs, start probing different blocks of the
Programmable Logic (PL) interfaces for debugging.
- Utilize IIO utilities or the IIO driver sysfs for the specific hardware
interface.
- Refer to the [Device and Channel Attributes](./sw_arch.md#device-and-channel-attributes)
section for detailed information on debugging hardware interfaces.
* If unexpected behavior occurs, start probing different blocks of the programmable logic (PL) interfaces for debugging.
* Utilize the IIO utilities or the IIO driver sysfs for the specific hardware interface.
* For detailed information on debugging hardware interfaces, refer to the [Device and Channel Attributes](./sw_arch.md#device-and-channel-attributes) section.

4. **Gate Drive Mode**
- Ensure that the software application is set to a valid mode that turns
the Gate Drive ON, except for the off mode.
- Monitor DS10 LED; it should go high in modes other than off.
* Ensure that the software application is set to a valid mode that turns the Gate Drive ON, except for the off mode.
* Monitor DS10 LED: it should go high in modes other than off.

5. **Observe Errors and Messages from the Application**
- Keep an eye on the serial console for error messages or other relevant
information.
- Review `dmesg` logs, which provide valuable information from the respective
hardware drivers. These logs can be a helpful source of diagnostic information.
* Keep an eye on the serial console for error messages or other relevant information.
* Review the `dmesg` logs, which provide valuable information from the respective hardware drivers. These logs can be a helpful source of diagnostic information.

6. **Network Connection**
- If the application doesn't respond to changes from the GUI, verify the network
connection by pinging the host address.
- Sometimes, a web socket disconnection message may appear, indicating a
communication issue. If you encounter such disconnection issues, try killing the
Bokeh server and relaunching the server and the dashboard.
* If the application does not respond to changes from the GUI, verify the network connection by pinging the host address.
* Sometimes, a web socket disconnection message may appear, indicating a communication issue. If you encounter such disconnection issues, try killing the Bokeh server and relaunching the server and the dashboard.

Sample Disconnection Message:

```bash
2023-09-13 18:47:32,361 WebSocket connection closed: code=None, reason=None
``````

<!---

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

-->

Expand Down
Loading

0 comments on commit bb9b67b

Please sign in to comment.