LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview real-time and simpowersystems toolbx from matlab

Hello,
I have a simulink model built with SimPowerSystems toolbox. I want to run this model on a RT target which is a desktop ETS in this case. I follwoed the instructions on how to create and deploy the DLL. There are two problems I am facing--
1. The host screen grays out even though the mapping is correct. (This is verfied by using a similar working file.)
2. The RT target hangs and then the connection is lost. I don't get any error message and after some time as there is no communication, I get error 66/63 etc network related error.
 
The questions are:
1. Is SimPowerSystem toolbox supported in SIT? ( I read that the SimMechanics is not supported.)
2. Is there any limitation on how many nodes I can use so that the RT system can run the model without getting hung up.
The versions I'm using are:
LabView 8.2, SIT 3.0.2
Matlab R2006b, SIMULINK 6.5, Real-time workshop 6.5
microsoft visual C/C++ 6.0
 
Please let me know ASAP if anyone has faced this problem before or if someone can answer my questions.
Thanks,
Gayatri
0 Kudos
Message 1 of 13
(6,121 Views)
1. Is SimPowerSystem toolbox supported in SIT? ( I read that the SimMechanics is not supported.)
 
Yes SimPowerSystems will work with SIT.  I have used it on several occasions.  I've also used it with SimMechanics so I'm not sure where you read that it is not supported.  Any toolkit that can generate code through RTW should work with SIT.
 
2. Is there any limitation on how many nodes I can use so that the RT system can run the model without getting hung up.
 
None that I know of.  The hang may be caused by the desired model step time being smaller or on par with the time it actually takes to solve the model and so you don't have enough time to perform communication back with the host GUI. 
 
The host graying out is discussed in the Help file and typically has to do with signals not be available in the generated code.  Testpoints can be used to overcome this limitation.
 
As for the RT hanging you might want to try and debug it to see where it might be hanging.
 
0 Kudos
Message 2 of 13
(6,115 Views)
Thanks for your comments. This is really encouraging to know there is no compatibility issue with SimPowerSystems and SIT. The SimMechanics info was for older versions, so I'm not sure how it is with recent verisons.

can you please tell me or guide me to tutorial which talks about how to debug the RT system?
I tried highlight execution but I can't do it in the driver VIs so I'm not sure where else to look for.

Thanks again for your help.

Gayatri
0 Kudos
Message 3 of 13
(6,112 Views)
I have some info about the graying out.
When the model runs on localhost, there is no problem. It runs withour error, plotting the correct waveform on the chart. But, when I run the same in real-time, the screen grays out. There is no change made in the VI or the model. So ideally there shouldn't be any data-type mismatch.

Your comments are welcome.

Thanks,
Gayatri
0 Kudos
Message 4 of 13
(6,109 Views)
Signals also can be removed when the code is generated and compiled due to optimizations.  Right clicking on a signal and making it a testpoint forces RTW to include that signal in the compiled code signal list.  The appropriate discussion is posted below.
 

Models Using Signal Storage Reuse, Block Reduction Optimization, or Virtual Blocks

Mappings might appear invalid if the model uses either Signal Storage Reuse or Block Reduction Optimization. These items are options you can set in the Simulink application software to reduce the memory footprint of the model. Disabling these options for the entire model makes all signals available for probing but increases the memory footprint of the model. You can mark individual signals as test points to maintain a reduced memory footprint while keeping certain signals available for probing. To make this change, load the model in the Simulink application software and perform the following actions:

For The MathWorks, Inc. MATLAB® application software release 13, right-click a signal and select Signal properties from the shortcut menu. Place a checkmark in the SimulinkGlobal(Test Point) checkbox and click the OK button to save changes.

For the MATLAB® application software release 14 and later, right-click a signal and select Signal properties from the shortcut menu. Click the Logging and accessibility tab, place a checkmark in the Test point checkbox, and click the OK button to save changes.

Note  If you previously converted this model to a model DLL, you must convert the model to a model DLL again after marking signals as test points.

Similarly, you might not be able to probe signals from Virtual Blocks such as Mux, Demux, Bus Selector, and so on. Marking signals from these blocks as test points makes the signals available for probing.

Refer to the Simulink documentation for information about Signal Storage Reuse, Block Reduction Optimization, Virtual Blocks, and test points.

Models Using Inline Parameters

You might not be able to manipulate model parameters if that model uses the Inline parameters option in the Simulink application software. This option writes a constant value to each model parameter. You must launch the Simulink application software and disable this option so the Simulation Interface Toolkit can manipulate the model parameters.

Refer to the Simulink documentation for information about inline parameters.

Models Containing Linked or Masked Subsystems

You can create mappings to parameters and signals of masked subsystems. However, if a subsystem is linked, or linked and masked, any mappings to parameters and signals of that subsystem appear invalid. Refer to the Simulink documentation for information about linked and masked subsystems.

Subsystems without Parameters or Signals

If a model contains a subsystem that does not have any parameters or signals, that subsystem appears in the model tree when you create mappings. However, you cannot create mappings to/from that subsystem.

<SCRIPT type=text/javascript> if (typeof(Print_Link)=="function") { Print_Link(); } </SCRIPT>
0 Kudos
Message 5 of 13
(6,102 Views)

To debug the SIT RT vis you will need to create a project with your RT target and place the driver VI on this target.  Your host VI will be on the windows machine.  You would then deploy and run the driver VI from the project (you will need to ftp the model dll to the RT system directory) and can debug it just like a Windows based LabVIEW VI.

Instructions for adding RT targets to a project and debugging them can be found in the RT module How-to in the LabVIEW Help.

Message 6 of 13
(6,099 Views)
Thanks again LBoltzmann .
The de-selecting block reduction and signal reuse helped. I was actually doing the same this as you said, creating the project and manually copying the DLL onto the RT target. But now I will go through the help file for more info about debugging.

Will keep you posted


Thanks,
Gayatri
0 Kudos
Message 7 of 13
(6,096 Views)

Hello,
Some update about the issue we discussed yesterday.

1. After I tried de-selecting the optimization options, the SIT connection manager was still set to run in local-host, so it did run correctly. But when it was changed to run on the desktop ETS, it again grayed out the screen, but no other errors. I also tried using a test-point on the signal line to be monitored, still the screen goes gray.Interesting thing is I am still getting an output from the DAQ card connected to the RT target. I can observe the signal on an oscilloscope connected physically through wires.

2. Also, I would like to get an idea if there is any minimum and maximum time-step that the desktop ETS can handle?Or is it solely dependent on how big the model is as this will increase the calculations while running the model?  I have 1000e-6 as my time-step and the waveform coming out from the DAQ already looks stepped! SO increasing the time-step further is not the best option I guess…

3. Using the Real-time System Manager I checked the CPU usage, its 35% even for a simple model I have. And I'm sure if I increase complexity it's going to eat up the CPU time and then I fear if this is the reason I was getting the TCP/IP error. If so, then will using a better processor solve the issue?

Please comment on this.

Thanks for giving you time to my problem.

Gayatri
0 Kudos
Message 8 of 13
(6,067 Views)

Hi Gayatri,

1. So you're not getting any error back? The code does send out the data. Is it not receiving the data properly?

2. It sounds like you might have reached towards the maximum end of the time step. Are you able to increase it any more? Does it change your signal?

3. If you have a bigger model it will increase the CPU Usage. However, the RT OS is meant to be be run at 100%, so CPU usage shouldn't be causing a TCP/IP error.

Regards,

Hillary E
National Instruments
0 Kudos
Message 9 of 13
(6,020 Views)
Hi Hillary,
changing the time-step does change the signal. For a small time-step, i get a smoother signal and for a larger time-step i get a stepped signal.

Thanks for your inputs on the RT system CPU consumtion as well.


Gayatri
0 Kudos
Message 10 of 13
(5,715 Views)