Skip to content

Commit

Permalink
Squashed 'motor_control' changes from 86e05e6..a6d968d (#847)
Browse files Browse the repository at this point in the history
a6d968d Merge pull request Xilinx#333 from yunleiz/next
51577ce keep on refining README.md index.rst release.rst
fdd127d refined pwm_gen.rst svpwm_duty.rst index.rst release.rst tutorial.rst README.md
e924359 [doc] fixed typos
c442eeb [doc] fixed typos
bc12d74 Merge pull request Xilinx#332 from yunleiz/next
7ffdf66 [doc] Fix typos
d6df03a Merge pull request Xilinx#331 from yunleiz/next
dfa95f5 [doc] refine doc
7f5d0ce Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into next
0443aca refined README.md index.rst release.rst tutorial.rst
2bcaaac Merge branch 'next' of gitenterprise.xilinx.com:FaaSApps/xf_motorcontrol into next
b086140 [doc] refine doc
8dd5ca6 Merge pull request Xilinx#330 from yipengz/ffnext_update_docs
dd6ac51 cousumer_to_consumer
e9c89c6 update_table_svpwm
c488c25 Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into ffnext_update_docs
24ab9c2 re-org_svpwm_docs
8779702 Merge pull request Xilinx#329 from yunleiz/next
4206f4a [doc] refine readme
5d511f7 Merge pull request Xilinx#328 from yunleiz/next
636cbda [doc] remove all 'graph'
6448b6f Merge branch 'next' of https://gitenterprise.xilinx.com/FaaSApps/xf_motorcontrol into ffnext_proofread
61edba1 renew_svpwm_docs_except_tutorial
a875af7 Merge pull request Xilinx#327 from congt/next
afa2d61 Merge pull request Xilinx#326 from yipengz/ffnext_proofread
691567f [tutorial]fix errors
b2b6e66 renew_benchmark_data
b740131 proofread_impl_resources

Co-authored-by: sdausr <[email protected]>
  • Loading branch information
2 people authored and GitHub Enterprise committed Apr 28, 2023
1 parent 43bb110 commit 7f2fe1b
Show file tree
Hide file tree
Showing 21 changed files with 329 additions and 619 deletions.
13 changes: 7 additions & 6 deletions motor_control/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Vitis Motor Control Library

Vitis Motor Control Library is an open-sourced Vitis library written in C++ for accelerating graph applications in a variety of use cases. It now covers a level of acceleration: the module level (L1).
Motor Control Library is an open-sourced library written in C/C++ for accelerating developments of motor control applications. It now covers 4 algorithm-level L1 APIs including FOC, SVPWM__DUTY, PWM_GEN and QEI. Operator-level APIs, such as Clarke transform and its inverse transform, Park transform and its inverse transform and PID are also implemented. The use of ap_fixed data types makes the code easy to understand and further develop. A virtual motor model is provided for doing the verifications of FOC solely in the Vitis environment.

## Overview

The algorithms implemented by Vitis Motor Control Library include:

- FOC with position sensor
- QEI
- SVPWM_DUTY
- PWM_GEN
- FOC: the API is for sensor based field-orientated control (FOC).The eight control modes it supports cover basic speed and torque control modes, as well as field-weakning control.
- SVPWM_DUTY: the API is the front-end for Space Vector Pulse Width Modulation (SVPWM) to calculate ratios.
- PWM_GEN: the API is the back-end for Space Vector Pulse Width Modulation (SVPWM) to generate output signals based on ratios.
- QEI: the API is for quadrature encoder interface(QEI).


## Documentations

Expand All @@ -18,6 +19,6 @@ For more details of the Motor Control library, please refer to Motor Control Lib

## License

The source code in this library is licensed under the MIT license,
The source code in this library is licensed under the MIT X11 license,
which you can find in the LICENSE.txt file.

2 changes: 1 addition & 1 deletion motor_control/docs/Doxyfile_L1
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Vitis MotorControl Library"
PROJECT_NAME = "Vitis Motor Control Library"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
8 changes: 4 additions & 4 deletions motor_control/docs/src/benchmark.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ These are details for benchmark result and usage steps.
Test Overview
--------------

Here are benchmarks of the Vitis Motor Control Library using the Vitis environment and comparing with cpu().
Here are benchmarks of the Vitis Motor Control Library using the Vitis environment.

.. _l2_vitis_motorcontrol:
.. _l1_vitis_motorcontrol:


* **Download code**
Expand All @@ -85,14 +85,14 @@ These Motor Control benchmarks can be downloaded from `vitis libraries <https://
git clone https://github.com/Xilinx/Vitis_Libraries.git
cd Vitis_Libraries
git checkout main
cd motorcontorl
cd motor_control
* **Setup environment**

Specifying the corresponding Vitis, XRT, and path to the platform repository by running following commands.

.. code-block:: bash
source <intstall_path>/installs/lin64/Vitis/2022.2/settings64.sh
source <intstall_path>/installs/lin64/Vitis/2023.1/settings64.sh
source /opt/xilinx/xrt/setup.sh
export PLATFORM_REPO_PATHS=/opt/xilinx/platforms
12 changes: 6 additions & 6 deletions motor_control/docs/src/benchmark/FOC_sensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@
Sensor based field-orientated control (FOC)
=============================================

Sensor based field-orientated control(FOC) example resides in ``L1/tests/IP_FOC_sensor`` directory. The tutorial provides a step-by-step guide that covers commands for building and running IP.
Sensor based field-orientated control(FOC) example resides in ``L1/tests/IP_FOC`` directory. The tutorial provides a step-by-step guide that covers commands for building and running IP.

Executable Usage
==================

* **Work Directory(Step 1)**

The steps for library download and environment setup can be found in :ref:`l2_vitis_motorcontrol`. For getting the design,
The steps for library download and environment setup can be found in :ref:`l1_vitis_motorcontrol`. For getting the design,

.. code-block:: bash
cd L1/tests/IP_FOC
* **Run and Build IP(Step 2)**

Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of hours.
Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of minutes.

.. code-block:: bash
Expand Down Expand Up @@ -109,7 +109,7 @@ Figure 2 : Motor speed in 8 modes in simulation
:width: 70%
:align: center

The Motor Model parameters by default simulation and Derived Motor Configuration is setting in the commen.hpp and is shown by table 1 and table 2:
The Motor Model parameters by default simulation and Derived Motor Configuration is setting in the commen.hpp, and are shown by table 1 and table 2:

Table 1 : Motor Model parameters by default

Expand Down Expand Up @@ -141,7 +141,7 @@ AXI-lite Parameter of FOC setting in simulation
:width: 70%
:align: center

Other AXI-lite Parameter is all zero in the start of simulation.
Other AXI-lite Parameter is all setting to zero in the first mode in simulation.

File Based Simulation of FOC IP's result is shown blow.

Expand Down Expand Up @@ -252,7 +252,7 @@ The max throughput is 20M/s by 22.2 and 23.1 .
+------------+----------+----------+----------+----------+---------+-----------------+
| IP | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
+------------+----------+----------+----------+----------+---------+-----------------+
| FOC_sensor | 2 | 0 | 67 | 5019 | 5179 | 300 |
| FOC_sensor | 2 | 0 | 67 | 5019 | 5179 | 100 |
+------------+----------+----------+----------+----------+---------+-----------------+

Table 4 : IP profiling of Sensor based field-orientated control
Expand Down
58 changes: 29 additions & 29 deletions motor_control/docs/src/benchmark/PWM_GEN.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The steps for library download and environment setup can be found in :ref:`l1_vi
* **Run and Build IP(Step 2)**

Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of hours.
Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of minutes.

.. code-block:: bash
Expand All @@ -63,48 +63,48 @@ Note: Default arguments are set in run_hls.tcl
.. code-block:: bash
SIM_SVPWM: --------------------------------------------------------------------------------------------------------------------------------------------------------
SIM_SVPWM: Item: | Vcmd_a High% Low% Dead% High Low Dead | Vcmd_b High% Low% Dead% High Low Dead | Vcmd_c High% Low% Dead% High Low Dead
SIM_SVPWM: Item: | Vcmd_a High% Low% Dead% High Low Dead | Vcmd_b High% Low% Dead% High Low Dead | Vcmd_c High% Low% Dead% High Low Dead
SIM_SVPWM: --------------------------------------------------------------------------------------------------------------------------------------------------------
SIM_SVPWM: 0 | 0.0 (V) 54% 44% 1% 549 441 10 | 0.0 (V) 54% 44% 1% 549 441 10 | 0.0 (V) 54% 44% 1% 549 441 10
SIM_SVPWM: 1 | 7.4 (V) 82% 16% 1% 823 167 10 | -14.1(V) 27% 71% 1% 276 714 10 | 6.6 (V) 80% 18% 1% 801 189 10
SIM_SVPWM: 2 | 14.0(V) 82% 16% 1% 824 166 10 | -7.6(V) 27% 71% 1% 275 715 10 | -6.5(V) 30% 68% 1% 304 686 10
SIM_SVPWM: 3 | 8.2 (V) 83% 15% 1% 832 158 10 | 5.6 (V) 76% 22% 1% 766 224 10 | -14.0(V) 26% 72% 1% 267 723 10
SIM_SVPWM: 4 | -8.0(V) 27% 72% 1% 270 720 10 | 14.0(V) 82% 16% 1% 829 161 10 | -6.1(V) 31% 67% 1% 318 672 10
SIM_SVPWM: 5 | -14.1(V) 27% 71% 1% 279 711 10 | 6.7 (V) 80% 18% 1% 806 184 10 | 7.2 (V) 82% 17% 1% 820 170 10
SIM_SVPWM: 6 | -7.3(V) 27% 71% 1% 279 711 10 | -6.8(V) 29% 69% 1% 293 697 10 | 14.0(V) 82% 17% 1% 820 170 10
SIM_SVPWM: 7 | 6.2 (V) 78% 20% 1% 787 203 10 | -14.1(V) 27% 71% 1% 271 719 10 | 7.8 (V) 82% 16% 1% 828 162 10
SIM_SVPWM: 8 | 24.0(V) 54% 44% 1% 549 441 10 | 24.0(V) 54% 44% 1% 549 441 10 | 24.0(V) 54% 44% 1% 549 441 10
SIM_SVPWM: 9 | -24.0(V) 54% 44% 1% 549 441 10 | -24.0(V) 54% 44% 1% 549 441 10 | -24.0(V) 54% 44% 1% 549 441 10
SIM_SVPWM: 0 | 0.0 (V) 49% 49% 0% 2499 2491 10 | 0.0 (V) 49% 49% 0% 2499 2491 10 | 0.0 (V) 49% 49% 0% 2499 2491 10
SIM_SVPWM: 1 | 7.4 (V) 74% 24% 0% 3742 1248 10 | -14.1(V) 25% 74% 0% 1257 3733 10 | 6.6 (V) 72% 26% 0% 3644 1346 10
SIM_SVPWM: 2 | 14.0(V) 74% 24% 0% 3747 1243 10 | -7.6(V) 25% 74% 0% 1252 3738 10 | -6.5(V) 27% 72% 0% 1382 3608 10
SIM_SVPWM: 3 | 8.2 (V) 75% 24% 0% 3785 1205 10 | 5.6 (V) 69% 30% 0% 3481 1509 10 | -14.0(V) 24% 75% 0% 1214 3776 10
SIM_SVPWM: 4 | -8.0(V) 24% 75% 0% 1230 3760 10 | 14.0(V) 75% 24% 0% 3769 1221 10 | -6.1(V) 28% 70% 0% 1447 3543 10
SIM_SVPWM: 5 | -14.1(V) 25% 74% 0% 1268 3722 10 | 6.7 (V) 73% 26% 0% 3666 1324 10 | 7.2 (V) 74% 25% 0% 3731 1259 10
SIM_SVPWM: 6 | -7.3(V) 25% 74% 0% 1268 3722 10 | -6.8(V) 26% 73% 0% 1333 3657 10 | 14.0(V) 74% 25% 0% 3731 1259 10
SIM_SVPWM: 7 | 6.2 (V) 71% 28% 0% 3579 1411 10 | -14.1(V) 24% 75% 0% 1235 3755 10 | 7.8 (V) 75% 24% 0% 3764 1226 10
SIM_SVPWM: 8 | 24.0(V) 49% 49% 0% 2499 2491 10 | 24.0(V) 49% 49% 0% 2499 2491 10 | 24.0(V) 49% 49% 0% 2499 2491 10
SIM_SVPWM: 9 | -24.0(V) 49% 49% 0% 2499 2491 10 | -24.0(V) 49% 49% 0% 2499 2491 10 | -24.0(V) 49% 49% 0% 2499 2491 10
SIM_SVPWM: ************************************** Global Const Parameters ****************************************************
SIM_SVPWM: ** NAME Type Hex Value Physic Value Unit ValueFormat Command-line
SIM_SVPWM: ** TESTNUMBER const 0x a 10 long
SIM_SVPWM: ** clock_freq. const 0x 5f5e100 100 MHz int
SIM_SVPWM: ** NAME Type Hex Value Physic Value Unit ValueFormat Command-line
SIM_SVPWM: ** TESTNUMBER const 0x a 10 long
SIM_SVPWM: ** clock_freq. const 0x 5f5e100 100 MHz int
SIM_SVPWM: **************************************************************************************************************************
SIM_SVPWM: **************************************************************************************************************************
SIM_SVPWM: --------------------------------------------- PWM_GEN SECTION ---------------------------------------------------------
SIM_SVPWM: ****************************************** AXI-lite Parameter ******************************************************
SIM_SVPWM: ** stt_pwm_cycle Read 0x 3e8 1000 cycle of clk_fq int
SIM_SVPWM: ** args_pwm_freq Write 0x 186a0 100000 Hz int [-pwm_fq <pwm frequency>]
SIM_SVPWM: ** args_dead_cycles Write 0x a 10 cycle of clk_fq int [-dead <dead cycles>]
SIM_SVPWM: ** args_phase_shift Write 0x 0 SHIFT_ZERO [-shift_0/-shift_120]
SIM_SVPWM: ** args_sample_ii Write 0x 3e8 1000 int [-ii <sampling II>]
SIM_SVPWM: ** stt_pwm_cycle Read 0x 1388 5000 cycle of clk_fq int
SIM_SVPWM: ** args_pwm_freq Write 0x 4e20 20000 Hz int [-pwm_fq <pwm frequency>]
SIM_SVPWM: ** args_dead_cycles Write 0x a 10 cycle of clk_fq int [-dead <dead cycles>]
SIM_SVPWM: ** args_phase_shift Write 0x 0 SHIFT_ZERO [-shift_0/-shift_120]
SIM_SVPWM: ** args_sample_ii Write 0x 1388 5000 int [-ii <sampling II>]
SIM_SVPWM: ** args_sample_ii IMPORTANT NOTICE for value setting:
SIM_SVPWM: ** for CSIM = 1
SIM_SVPWM: ** for COSIM default value is 1. Suggested value in run_hls_sim.tcl
SIM_SVPWM: ** for HW run '1' is better to avoid backpressure to upstream ADC
SIM_SVPWM: ** for CSIM = 1
SIM_SVPWM: ** for COSIM default value is 1.
SIM_SVPWM: ** for HW run '1' is better to avoid backpressure to upstream ADC
SIM_SVPWM: --------------------------------------------- PWM_GEN END ---------------------------------------------------------
SIM_SVPWM: **************************************************************************************************************************
SIM_SVPWM: All 10 commands' waveform data can be found in file wave_all10
SIM_SVPWM: csim.exe [-shift_0/-shift_120] | [-dc_adc/-dc_ref] | [-pwm_fq <pwm frequency>] | [-dead <dead cycles>] [-ii <sampling II>]
SIM_SVPWM: [-v0/-v1/-v2] #for selecting different test vector
SIM_SVPWM: [-v0/-v1/-v2] #for selecting different test vector
INFO [HLS SIM]: The maximum depth reached by any hls::stream() instance in the design is 50000
INFO: [SIM 1] CSim done with 0 errors.
INFO: [SIM 3] *************** CSIM finish ***************
INFO [HLS SIM]: The maximum depth reached by any hls::stream() instance in the design is 10000
INFO: [COSIM 212-333] Generating C post check test bench ...
INFO: [COSIM 212-12] Generating RTL test bench ...
INFO: [COSIM 212-1] *** C/RTL co-simulation file generation completed. ***
Profiling
=========
Expand All @@ -119,7 +119,7 @@ Different tool versions may result slightly different resource.
+------------+----------+----------+----------+-----------+----------+-----------------+
| IP | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
+------------+----------+----------+----------+-----------+----------+-----------------+
| PWM_GEN | 0 | 0 | 6 | 1413 | 1094 | 100 |
| PWM_GEN | 0 | 0 | 6 | 1387 | 1128 | 100 |
+------------+----------+----------+----------+-----------+----------+-----------------+
Table 2 : Pulse Width Modulation Generator Control IP Profiling
Expand Down
6 changes: 3 additions & 3 deletions motor_control/docs/src/benchmark/QEI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ Executable Usage

* **Work Directory(Step 1)**

The steps for library download and environment setup can be found in :ref:`l2_vitis_motorcontrol`. For getting the design,
The steps for library download and environment setup can be found in :ref:`l1_vitis_motorcontrol`. For getting the design,

.. code-block:: bash
cd L1/tests/IP_QEI
* **Run and Build IP(Step 2)**

Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of hours.
Run the following make command to build your IP targeting a specific device. Please be noticed that this process will take a long time, maybe couple of minutes.

.. code-block:: bash
Expand Down Expand Up @@ -112,7 +112,7 @@ Different tool versions may result slightly different resource.
+------------+----------+----------+----------+----------+---------+-----------------+
| IP | BRAM | URAM | DSP | FF | LUT | Frequency(MHz) |
+------------+----------+----------+----------+----------+---------+-----------------+
| QEI | 0 | 0 | 5 | 948 | 904 | 300 |
| QEI | 0 | 0 | 5 | 948 | 904 | 100 |
+------------+----------+----------+----------+----------+---------+-----------------+

Table 2 : Quadrature Encoder Interface control IP profiling
Expand Down
Loading

0 comments on commit 7f2fe1b

Please sign in to comment.