Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

sim command produces error

0 votes
262 views
Hi

I am trying to run a model using PLECS blockset using the sim command in a script. The model runs just fine by pressing the run button, but when I try to use sim I get the following error:

Warning: "Cannot execute method 'set' on '<a href=\"matlab:open_and_hilite_hyperlink ('dos_plecs/Circuit','error')\">dos_plecs/Circuit</a>' while simulation is running"

My script is the following

%
% Model initialization
%
fs=20e3; % Bridge/Controller switching/sampling frequency
Ts=1/fs; % Bridge/Controller switching/sampling period

L2=1e-6; % Transformer leakage inductance
N=8; % Transformer turns ratio
C3=15e-6; % Bridge bias capacitor

L1=200e-6; % Rectifier filter inductance
C2=10e-6; % Rectifier filter capacitor
R1=20; % Load

% PLECS model parameters update
plecs('set', 'dos_plecs/Circuit/L2', 'L', 'L2');
plecs('set', 'dos_plecs/Circuit/C3', 'C', 'C3');
plecs('set', 'dos_plecs/Circuit/Tr2', 'n', '[1 N]');
plecs('set', 'dos_plecs/Circuit/L1', 'L', 'L1');
plecs('set', 'dos_plecs/Circuit/C2', 'C', 'C2');
plecs('set', 'dos_plecs/Circuit/R1', 'R', 'R1');

%
% Model simulation
%
mdl = plecs('get','','CurrentCircuit')
sim('dos_plecs');
asked Jul 5, 2022 by Alberto Sanchez (12 points)
Alberto, can you please send you model to support@plexim.com?  Please include version information for both MATLAB and PLECS.

Please log in or register to answer this question.

...