gave92 / Matsim

Matlab/Simulink interface. Easily create Simulink models from a Matlab script.

Home Page:https://it.mathworks.com/matlabcentral/fileexchange/68436-matsim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running example script (sys.layout())

anotherjon opened this issue · comments

  • Operating system = Windows 10.0.17763

  • MATLAB version = '9.12.0.1884302 (R2022a)'

  • Script causing the issue:

Example script from documentation leads to error:
Screenshot

import matsim.library.* % Import Matsim package

sys = simulation.load('my_model'); % Create or load a model named 'my_model'
sys.setSolver('Ts',0.01,'DiscreteOnly',true) % Set solver for the model
sys.clear() % Delete all blocks
sys.show() % Show the model
Vx = FromWorkspace('V_x'); % Add FromWorkspace and Constant blocks
Wr = FromWorkspace('W_r');
Rr = Constant(0.32);

slip = 1 - Vx./(Wr.*Rr); % Evaluate complex mathematical expression
sys.log(slip,'name','slip') % Log the output of the "slip" block

s = Scope(slip); % Create and open scope block
s.open()
sys.layout() % Connect and layout the model
V_x = [0:0.1:10;linspace(5,20,101)]'; % Define input variables
W_r = [0:0.1:10;linspace(5,23,101)/0.32]';
simOut = sys.run('StopTime',10).Logs; % Simulate the system