How to set and extract node voltage over time in simulink
21 ビュー (過去 30 日間)
古いコメントを表示
Hello. When I time-transient using simulink, I want to set the voltage value of a specific node and extract the value of the change over time.
For example, when node A is between two resistors, when the initial node A voltage is set to 1V and time-transient, node A voltage is updated according to the circuit over time and I want to know how to extract it. I'd really appreciate it if you could let me know.
0 件のコメント
採用された回答
Rahul
2023 年 6 月 2 日
Hey there,
As per the snapshot provided by you, I tried to recreate the model using Foundations Library>Electrcial components, a To Workspace block for transferring node voltage sequence to a local workspace named out and a voltage measurement subsystem, whose implementation is described in the second image.
The output voltage of the required node can be extracted simply by connecting the positive terminal of the subsystem to the node itself and the negative one to an electrical reference (ground).
I wasn't able to understand what you meant by dynamically setting the node voltage externally, so I just came up with a model to measure/plot the output voltage of the node you specified.
Then, after connecting the To Workspace block to the subsystem output, I renamed the variable in the block configuration to Vout , which can be accessed in the same workspace/directory using a script file (.m) with the following snippet, where test1.slx is the model name:
% Simulating the model
sim('test1.slx')
% Converting the timeseries data to timetable format
TT = timeseries2timetable(out.Vout);
% Accessing simulation variable 'Vout' using timetable
TT.Properties.DimensionNames{2};
% Column Vector for node voltage
outVoltage = TT.(TT.Properties.DimensionNames{2})
I have attached Model snapshots along with the model files (.slx) for your reference as well.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Switches and Breakers についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!