How to set and extract node voltage over time in simulink

21 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Rahul
Rahul il 2 Giu 2023
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.
  1 Commento
성주 김
성주 김 il 2 Giu 2023
Thank you. Your advice was very helpful. In particular, the method of extracting the voltage of a particular node was very helpful. But in the case of "what you mean by dynamically setting the node voltage externally," which you don't understand, it's as follows. The voltage of the node between the two resistors will change over time if the voltage source has a scheme (ex triangle wave, sine wave) that applies a specific voltage over time. We needed to extract the voltage of the node over time, and we wanted to observe that the voltage of node A changes over time with the voltage of node A applied at 1V in the initial state (time = 0). Is there a way to start the voltage of node A with 1V applied to the initial state of time = 0 in the way you told me?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by