Skip to content

Conversation

@Daehoon-Sung
Copy link
Contributor

This PR is to close #143

Notes

This PR is to include a procedure how users can implement the Autogen.

Self-Review

In this section, please self-review (answer all questions) on a suitable review checklist prior to requesting review from others. Select a review checklist based on what content is being merged in; see the Review Checklists section.

Reviewer Instructions

Reviewers, please copy and paste a suitable review checklist into your review and answer all questions.

Appendix

This section should be the same for all PRs. Do not edit this section when creating a PR.

Review Checklists

Checklists maintained by the eLev lab for research repositories include:

Standard checklist

1. Are all files under 300 kB (if not, please carefully assess whether it is worth committing them)? **Yes or No**
2. Are all files named according to the appropriate [naming convention](https://github.com/Severson-Group/research-repo-template?tab=readme-ov-file#file-naming), i.e., dash-case, camelCase, snake case? **Yes or No**
3. Do all Markdown files follow the [CONTRIBUTING article template](https://github.com/Severson-Group/.github/blob/main/CONTRIBUTING.md#markdown-documentation-template)? **Yes or No**
4. Do all links work in the material that the PR is adding? **Yes or No**
5. Is the PR configured to close the correct issue(s)? **Yes or No**
6. Did the PR fully address the `Approach` section of the issue(s) it is closing? **Yes or No**

Please work on addressing any **No** items.

Updated the document to focus on Simulink automatic code generation for AMDC, including calibration methods, procedures, and integration with AMDC.
Updated the steps for creating and configuring a Simulink model, including detailed instructions for setting up a reference model and generating C-code.
@Daehoon-Sung Daehoon-Sung marked this pull request as ready for review December 21, 2025 07:18
@Daehoon-Sung
Copy link
Contributor Author

Hello Dr @noguchi-takahiro. I made a report as much as I can so far, and I need some help from you.
Could you help me write the section File Organization ?

Additionally, originally I put all the screenshots for each step but I think it is not necessary. It just makes the article be complicated. Therefore, I removed them and put the most important Simulink block figures. If you agree with this, I can delete the unnecessary image files that are unused.

Lastly, we haven't done Integration with AMDC section and Results sections. If you don't mind, can we sync up together on Monday? Thank you very much Sensei.

@noguchi-takahiro
Copy link
Contributor

Thank you @Daehoon-Sung sensei. Sounds good.

Copy link
Contributor

@noguchi-takahiro noguchi-takahiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Daehoon-Sung. I edited the article and removed the images not used for now. We can restore them anytime.

@elsevers I wonder if you can quickly check this article (PDF rendering version: Simulink Automatic Code Generation for AMDC.pdf) to see if we are on the right track? We tried to make the article as simple as possible, while user can follow the Autogen technique. Meanwhile, I am also thinking to show the result after incorporating it with AMDC implementation in the Result section. If you agree, we will work on this soon.

@elsevers
Copy link
Contributor

Thanks @Daehoon-Sung and @noguchi-takahiro. I took a look through the PDF you kindly attached for me and have left you some minor corrections as annotations here:

Simulink.Automatic.Code.Generation.for.AMDC-ELS-2025-12-30.pdf

I have a big picture comment though: this document is written as a tutorial and doesn't really fit the "Control with AMDC" section. Upon thinking about this, let's split this into two items:

  1. "Control with AMDC" article on Autogen.
  2. tutorial on using Simulink Autogen

1. Control with AMDC Article

Item 1 should focus on explaining the theory and approach of what we are doing with Simulink + AMDC, and not be a set of steps for the user to follow. Take a close look at the structure of the Current Sensor Calibration article and the still-in-progress Encoder article. This document should contain items like the following:

  1. brief explanation of why it is a good idea to use simulink for creating control code (i.e., explain that it facilitates simulation, graphical control development)
  2. explanation of what exactly is generated from Simulink and how that is used in the AMDC. Explaining that this produces a function that the AMDC should call at a fixed time interval. Before calling the function, the AMDC should configure the inputs to it and after calling it (presumably from sampled sensor data), the AMDC should take the outputs and route them to the correct outputs (i.e. duty ratios).
  3. Document how to configure the development environment (what toolboxes to install, where to place files within the repo, what the recommended workflow looks like).
  4. Provide important considerations and settings in Simulink for successful development of AMDC control code -- including items that Steve identifies for us here: https://github.com/Severson-Group/AMDC-Examples/issues/6
  5. An example SLX file that is all ready to download and autogen code -- all settings configured.

Am I missing anything?

2. Tutorial

I think Item 2 (tutorial) should reference the "Control with AMDC Article" and then proceed to guide us through steps of starting from scratch to create an AMDC app that uses auto-gen code. The steps should have us create a new Simulink model, configure it properly (following the guidelines of the "Control with AMDC" article, autogen code, place all files in the correct location of our repo, show how to link it up into an app.

Think about what the example should be. Maybe replacing the C code in the VSI app with auto gen code to calc the duty ratios? (could point out to the user that they can later replace this with a motor current regulator) Or something else?

@noguchi-takahiro noguchi-takahiro changed the title Add article of Autogen Add article of Autogen tutorial Dec 30, 2025
@noguchi-takahiro noguchi-takahiro changed the title Add article of Autogen tutorial Add AMDC article using Simulink Autogen Dec 30, 2025
@noguchi-takahiro
Copy link
Contributor

noguchi-takahiro commented Dec 30, 2025

Thank you @elsevers. I agree that the current article is not exactly the article, but tutorial. This means that we can keep the current article here as a tutorial (while modify slightly, i.e., follow an example of tutorial article), and create a new article as "Control with AMDC Article", which will be tracked through this issue.

@noguchi-takahiro will guide @Daehoon-Sung further on the following item:

Think about what the example should be. Maybe replacing the C code in the VSI app with auto gen code to calc the duty ratios? (could point out to the user that they can later replace this with a motor current regulator) Or something else?

@elsevers probably we can replace the following code from this tutorial using Simulink Autogen code, i.e., calculate theta, duty_a, duty_b, and duty_c using Simulink:

image

What do you think?

@elsevers
Copy link
Contributor

Sounds good.,

I'd suggest that you keep this line in C code:
image

and comment on how this being an example input to the Simulink-generated code, typically obtained by reading an encoder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add AMDC article using Simulink Autogen

4 participants