Build and initialization of target model for saving video
The build starts after clicking "Build model" button in the Simulink model or calling the function rtwbuild from Matlab command line. It might seem that the compilation is stuck in the phase of "Caching model source code", but this phase only takes quite a long time. It takes the longer, the higher resolution video you want to save. Another time demanding phase is the compilation of the source code. One just have to be patient. Then the download to the target starts. A separate signal is created for every single pixel of the video and these signals are added to the File Scope one after another. Information about adding each signal is displayed on the target screen, which slows the whole process down even more. We tried disabling target GUI option in the xPC Explorer to avoid this slowdown, but it did not help, because even with the GUI turned off, there is a textual output on the target screen. We contacted both Speedgoat and Mathworks support to find out whether it would be possible to disable the informative text input during the initialization of the target application, but both of the responses were negative. To avoid the delay, we subsample the video frames before passing them to the File Scope block to reduce the number of signals.
The initialization of the target application takes really a long time with higher number of signals in the File Scope, so it often happens that a TCP/IP timeout occurs during the initialization. However, the initialization on the target continues autonomously, so one can just wait until the initialization finishes and then reconnect to the target with initialized application.
Another useful tip concerns loading a built target application without rebuilding it. This can save quite a lot of time in cases when the build of the target application takes very long. One can simply create a target object and then use it to load the built application
tg = xpc;
tg.load('built_application_name');
Build and initialization of a target application that just acquires and saves a video in 204x204 pixels resolution on the local hard drive takes around 17 minutes. For a higher resolution video, we got an error during compilation:
'fatal error C1128: number of sections exceeded object file format limit'
In conclusion, xPC Target does not provide any way how to save a high resolution video on the local hard drive. The only possible workaround to achieve video logging is the one described here, which is unfortunately only applicable to video sequences at quite low resolution.
The initialization of the target application takes really a long time with higher number of signals in the File Scope, so it often happens that a TCP/IP timeout occurs during the initialization. However, the initialization on the target continues autonomously, so one can just wait until the initialization finishes and then reconnect to the target with initialized application.
Another useful tip concerns loading a built target application without rebuilding it. This can save quite a lot of time in cases when the build of the target application takes very long. One can simply create a target object and then use it to load the built application
tg = xpc;
tg.load('built_application_name');
Build and initialization of a target application that just acquires and saves a video in 204x204 pixels resolution on the local hard drive takes around 17 minutes. For a higher resolution video, we got an error during compilation:
'fatal error C1128: number of sections exceeded object file format limit'
In conclusion, xPC Target does not provide any way how to save a high resolution video on the local hard drive. The only possible workaround to achieve video logging is the one described here, which is unfortunately only applicable to video sequences at quite low resolution.