This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Create Bus Object from Constant Block

This example shows how a single Constant block can replace the six Constant blocks that model ex_bus_initial_conditions uses to create a bus object.

load_system('ex_constantbus');
out = sim('ex_constantbus');
open_system('ex_constantbus');

Verify that the output from the Constant block reflects the values from the constant_value_struct.

constant_value_struct
constant_value_struct = 

  struct with fields:

    A: [1x1 struct]
    B: 5
    C: [1x1 struct]

Examine the logged data in the logsout variable, focusing on the A1 bus signal. The constant_value_struct structure sets the B element to 5.

out.logsout.get('A1').Values.B.Data(1)
ans =

     5