Simscape PreCopyFcn prevents simulation running when in referenced model

13 views (last 30 days)
A colleague has created a Simscape simulation of a Plant using hydraulic components (he has the full suite, I just have Simscape and the associated libraries installed).
I can run his model OK if I treat it as standalone (it runs in Restricted mode). However, when I include his Plant model as a referenced model in a whole system simulation it fails to run:
Error evaluating 'PreCopyFcn' callback of Check Valve block (mask)
When I open the block's callbacks they are all greyed out so I cannot see the callback. However, I can reveal it programatically :
>> get_param(gcb, 'PreCopyFcn')
ans =
simscape.compiler.sli.internal.callback('PreCopyFcn',gcbh);
So it appears that simply running a referenced model that contains Simscape blocks requires a Copy, and that is a restricted function. But running a simulation containing the same block all by itself is fine... any thoughts on how to overcome this?
PS - I can't even see what happens when I remove the block - Restricted Mode prevents it's deletion too!
PPS - Colleague is on holiday for the next two weeks, so unless I 'administer' his SimHydraulics licence to myself I'm really stuck.

Answers (1)

Yifeng Tang
Yifeng Tang on 22 Jun 2022
Attempt to answer from 10 years later ... lol.
It sounds to me that it's a feature of Simscape and its Add-On libraries working properly. The restricted mode is designed such that a user with Simscape license can run a model created using Add-On libraries, e.g. Simscape Fluids, but cannot modify what is inside the model. Here is a list of thing you can do in the restricted mode vs full mode:
Hope this helps.

Categories

Find more on Creating Custom Components and Libraries in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by