0
Answered

Example Simulink model for IQANDesign

Abhijit Das 3 years ago in IQAN toolbox for Simulink updated by Gustav Widén (System support) 3 years ago 11

Hello - being new to IQANDesign and trying Simulink code generation for the first time, I am getting an error while trying out a very simple Simulink model (attached). I have seen the video tutorial on YouTube and I am wondering if I can get hold of any example Simulink model that I can check with my Simulink setup or a list of instructions on how to prepare a Simulink model to comply with IQAN.tlc? 

Also, as shown in the image (attached), during code-generation I am seeing a warning saying the model is not saved. This is kind of strange as my model isn't opened during this process. It also asked me to choose between 'Refresh' or 'Cancel'. I have chosen 'Refresh' in this case.  

Image 2274

Now I am seeing the error as shown below. The full error log is included as *.txt file. 

Image 2276

I am using the following configuration for both parent and referenced models. 

Image 2278

Any help in this regard would greatly be appreciated. 

Thank you!

Abhijit

Here is the Youtube video that I was referring to. 

IQAN_Simulink_test.slx
testModel.slx

IQANDesign-Simulink_error.txt

I looked at the top and referenced models, looks like the errors you got was related to the data types.

In model configuration parameters, try setting these the same, and you should be able to get it to compile. 

Thanks. I am now using the shared configuration for both models and now I can do the c-code generation fine. The problem now is when I am trying to generate the *.ism file. So, I have these quick questions as follows - 

Question 1: Can I generate *.ism using only MinGW compiler? 

Question 2: I am using MATLAB 2020a, is that ok?

Question 3: How do you use Simulink for IQANDesign code generation (instead of using IQAN.export())? I tried to use Embedded Coder option and getting errors. 

Case 1: If I am only using MinGW as the compiler, then as you can see below I am getting an error while building the export code although *.tlc code generation was successful. 

Case 2: If I am using Taskin as the compiler, I do see the same error as above if I am using the command window as IQAN.export('IQAN_Simulink_test').

But if I am using Embedded Coder option from Simulink, I can generate the code successfully although this would not generate the required *.ism file for IQANDesign. The image below shows the successful compile folder structure. 

Case 3:  If I use the HighTec toolchain, again seme error with IQAN.export('IQAN_Simulink_test'). With Simulink and Embedded Coder, I am getting some sort of license error even though I have moved the license.lic file into its desired folder. 

I would really appreciate if you can show me where I am making mistakes or send me a tutorial that can I follow to avoid these errors. 

Also, can you please explain when to use which compilers (MinGW vs MinGW+HighTec vs MinGW + TASKIN)? 

Files are attached for your reference.

IQAN_Simulink_test.slx

shared_config.mat
testModel.slx

Thank you.

Abhijit




+1

I tried with your config, and noticed there is a problem if the toolchain is set to MinGW

Set Tollchain to either Hightec or Tasking, even if you have none of them.

To only generate PC code for IQANsimulate, bring up IQAN.preferences and set Build only simulator code

When the build is successful, you should find the generated .ism file in the sub folder \out\ExportCode\

As I mentioned in my earlier post, I am getting the same error no matter what config I am choosing. As you advised, I am using the config below. 

Just to make sure I didn't screw up the model configuration in any way, I recreated the models (attached) and tried again with no luck. 

Can you confirm if the following models run in your system with IQAN.export() command and generate a *.ism file? If not and if you are getting an error, can you share the content of error log? Lastly, if you able to resolve the issue, can you elaborate how you did? 


I am really clueless here and stuck at the same point for days now. 

IQAN_Simulink_Test.slx

sharedConfig.mat

TestModel.slx

Your new config file had a small mistake that wasn't in the previous one, solver fundamental sample time was set to Auto. 

The IQAN model check gave an error for that. 
Here is a modified config file: 

sharedConfig.mat

With this I was able to generate the .ism (did it for simulator only). 

IQAN_Simulink_Test.ism


For the previous problem, I am not sure why it does not work when you try it. One difference is that I've only tried it on a PC that has the target compiler installed. 

Another thought, try deleting the two subfolders (out and cache) before the next attempt. Maybe something in there from a previous attempt is causing problems.

Yes, I do that as well. 

Thanks for pointing that out, although I am not sure if the error is related to the sample time as all the Simulink checks were satisfied. But I changed the config to match yours (Fig. 1) and still seeing the same error. After a careful look, it seems to me that my MinGW compiler may have some issues as the error occurs just after the MinGW compiler kicks in the process (shown below Fig. 2). So, do you have a recommended MinGW compiler installation that is compatible with parker TLC? I am asking this as Matlab has a recommended one (link). But for this case, I downloaded from here and follow the standard instruction. Is that ok? When I run mex -setup from MATLAB command window, I do see that the MinGW compiler is set correctly (see below Fig. 3). So, I am super confused now. 

+1


This works! I was using a 64bit version of MinGW which was not compatible and from error log, it was quite difficult to find out that it's a compiler issue. 

I just now got the user manual for IQANDesign toolbox and the correct MinGW location is also given there. I wish if I had this document earlier to save some time. 

Thank you for your support. 

Answered

Thanks. The same document for the toolbox is available from the add-on manager, but I guess with a separate document it is a lot easier to find. 

Good to hear it is working now!