Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
efef0a4
Add indexme file for the Autogen
Daehoon-Sung Dec 12, 2025
52120e3
Save the setup matlab file and simulink model
Daehoon-Sung Dec 12, 2025
37cda4a
Update the matlab code
Daehoon-Sung Dec 12, 2025
8be0727
Add gitignore and update the simulink
Daehoon-Sung Dec 12, 2025
5155e62
Add auatogen code
Daehoon-Sung Dec 12, 2025
0637235
Update the simulink
Daehoon-Sung Dec 12, 2025
968d3bb
Update the images
Daehoon-Sung Dec 19, 2025
c8b9457
Update the images
Daehoon-Sung Dec 19, 2025
983a023
Revise index.md for Simulink code generation guide
Daehoon-Sung Dec 19, 2025
8599a94
Revise Simulink model setup and C-code generation steps
Daehoon-Sung Dec 21, 2025
2977772
Update image width in autogen index markdown
Daehoon-Sung Dec 21, 2025
0c425e7
Update image width for integrator model in index.md
Daehoon-Sung Dec 21, 2025
620303f
Update index.md
Daehoon-Sung Dec 21, 2025
23000c9
Rename files
noguchi-takahiro Dec 26, 2025
378b580
Update m code in the article
noguchi-takahiro Dec 26, 2025
59594ee
Rename images and update document
noguchi-takahiro Dec 26, 2025
4426256
Update readme
noguchi-takahiro Dec 26, 2025
f5abcd8
Update bullet points
noguchi-takahiro Dec 26, 2025
af99cff
Update size of figure
noguchi-takahiro Dec 26, 2025
b5670f8
Add overview of Autogen
noguchi-takahiro Dec 26, 2025
6b48e2b
Update README
noguchi-takahiro Dec 26, 2025
16ed4ff
Update readme
noguchi-takahiro Dec 26, 2025
2fa6045
Update README
noguchi-takahiro Dec 26, 2025
798529b
Update readme
noguchi-takahiro Dec 26, 2025
213c357
Update indent
noguchi-takahiro Dec 26, 2025
4afe976
Add period
noguchi-takahiro Dec 26, 2025
a2e5724
Update readme
noguchi-takahiro Dec 26, 2025
cd8ac9e
Update readme
noguchi-takahiro Dec 26, 2025
142ebd0
Update REAMDE
noguchi-takahiro Dec 26, 2025
a6f53a9
Update article
noguchi-takahiro Dec 26, 2025
f1a9485
Remove not used picture
noguchi-takahiro Dec 26, 2025
0a2d06c
Add autogen for AMDC article in control with AMDC folder
Daehoon-Sung Mar 19, 2026
18ed30f
Enhance clarity and structure of AMDC control documentation
Daehoon-Sung Mar 19, 2026
a514784
Revise documentation for Simulink and AMDC integration
Daehoon-Sung Mar 19, 2026
413ce16
Expand documentation on Simulink Autogen workflow
Daehoon-Sung Mar 19, 2026
9a8d050
Clarify example model and Simulink integration details
Daehoon-Sung Mar 19, 2026
dbcb2e8
Update AMDC integration details in index.md
Daehoon-Sung Mar 19, 2026
2d49b3e
Update index.md for Autogen and path constraints
Daehoon-Sung Mar 19, 2026
d0cfc3a
Fix minor grammatical issues in index.md
Daehoon-Sung Mar 19, 2026
2622d53
Fix formatting and punctuation in index.md
Daehoon-Sung Mar 19, 2026
a311d0a
Change image format for autogen example diagram
Daehoon-Sung Mar 19, 2026
92bc771
Add the example code and simulink file
Daehoon-Sung Mar 19, 2026
ae76806
Refine conclusion in index.md
Daehoon-Sung Mar 19, 2026
eadd04c
Change the name of the file
Daehoon-Sung Mar 19, 2026
3e16a9c
Fix image reference in auto-gen documentation
Daehoon-Sung Mar 19, 2026
9b069f2
Refine documentation on Simulink Autogen code structure
Daehoon-Sung Mar 20, 2026
9ebd0ac
Add control algorithm function to documentation
Daehoon-Sung Mar 20, 2026
5f2501f
Fix spacing
noguchi-takahiro Mar 23, 2026
380dc81
Update source/getting-started/control-with-amdc/auto-gen/index.md
Daehoon-Sung Mar 23, 2026
257320f
Update source/getting-started/control-with-amdc/auto-gen/index.md
Daehoon-Sung Mar 23, 2026
cf3f57e
Update source/getting-started/control-with-amdc/auto-gen/index.md
Daehoon-Sung Mar 23, 2026
48e38a0
Update source/getting-started/control-with-amdc/auto-gen/index.md
Daehoon-Sung Mar 23, 2026
bc2db18
Update source/getting-started/control-with-amdc/auto-gen/index.md
Daehoon-Sung Mar 23, 2026
d05c1a0
Update index.md with development environment details
Daehoon-Sung Mar 23, 2026
be7c52b
Revise folder structure for autogenerated files
Daehoon-Sung Mar 23, 2026
57125f5
Refactor integration notes and file constraints section
Daehoon-Sung Mar 23, 2026
7761e4e
Move autogen article to tutorial folder
noguchi-takahiro Apr 10, 2026
44db7bb
Rename folder
noguchi-takahiro Apr 10, 2026
5172b6d
Update index
noguchi-takahiro Apr 10, 2026
7126b87
Merge branch 'feature/add-autogen' into feature/add-autogen-control-w…
noguchi-takahiro Apr 10, 2026
118af07
Update index
noguchi-takahiro Apr 10, 2026
09fea6b
Update README
noguchi-takahiro Apr 10, 2026
c704c03
Update index
noguchi-takahiro Apr 10, 2026
1119a87
Remove integrator and add duty ratio block
noguchi-takahiro Apr 11, 2026
5a64baf
Add image, check out this commit to edit the image
noguchi-takahiro Apr 11, 2026
9b9258a
Create subsystem, check out this to update image 2
noguchi-takahiro Apr 11, 2026
1db7955
Update function
noguchi-takahiro Apr 11, 2026
0536387
Update index
noguchi-takahiro Apr 11, 2026
b5fc409
Export model as r2024b
noguchi-takahiro Apr 11, 2026
f513bf5
Update REAMDE
noguchi-takahiro Apr 11, 2026
a6607e9
Update readme
noguchi-takahiro Apr 11, 2026
1dad987
Update readme
noguchi-takahiro Apr 11, 2026
70b2e6f
Update README
noguchi-takahiro Apr 11, 2026
8a74150
Update index
noguchi-takahiro Apr 11, 2026
c2f5c9b
Update index
noguchi-takahiro Apr 11, 2026
6b34a95
Fix link
noguchi-takahiro Apr 11, 2026
93e6f4d
Update index
noguchi-takahiro Apr 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions source/getting-started/control-with-amdc/autogen/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Control with AMDC Using Simulink Autogen

## Background

Modern motor drive systems rely on embedded controllers to execute control algorithms in real time. Traditionally, these algorithms are implemented manually in C/C++, which is time-consuming and prone to implementation errors, especially for complex control systems.

However, Simulink provides a MATLAB-based graphical environment for modeling and simulating control systems. It is extensively used to model, simulate, and analyze complex dynamical systems, including motor drives. The GUI and block diagram environment in Simulink make it user-friendly and easy to validate system performance and controller performance.

The process of converting a user Simulink model for a controller to equivalent C-code for an embedded system (such as the AMDC) is called Automatic Code Generation (Autogen). By using the Autogen capability, control algorithms developed in a block-diagram form can be automatically converted into C code for execution on embedded platforms. This enables developers to design, simulate, and validate control strategies before deploying them to hardware. As a result, it improves development efficiency, reduces implementation errors, and provides a more intuitive framework for control system design.

## Control Approach with Simulink and AMDC

The Simulink + AMDC workflow separates control development into two domains:

- **Design domain (Simulink):**
The control algorithm is developed and validated using a graphical model.

- **Execution domain (AMDC):**
The generated C code is executed in real time on the embedded controller.

In this workflow, the Simulink model represents the control logic, while the AMDC is responsible for executing this logic at a fixed time interval using real sensor data. The Simulink model is typically structured into three subsystems:

1. **Input/Output (I/O):** Used for simulation and visualization only
2. **Plant:** Represents the physical system (used for simulation)
3. **Controller:** Contains the control logic to be deployed

Only the **controller subsystem** is converted into embedded C code.

### Recommended Workflow

The recommended workflow for developing control code is:

1. Develop and validate the control algorithm in Simulink
2. Convert the controller to an atomic subsystem and then to a referenced model
3. Generate C code using Simulink Autogen
4. Integrate generated code into the AMDC project
5. Execute and validate on hardware

## Important Considerations for Simulink Models

For successful development and integration of control code, the following considerations must be observed:

1. **Discrete-Time Implementation**: All blocks within the controller must be discrete-time, since the AMDC executes control logic at fixed sampling intervals.
2. **Fixed-Step Solver**: The Simulink model must use a fixed-step solver to ensure compatibility with real-time execution.
3. **Consistent Sample Time**: The entire controller subsystem should operate at a single, well-defined sample time before converting to an atomic subsystem and creating a referenced model.
4. **Code Generation Settings**: The code generation target should be set to Embedded Coder (`ert.tlc`). The build configuration should enable "Generate Code Only".
5. **Referenced Model Usage**: The controller subsystem should be converted to an atomic subsystem, then converted to a referenced model. Any updates to model settings should be performed after opening the referenced model as the top model.
6. **AMDC Integration Details**
- All generated source (`*.c`) and header (`*.h`) files must be included in the AMDC project.
- The autogenerated folder must be added to the compiler include paths.
- Do not delete any generated files, as some auxiliary files may be required during compilation.
7. **File and Path Constraints**
- File paths must not contain whitespace.
- The path to the folder containing the MATLAB script and the Simulink model, as well as any parent directory, must not include whitespace. Otherwise, it will result in a build error.

This organization ensures that the autogenerated controller code is correctly compiled and integrated into the AMDC firmware.

## Example Model

An example tutorial, [Tutorial: Autogen](../../tutorials/autogen/index.md), is provided to demonstrate the Simulink Autogen workflow for control implementation and its integration with the AMDC.

## Conclusion

The Simulink Autogen workflow provides a structured and efficient approach for implementing control algorithms on the AMDC. By separating control design from embedded implementation, this approach enables:

- Rapid development and iteration
- Improved reliability through simulation
- Clear mapping between design and execution

This methodology is recommended for developing advanced control systems on the AMDC platform.
Loading