Error calling same reusable functions

조회 수: 14 (최근 30일)
Enrico Boscariol
Enrico Boscariol 2014년 2월 20일
답변: Sam Rajakumar 2020년 1월 14일
I have an algorithm developed in Simulink (Matlab 2013b) that I use to produce Embedded Code. Since I am using an IIR filter atomic blockset several times I decide to make this function reusable. I tried to implement 2 istances of the same fileter but I keep getting this error:
"The subsystems 'PM_drive/1ms_ISR/IdqefCalc/FilterSpeedRef2' and 'PM_drive/1ms_ISR/IdqefCalc/FilterSpeedRef1' have the same function name 'IIR_Filt'. This is not legal unless the systems are identical copies of each other. Please ensure that these subsystems will have different function names by either modifying the function name of one of them or modifying the 'Maximum identifier length' parameter on the Code Generation > Symbols pane of the Configuration Parameters dialog"
As sugegsted the 2 functions are identical (obtained but copy and paste). I don't understand why the error tells to ensure that the functions have different names when the purpose of reusable functions is to call the same function passing different parameters.
  댓글 수: 1
Naty S
Naty S 2015년 3월 22일
I have got the same issue (Matlab 2015a), also tried copy pasting them.. even changed the name and it still does not work..
The subsystems 'Act_Model/ActuatorsModel/Servo_InvScaling16' and 'Act_Model/ActuatorsModel/Servo_InvScaling' have the same function name 'Servo_InvScaling'. This is not legal unless the systems are identical copies of each other. Please ensure that these subsystems will have different function names by either modifying the function name of one of them or modifying the 'Maximum identifier length' parameter on the Code Generation > Symbols pane of the Configuration Parameters dialog

댓글을 달려면 로그인하십시오.

채택된 답변

Aker
Aker 2018년 4월 8일
편집: Aker 2018년 4월 8일
I get the same problem and solved it.
It's because the data types for the same of the different copy is different
then the coder wanna generate different function prototype to match the different inputs
As we set the function name to manual and have the same name
then the coder will thow an error.
Just use type convert in front of the input ports to solve this.

추가 답변 (1개)

Sam Rajakumar
Sam Rajakumar 2020년 1월 14일
Right Click one of the block and select Block parameters,click code generation and change function name to solve the issue.

Community Treasure Hunt

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

Start Hunting!

Translated by