www.gusucode.com > ArmCortexMFastModelSupportPackage > ArmCortexMFastModelSupportPackage/doc/html/PILandEXTmodeFlows.m
%% PIL and External Mode Flows, Explained % For maintainability and potential extensibility, a description of the % logical file flow for PIL and External Mode are provided. They detail the % software flow direction through the files in this armcortexmvirtualtarget % folder. % %% PIL Flow % % * Start of PIL simulation % * Launcher.m file -> startApplication function % % Into this file from internal MathWorks funcitons. % File loadAndRun.m is called. % % * loadAndRun file and function % % This function grabs relevent data from the running model's configuration % parameters, processes them, and calls the model simulation using MATLAB's % 'system' call. This function returns the TCP port opened, PID of the % simulation, and output file for STDOUT. % % * Launcher.m file -> startApplication function % % The TCP port, PID, and output file are set to properties in this Launcher % file through the PIL run. Then the flow goes back to the MathWorks % software internals. % % * VirtualPlatformCommunicator.m file -> initCommunications function % % This function is called when the details of the ConnectivityConfig.m are % addressed by MathWorks internal flow. This extends the functionality of % an existing MATLAB function called RTIOStreamHostCommunicator. This % function will setup listening on the port being used by the Fast Model by % asking the Launcher for the port number. This extension is needed because % the port number is assigned dynamically, allowing the user to not worry % about what ports to open their simulation on. % % * PIL simulation starts % % Data is passed back and forth from MATLAB/Simulink to the virtual target % running in simulation. The virtual target waits until a certain number of % characters are received from MATLAB/Simulink, and then starts calculating % its response while MATLAB/Simulink waits until it receives a reply. This % process repeats in this synchronous mode until the simulation ends. % % * PIL simulation ends % % * Launcher.m file -> stopApplication function % % An internal MATLAB function is called, killProcess, on the PID and output % file that were stored in the Launcher file at the start of the PIL run. % % * End of PIL simulation % % %% External Mode % % * Start of External Mode simulation % % * externalModeLoadAndRun file and function % % This is set as the load function for external mode for this support % package as opposed to just loadAndRun. Calls loadAndRun first % % * loadAndRun file and function % % This function grabs relevant data from the running model's configuration % parameters, processes them, and calls the model simulation using MATLAB's % 'system' call. This function returns the TCP port opened, PID of the % simulation, and output file for STDOUT. % % * externalModeLoadAndRun file and function % % The PID and output file are saved throughout the run by calling a class % in another file % % * VirtualPlatformRunInfo file and class -> addPIDOutFile function % % Saves the PID and output file of this simulation in a persistent class. % % * externalModeLoadAndRun file and function % % The mex arguments needed by MATLAB internals are set with the dynamic % port number, and saved to this model. % % * External Mode simulation connects to target % % Data is passed back and forth from MATLAB/Simulink to the virtual target % running in simulation. The virtual target runs asynchronously to % MATLAB/Simulink and data is transmitted from the virtual target to % MATLAB/Simulink when it is available and vice versa, resulting in a % continuously updating stream of data until the simulation is stopped. % % * External Mode simulation ends % % * externalModeStop file and function % % This is set as the close function for external mode for this support % package. First the VirtualPlatformRunInfo class is retrieved % % * VirtualPlatformRunInfo file and class -> getPIDOutFile function % % The PID and output file for this simulation are retrieved and sent back % to externalModeStop % % * externalModeStop file and function % % An internal MATLAB function is called, killProcess, on the PID and output % file that were stored at the start of the External Mode run. Then the % relevant PID and output file are cleared from VirtualPlatformRunInfo % class. % % * VirtualPlatformRunInfo file and class -> clear function % % Deletes the PID and output file for this External Mode run from this % map class. % % * End of External Mode simulation % % % Copyright 2018 Arm Holdings