10-06-2009 09:35 AM
Hi !
I'm trying to test a simulink model in veristand. I Import the model in veristand and deploy the code to the target. The model seems to works properly. But i want to measure the time used for the model, therefore, i wonder if it's possible to have a trace with tracetoolkit.
Does anyone have any idea ??
Thanks ....
Solved! Go to Solution.
10-06-2009 10:04 AM
Check out this Execution Trace Tool Custom Device provided on the VeriStand Add-ons page. Adding this Custom Device to your System Definition File allows you to programmatically configure, start and stop execution traces that get sent back to the host.
You can examine these traces to see approximately how long your model takes to complete by searching for the thread named after your model. For instance, if your model is named sinewave, then you should see a thread named sinewave_MODEL LOOP. Use this to track your model execution, keeping in mind that there's a small amount of added overhead in the model loop before we schedule your model.
10-07-2009 03:49 AM
Hi Jarrod, thanks for your answer....
So, i followed your instructions, but something is a little bit weird...
When i mesaure the time with the tracetoolkit i get approximatively 100 µs for the model execution. The problem is it takes approximatively 50 % CPU on both cores. The model and the custom device for the tracetoolkit are the only thing that execute on the target (i have no alarm, no card, no procedure....).
The other question is: the model has a lot of parameter ( more than 10 000 ) are all these parameter send periodically to the host ? that's may be the reason why it takes so much CPU ... IF yes, is there a way to disabled the parameters ... ???
O ne last question is there a parameter to know if i'm loosing cycle ? Cause i have a lot of flag in the trace and not a lot of free time ...
10-07-2009 11:13 AM
I am not sure if transmitting the parameters is causing the CPU burden.
We will only transmit the parameters that have been imported in System Explorer as channels. You can double check which parameters have been imported by going to System Explorer and looking in the Parameters section under your model. Any imported parameters will be listed there.
These channel values, along with all other channels, are sent back to the host at a 5Hz interval. We haven't noticed this being a huge CPU burden, but it would have to scale with size.
If you want to test out the effect yourself, simply remove all imported parameters from your model, or just reimport the model without importing any of the parameters. Then redeploy your system and see if it makes a difference. Your parameters will still exist, but you won't be able to set them or read their values. This will at least give you an idea of what's going on. If it does help, let me know, but at that point you can start being selective about which parameters to import.
You can check some System Channel values to know if you are missing iterations at various places. Check out the following channels:
10-12-2009 04:38 AM
Hi Jarrod!
Well, i tested the model, with and without the parameters... When i import all parameters and signals (more than 10 000) i have more than 50% on both CPU (as i said ...) .Moreover both the model count and the HP count are increasing ( I loose cycles...).
When i test the same model without any parameters i have approximatively 4% on the first CPU and 12 % on the second... So It seems that the number of parameters used change the CPU consomption... but i think that's quite normal.
But do you have any graph that shows the CPU consumption and the number of variables used ? So that we can know how many variables are supported, and how many parameters are supported by VeriStand....
And a last question is it possible to import parameters values from a file ?
10-12-2009 09:44 AM
We don't have numbers that specifically reference the CPU burden of extra channels in a system. It would be helpful to profile that. Are you on a Gigabit Ethernet network? Is it 10/100? Is it a private network? These would likely be important factors in the overall performance of the variable transmission.
It is possible to import and export parameter values from a file. In the Model Parameter Manager, you can add one or more text files written in a simplified m-file syntax. So if you have model Workspace Variables named A, B and C, you can import a file like the following:
A = 10;
B = 20;
C= A + B;
You can see that this file format can either set Workspace Variable values directly or configure their values as calculations of other variable values in the system. After importing this file, the variables would have the following values:
10, 20, 30.
If you then manually changed A to 15, C would automatically become 35, due to its dependence on A and B.
You can even create variable values in the text file that don't correspond to any imported model variable. For instance, I could create a variable called D in my text file and use it in calculations of other real model variables, even if D doesn't exist in any model. For instance, I could have the following file:
D = 10;
A = D;
B= D;
C = D;
This allows me to be able to set one variable value and have it propagate simultaneously to multiple other variable values.
You can also set regular model parameters (non-Workspace Variables) using values imported from a file, but you will need to reference the full model parameter path. For instance:
MyModel/Pulse Generator/Amplitude = 1.000000;
However, because of the inherent slashes in the parameter name, you can't use these values directly in calculations like Workspace Variables, because it would look like division.
The easiest way to create one of these files is to click the Save Values button in the Model Parameter Manager tool. Then open the generated text file and edit the values to be what you want.
10-13-2009 04:24 AM
Hi Jarrod!
I'm sorry i'va another question, when you wrote "In the Model Parameter Manager, you can add one or more text files written in a simplified m-file syntax" what do you really think ? Because in veristand i can't find any funtion to add text files. I searched in the model, (it is possible to add a descritpion, set the decimation, the processor where the model will be executed) ... in the parameters (Add a parameter, serach a parameters ..) But i really can't find any import function ...
Ps: the refresh of the Treeview is really really slow ( and takes 100% CPU during 10 s ) ....
10-13-2009 09:01 AM
Sorry if I wasn't clear. The Model Parameter Manager is a tool in the Workspace, not in System Explorer. The initial parameter values are set as those that were compiled into the model. You can only change those parameters by recompiling the model or by changing them at run-time with the Model Parameter Manager dialog tool.
10-13-2009 10:18 AM
OK...
Thanks a lot for your help, I don't know why, for me it was logical to set the parameters is the system explorer...
03-10-2017 06:04 AM
dear jarrod_S,
Can you provide the link for downloading that Execution Trace Tool Custom Device. i am also facing same issue with my model in calculating execution time.
Regards,
Vikas