Logging with referenced model

22 次查看(过去 30 天)
Hello,
I have a simscape model that I want to run via sim() command for testing purposes. Since I have input data that depends on the model output (feedback) I created a parent model to reference my model in order to keep my base model clean.
For my tests I want to use the simscape logging which is not a problem if I call the child model directly:
>> simOut = sim('myModel', ...
'SaveOutput', 'on', 'OutputSaveName','yout', ...
'SimscapeLogType', 'All', 'SimscapeLogName', 'logData')
simOut =
Simulink.SimulationOutput:
yout: [1x1 Simulink.SimulationData.Dataset]
logData: [1x1 simscape.logging.Node]
SimulationMetadata: [1x1 Simulink.SimulationMetadata]
ErrorMessage: [0x0 char]
But when I call the Parent model the logging seems not to work and the simOut variable misses a logging field:
>> simOut = sim('myParentModel', ...
'SaveOutput', 'on', 'OutputSaveName','yout', ...
'SimscapeLogType', 'All', 'SimscapeLogName', 'logData')
simOut =
Simulink.SimulationOutput:
yout: [1x1 Simulink.SimulationData.Dataset]
SimulationMetadata: [1x1 Simulink.SimulationMetadata]
ErrorMessage: [0x0 char]
It would be great if anybody could help me about that.
Maybe an additional note:
When I run the second model I get these warnings that I don't understand, yet.
Warning: Ignoring settings in the tunable parameters table for model 'myModel' because it references or is referenced by
another model. Run tunablevars2parameterobjects to create parameter objects with the storage class information from the tunable
parameters table.
Warning: Ignoring settings in the tunable parameters table for model 'myParentModel' because it references or is
referenced by another model. Run tunablevars2parameterobjects to create parameter objects with the storage class information from
the tunable parameters table.
UPDATE:
I found out that the problem is not correlated to the sim() command. That's why I changed the title. Actually I added a SignalEditor-Block to the parent model to check thist. The logging is set to "all" and "Open viewer after Simulation" is checked in the configurations of both models (parent and child) but nothing happens after simulation and no simlog variable appears in my workspace.
  1 个评论
Christian
Christian 2019-9-23
Just found an error message indicating that Simscape does not support what I want:
"Model reference is not supported for Simscape logging. Please turn off Simscape logging in the Simscape configuration pane of the referenced model BoxerModel4."
The only workaround I know is to copy/paste the whole model for "testing" purposes to the parent model although thats really inconvienient...

请先登录,再进行评论。

采纳的回答

Christian
Christian 2020-6-17
For others who might come across this question I'd like to provide the workaround that comes closest to a solution for me. Instead of referencing the model I use the "Root Inport Mapper" (PREPARE→Connect Inputs) and create Signals via click on "EDIT→SIGNALS".
This way it's possible to test several scenarios with just a few clicks once you have created some.
The drawback is that I cannot test "dynamic" inputs this way. It seems not to be possible to change input depending on the model output. I could use the (delayed) output of a component to determine my input via a lookup-table. But then I'd need to change the model itself again.

更多回答(1 个)

Sahithi Kanumarlapudi

类别

Help CenterFile Exchange 中查找有关 Troubleshooting 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by