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