FMI co-simulation run time error in Simulink - simulink

At first I have exported a simulink model to FMU in Simulink and then imported this FMU also in the Simulink using FMU import block and later when I tried to run the simulation the following error shows up, could anyone please help me out with this?
Log from FMU: [category:logStatusError, status:fmi2Error] Simulation terminated due to error(s) at start time.
Log from FMU: [category:logStatusError, status:fmi2Error] fmi2ExitInitializationMode: FMU encountered runtime error during simulation.

Related

PREOP to SAFEOP failed error in ECAT state machine Twincat 3

I am trying to control a Staubli arm (CS9) using a C6930 BEckhoff PLC using uniValPLC. I have configured the robot as ECAT slave. When I want to stablish stablish comunication between two devices, I have the following 3 errors:
The problem occurs when I link PLC variables with robot variables. Twincat continues in run mode despite of the errors, but I can not read robot variables.
Please I need help.
Thanks.

How to fix conflicting simulink simulation accelerated artificats issue when running test in parallel mode?

My goal is to optimize the time it takes to run a set of simulation test cases. I'm having issues running test with parallel processing and accelerated simulation features. https://www.mathworks.com/help/simulink/ug/how-the-acceleration-modes-work.html
Context:
I have 29 Simulink files that are called inside of a parametrize Matlab Unit Test. The Simulink files have a lot of reference models. Before running a 20 second simulation for each simulink, the simulinks have to load all reference models and create a lot of simulation artifacts in a work folder. A lot of reference model are shared in-between simulink projects. The simulink projects have 64/187 reference model that run in accelerated mode. Normal mode generates .mexw64, and accelerated mode generates .slxc and .mexw64 in the work folder.
Action:
I run 1 test once . All in normal mode. My tests Succeed.
I run 29 test sequentially. All in normal mode. My tests Succeed.
I run 1 test once, then I run the 29 test in parallel clusters.All in normal mode.My tests Succeed.(**See Ref #1)
I run 1 test once, All in Accelerator Mode. My tests Succeed.
I run 29 test sequentially. All in Accelerator mode. My tests Succeed.
I run 1 test once, then I run the 29 test in parallel clusters,All in Accelerator Mode.My tests Fails.
Expected & Results:
I expected my simulation running in accelerator/parallel mode to have same positive results as the normal/parallel mode. But :
I'm having read/write/building issue using shared resources on
parallel tread when I run 2 test in parallel.
My parallel thread fails when I try to run 29 at the
same time.
Any idea how to fix this?
I tried different build configuration in simulation and build settings, I tried reduce the number of accelerated targets, and reading online resources.
Error:
#1
Building with 'Microsoft Visual C++ 2015 (C)'.
LINK : fatal error LNK1104: cannot open file 'D:\GIT\***\***\work\sim_artifacts\***_src_msf.mexw64'
NMAKE : fatal error U1077: 'C:\PROGRA~1\MATLAB\R2017b\bin\win64\mex.EXE' : return code '0xffffffff'
Stop.
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Build procedure for model: '***_src' aborted due to an error.
#2
The client lost connection to worker 4. This might be due to network problems,
or the interactive communicating job might have errored.
Ref:
How to fix missing simulink simulation artificats issue when running test in parallel mode?
https://www.mathworks.com/help/simulink/gui/rebuild.html
https://www.mathworks.com/help/simulink/ug/model-callbacks.html#
https://www.mathworks.com/help/simulink/ug/reuse-simulation-builds-for-faster-simulations.html
https://www.mathworks.com/help/matlab/ref/matlab.unittest.testrunner.runinparallel.html
My problem was a data concurrency issues.
I found the solution.
Solution:
Now I run a test once in accelerator mode to generate cached folder (simulation targets and accelerated artifacts). Then I copy the cache folder 29 times. then I assign each folder to 1 parallel test run as input. Hence, all parallel test read and write in different folder hence they don't conflict with each other anymore.
Ref:
https://www.youtube.com/watch?v=cKK3qpBjixA
https://www.mathworks.com/help/simulink/ug/model-reference-simulation-targets-1.html
https://www.mathworks.com/help/simulink/ug/not-recommended-using-sim-function-within-parfor.html
you need to address any workspace access issues and data concurrency issues to produce useful results. Specifically, the simulations need to create separately named output files and workspace variables. Otherwise, each simulation overwrites the same workspace variables and files, or can have collisions trying to write variables and files simultaneously.
Code:
function setParCacheFolder()
%% get Simulink Files names
originalPath = path;
addpath(genpath('***\***\***\***'));
file=getFileNames('FOOTEST_*.slx','***\***\***\***');
for i = 1:length(file)
%% open/load simulink system
[~,NAME,~]=fileparts(file(i));
sys{i}=NAME;
open_system(sys{i});
%% copy Cache Folder
copyfile(fullfile(pwd,'\***\work\sim_artifacts'), fullfile(pwd,strcat('\***\work\sim_artifacts',sys{i}{1})));
%% get specific cache folder
get_param(0, 'CacheFolder')
%% set specific cache folder
set_param(0, 'CacheFolder', fullfile(pwd,strcat('\***\work\sim_artifacts',sys{i}{1})));
%% save simulink project
save_system(sys{i}{1},[],'SaveDirtyReferencedModels','on','OverwriteIfChangedOnDisk',true);
bdclose('all');
end
path(originalPath);
end

Vector CANoe error while running the config file

I am getting Rx error while running the configuration file for CANoe.I am not understanding the reason behine this.
Vector CANoe which supports Ethernet.
I am pasting the actual error.
Please help me in fixing this issue.

failed using cuda-gdb to launch program with CUPTI calls

I'm having this weird issue: I have a program that uses CUPTI callbackAPI to monitor the kernels in the program. It runs well when it's directly launched; but when I put it under cuda-gdb and run, it failed with the following error:
error: function cuptiSubscribe(&subscriber, CUpti_CallbackFunc)my_callback, NULL) failed with error CUPTI_ERROR_NOT_INITIALIZED
I've tried all examples in CUPTI/samples and concluded that programs that use callbackAPI and activityAPI will fail under cuda-gdb. (They are all well-behaved without cuda-gdb) But the fail reason differs:
If I have calls from activityAPI, then once run it under cuda-gdb, it'll hang for a minute then exit with error:
The CUDA driver has hit an internal error. Error code: 0x100ff00000001c Further execution or debugging is unreliable. Please ensure that your temporary directory is mounted with write and exec permissions.
If I have calls from callbackAPI like my own program, then it'll fail out much sooner with the same error:
CUPTI_ERROR_NOT_INITIALIZED
Any experience on this kinda issue? I really appreciate that!
According to NVIDIA forum posting here and also referred to here, the CUDA "tools" must be used uniquely. These tools include:
CUPTI
any profiler
cuda-memcheck
a debugger
Only one of these can be "in use" on a code at a time. It should be fairly easy for developers to use a profiler, or cuda-memcheck, or a debugger independently, but a possible takeaway for those using CUPTI, who also wish to be able to use another CUDA "tool" on the same code, would be to provide a coding method to be able to disable CUPTI use in their application, when they wish to use another tool.

Dymosim OPC server: Items cannot ce acessed by MATLAB

I'm currently using Dymola 2015 and try to run my model on an embedded OPC server. It is a very simpel model, a sine wave with a real output interface.
So far, the following things are working:
I can run the embedded OPC no problem
The data can be accessed from MatrikonOPC Explorer
I can initialize and run the server with MATLABS OPC Toolbox
However, I still have these problems:
I can NOT read data from MATLABS OPC Toolbox. When I run the Toolbox inside Simulink and add tags to the OPCRead-Block, it gives the warning "No items defined for the group". When I try to access the data by command line inside MATLAB, it gives me the error message "Unexpected unkown exception from MEX file"
When I try to build a bridge to transfer the data from Dysmosim Server to another OPC server with Matrikon's Data Manager, I get the error "Could not create output tag xxxxx.xxx": The server could not be started.
Any help is appreciated.