Load Bus Object into Simulink using From Workspace
70 views (last 30 days)
I am having trouble loading a bus object into Simulink using 'from workspace.' I found a reference link showing how to do this at: http://blogs.mathworks.com/seth/2012/05/14/how-to-load-and-save-bus-signal-data/
For completeness here is the code:
myBus.a = timeseries(sin(t),t);
myBus.b = timeseries(rand(size(t)),t);
However when try to run the simulation I receive the following error:
Error evaluating parameter 'OutDataTypeStr' in 'untitled/From Workspace'
Caused by: Cannot resolve variable 'busObj'
I am using MATLAB 2012b. I tried setting the output data type to double but then I receive the following error:
The From Workspace block 'untitled/From Workspace' is configured to load a structure of timeseries objects from the workspace, but its data type 'double' is not a bus data type. To load bus data in a From Workspace block, set the "Output data type" to 'Bus: BusObjectName'.
I have no idea what I am doing wrong. I followed the details in the tutorial shown above but for some reason Simulink will not run without error. I am also noticing in Simulink that the connection line is staying black, it is not turning into the bus object connector.
I don't want to use the method outlined in Import Structures of timeseries Objects for Buses because that involves going through the import GUI and the simulation I am working is complicated.
Can someone please help me?
Gina on 19 Feb 2015
I had the exact same problem. And it was not obvious how to solve. Finally discovered that just making a bus in the Simulink model isn't enough. After you make the bus, you need to add it to the Base Workspace. Select from Simulink pull down menu select Edit -> Bus Editor. Here, you should see NO BUS defined. Go ahead and add the one you just made into the Base Workspace. You can name the signals. Now the bus should show up in the Bus Object menu for saving to and reading from workspace. This was done with Matlab 2014a.