The Black Box block supports ports that have different sample rates. By default, the sample rate of an output port is the sample rate inherited from the input port (or ports, if the inputs run at the same sample rate). Sometimes, it is necessary to explicitly specify the sample rate of a port (e.g., if the output port rate is different than the block's input sample rate).
SysgenPortDescriptor provides a method called setRate that allows you to explicitly set the rate of a port.
Assume you have a model in which the Simulink
system period value for the model is defined as 2 sec. Also
assume that the example dout
port is assigned a rate of 3 by invoking the setRate method as
follows:
dout.setRate(3);
A rate of 3 means that a new sample is generated on the dout port every 3 Simulink system periods. Because the Simulink system period is 2 sec, this means the Simulink sample rate of the port is 3 x 2 = 6 sec.