How do I fix Simulink.DataType object not in scope while using c caller?
76 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
AKHILA
el 8 de Ag. de 2024
Comentada: AKHILA
el 16 de Ag. de 2024
I am using c caller and function used in that is pid controller. While simulating that its showing error like "Unable to resolve 'PID_vars' to a valid type for input port 0 of 'pidexmpl/C Caller'.
Caused by:
Simulink.DataType object 'PID_vars' is not in scope from 'pidexmpl/C Caller'". Can someone tell me how to resolve this error?
2 comentarios
Raghava S N
el 8 de Ag. de 2024
Hi @AKHILA, could you share the Simulink model you are working with? That would help in debugging your issue.
David Balbuena
el 8 de Ag. de 2024
What is PID_vars? Is it a type defined in your external code? If so, you need to represent that in Simulink. The Simulink.importExternalCTypes function can help import that type for Simulink.
Respuesta aceptada
arushi
el 9 de Ag. de 2024
Hi Akhila,
The error message you're encountering indicates that Simulink is unable to resolve the PID_vars data type for the input port of the C Caller block. This typically happens when the data type is not properly defined or not in the scope where it is being used.
Here are some steps to resolve this issue:
1. Define PID_vars as a Simulink.Bus Object
First, ensure that PID_vars is defined as a Simulink.Bus object. This object should define the structure and data types of the elements used in your PID controller.
2. Ensure PID_vars is in the Model's Workspace
Make sure that PID_vars is available in the model's workspace. You can do this by running the script that defines PID_vars before running the simulation or by adding the definition to the model's PreLoadFcn callback.
3. Verify Data Type Scope
Ensure that PID_vars is in the scope of the C Caller block. If you are using a data dictionary, make sure that PID_vars is defined in the data dictionary and that the dictionary is linked to your model.
4. Check the C Caller Block Configuration
Ensure that the C Caller block is correctly configured to use PID_vars as an input type. Double-check the input port settings in the C Caller block.
Hope this helps.
Más respuestas (0)
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!