10-17-2012 03:57 AM
Hi,
i work on project that consists in programming a tool to transform a block diagram in the *.mdl file to a block diagram in LabVIEW. The goal is to use its inputs and outputs in the front panel by manipulating "Controls" and "Indicators".
I start with exploring the Simulation Interface Toolkit but i think i'm in the false way because i don't need to simulate the behavior of the block diagram!! I just need to transform it from Simulink file to LabVIEW.
Any idea or suggestions!!
Thx for your response.
10-17-2012
04:59 AM
- last edited on
04-10-2024
02:40 PM
by
Content Cleaner
Wow,
this is really a great ambition. The correct tool ("competative") for Simulink would be the NI LabVIEW Control Design and Simulation Module.
You would use LV Scripting to generate a blockdiagram reflecting the content of the simulink model.
hope this helps,
Norbert
10-17-2012 05:25 AM
Thank you for help, but i'm lost!!
can you explain more how can i start!! What functions from this toolkit should i use!!
Have you an example for tranformation of a simple block in simulink (sum, switch..) into a blockdiagram in LV!
thx
10-17-2012 06:13 AM - edited 10-17-2012 06:13 AM
Hi wad,
that really is a big challenge!
- First you need a tool (or the knowledge) to parse the mdl file to know it's contents (and it's corresponding "block diagram").
- Then you need the knowledge to create VIs by using LV scripting. That's a topic for advanced LV programmers...
- Additionally you need the knowledge to choose the corresponding LV functions for each Simulink function block. Probably more than often you will not find a one-to-one translation...
Start on your own. I doubt there are many people doing such tasks before or after you.
But it will be a great source of learning internals of both programming environments for you! 🙂
10-17-2012
06:27 AM
- last edited on
04-10-2024
02:43 PM
by
Content Cleaner
There is no "transform", at least i am not aware of any tool capable of doing this. From my understanding, that is the reason why you are approaching this task.
And as i already mentioned: This is a very complex and not-easy-to-solve task. I find it possible, that you have to schedule more than twelve "mythical man month" for this task.
That being said, the tools and steps you require are:
1. Analyze the Simulink Model programmatically. If there are any questions on tools/processes, you have to ask MathWorks.
2. Translate the model into LV code. You will have to use VI Scripting to create new VIs and place appropriate function blocks (from the Control Design and Simulation Module and other sources) and connect them.
Note that VI Scripting is not supported by normal NI support channels as it is a LV Labs product.
3. Verify correctness of the LV code as well as code quality. You can use VI Analyzer for some of those tasks.
The biggest concern about this kind of application:
How should the Simulink model to be modularized within different subVIs?
How can you make sure, that those VIs do fit together and are called correctly from a calling VI?
How do you make sure that timing constraints are kept?
What is the platform the LV application is going to run on?
Therefore, i rather suggest you a different, maybe less worksome approach:
Use the models as are and include them in LV code.
hope this clears up things,
Norbert
10-17-2012 06:50 AM
Thank you for your help and your details ![]()
If i understand, it should be an impossible mission as i'm a begginer in LV world
. So i will search an other solution and an other way.
Actually, the purpose of my project is to design a tool to facilitate the work of my teammates.
Infact, the user upload the *.mdl file which will be transformed into a the VI, then we can use the Unit Test Toolkit to perform unit tests. This is the main idea.
So have you another idea how can i process to do that!!
Thank you for your collaboration.
10-17-2012 07:07 AM - edited 10-17-2012 07:09 AM
I am really confused about the aim of the project. You say that fellow developer work with Simulink to create models (for what?).
You want to convert those models *somehow* to LV code which is going to be tested for functionality with the LV Unit Test Framework.
So my conclussion:
My questions:
Coming to the bottom line:
Why are you not searching for a "model verification tool" directly for Simulink?
Norbert
10-17-2012
08:49 AM
- last edited on
04-10-2024
02:44 PM
by
Content Cleaner
The LabVIEW Control Design and Simulatio Module has a tool (Under the Tools menu >> Control and Simulation) that allows you to convert .mdl files into Control and Simulation diagrams in LabVIEW. I would strongly recommend trying this route first before trying to script all in pure LabVIEW code.
For more information, search for Simulation Model Converter in the LabVIEW help with the LabVIEW Control Design and Simulation Module. It is also available online:
Note: This module is additional to LabVIEW and, if you are academic user, in general your license already have this option.
10-17-2012 09:12 AM
To Norbert_B :
I should developp a tool with LV that makes a unit test on a blockdiagram in simulink.
This is the main idea!!!
The tool should has as input the *.mdl file and generate a report witch contain the resluts of the unit test passed on every block of the simulink blockdiagram.
How can i do that!!
Thx
10-17-2012 09:45 AM
wadjabh wrote:I should developp a tool with LV that makes a unit test on a blockdiagram in simulink.
This is the main idea!!!
The tool should has as input the *.mdl file and generate a report witch contain the resluts of the unit test passed on every block of the simulink blockdiagram.
[..]
You should ask MathWorks if there is such a tool available.
Thanks Barp for clearification about the conversion tool. I wasn't aware of that 🙂
So essentially, wadjabh, you can use that tool to get a bunch of LV VIs. I am not sure how easy it will be to test those with the Unit Test Framework though.
Even if its possible, i doubt that this is worth the effort since the result refers to the LV code, not the Simulink model.
So you have to decide weather or not you put faith into the conversion tool for a verification process of your model.
Norbert