Simscape Model source code

17 ビュー (過去 30 日間)
Ryan Goodfellow
Ryan Goodfellow 2016 年 11 月 18 日
回答済み: Anjali 2024 年 1 月 2 日
I have created a Simscape model by dragging dropping and connecting various components from the electrical foundation library. Now I am interested in looking at the underlying Simscape language source code of the interconnected components. This is similar to how I use OpenModelica for example. How do I do this? I have figured out how to view the source for a single component, but not the entire composition that is in my .slx file. The underlying goal here is to have a look at the DAEs and their interconnections.
Thanks!
~ry

回答 (4 件)

Lucas Lebert
Lucas Lebert 2016 年 12 月 6 日
Hi Ryan, you can access the source code of every block from the Simscape Foundation Library->Electrical, if you double click on the block and click on the link "Source Code". However this is not possible for blocks of the Simscape Electronics library. There is no option to access the source code of these blocks. The functionality of these blocks is explained in detail in the MATLAB documentation though.
  2 件のコメント
Ryan Goodfellow
Ryan Goodfellow 2016 年 12 月 21 日
Hi Lucas,
Thanks for the response, but it does not address the question. I have already stated that I know how to get the equations for a particular component. What I want is the DAE equation system for a composition of components that I create in the designer interface. I require these equations to run a structural analysis algorithm I have coded.
liqun fang
liqun fang 2022 年 4 月 25 日
Hey , have you solved this problem?

サインインしてコメントする。


Rafa Fernan
Rafa Fernan 2017 年 11 月 21 日
Hi Ryan,
I'm looking for the same topic, how I can get the DAE equation system of my simscape system. Did you get it Ryan?
Regards Rafa

Anjali
Anjali 2024 年 1 月 2 日
% DC Servo Motor Control System
% Motor parameters J = 0.01; % Inertia b = 0.1; % Damping coefficient K = 0.01; % Motor constant R = 1; % Resistance L = 0.5; % Inductance
% Transfer function of the motor numerator = K; denominator = [J*L (J*R + L*b) (R*b + K^2)];
G = tf(numerator, denominator);
% Proportional-Integral (PI) Controller Kp = 10; % Proportional gain Ki = 1; % Integral gain
controller = pid(Kp, Ki);
% Closed-loop system closedLoopSystem = feedback(G * controller, 1);
% Time vector t = 0:0.01:5;
% Step response of the closed-loop system step(closedLoopSystem, t); title('DC Servo Motor Control System Step Response'); xlabel('Time (seconds)'); ylabel('Position');
% Displaying the closed-loop t

Anjali
Anjali 2024 年 1 月 2 日
% DC Servo Motor Control System
% Motor parameters J = 0.01; % Inertia b = 0.1; % Damping coefficient K = 0.01; % Motor constant R = 1; % Resistance L = 0.5; % Inductance
% Transfer function of the motor numerator = K; denominator = [J*L (J*R + L*b) (R*b + K^2)];
G = tf(numerator, denominator);
% Proportional-Integral (PI) Controller Kp = 10; % Proportional gain Ki = 1; % Integral gain
controller = pid(Kp, Ki);
% Closed-loop system closedLoopSystem = feedback(G * controller, 1);
% Time vector t = 0:0.01:5;
% Step response of the closed-loop system step(closedLoopSystem, t); title('DC Servo Motor Control System Step Response'); xlabel('Time (seconds)'); ylabel('Position');
% Displaying the closed-loop t

カテゴリ

Help Center および File ExchangeElectrical Sensors についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by