How can I generate code from the system I've designed in the fuzzy logic designer?

8 vues (au cours des 30 derniers jours)
Hello everyone :)
I am currently facing a problem to generate the coding from fuzzy logic designer. . I'm using FIS mamdani type-1, after inserted all the data such as input, rules, and output i don't know how to generate the coding. How can I generate code from this system? Can someone help me?
Thank you in advance.

Réponse acceptée

Sanju
Sanju le 15 Mar 2024
Modifié(e) : Sanju le 7 Mai 2024
I understand that you want to generate the code from fuzzy logic designer,
To generate code for a fuzzy logic system in MATLAB, you'll need to integrate it into a Simulink model.
Here's a detailed explanation of the process,
  • Design your fuzzy logic system using the Fuzzy Logic Designer tool. Once you've defined your input variables, membership functions, fuzzy rules, and output variables, export the system to the MATLAB workspace. You can do this by selecting "File" > "Export" > "To Workspace".
  • Bring your exported fuzzy system variable into Simulink using a "Fuzzy Logic Controller" block. This block allows you to incorporate fuzzy logic functionality into your Simulink model. You can find this block in the Simulink Library Browser.
  • In the Fuzzy Logic Controller block, specify the name of your fuzzy logic structure (e.g., "FIS"). This structure contains all the fuzzy logic rules and parameters that you defined earlier in the Fuzzy Logic Designer. You can customize the settings of the Fuzzy Logic Controller block to suit your specific application.
  • Once the fuzzy logic controller is integrated into your Simulink model, you can simulate the model to observe how the fuzzy logic system behaves with specific inputs. This allows you to validate the functionality of your fuzzy logic system within the context of your overall system design.
  • When your Simulink model is complete and you're ready to generate code, click on the "Build Model" button (or press Ctrl+B). This initiates the code generation process. Upon successful completion of the build process, you'll find a new folder named "yourModel_grt_rtw" in your current directory. This folder contains all the generated source and header code files for your model.
Note: It's important to note that you'll need a Simulink Coder license to generate code for your fuzzy logic system.
I have attempted to create a Fuzzy Inference System (FIS) model from my end as well. Please find the associated files attached below for your reference,
You can find the model below in the attachements,
The below is the diagnostic viewer window once building is done,
The below are the code files generated after building the model,
Refer to the documentation below to learn more about the specific files generated during the code generation process,
Hope this helps!
  6 commentaires
Sanju
Sanju le 6 Mai 2024
Regarding the code generation, please refer to the answer given above, also if you face any issue please share the complete error message and the model you're working on so that I can check from my end.
Sam Chak
Sam Chak le 6 Mai 2024
If you can provide the model information, please archive the .fis and .slx files into a zipped file, and then attach it here by clicking the paperclip icon . @Sanju has been offering valuable advice on topics related to fuzzy systems.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fuzzy Logic in Simulink dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by