MATLAB: How to use set the initial condition to buses that have input signals of different data types in Simulink 7.5 (R2010a)

simulink

I would like to take advantage of the new feature that allows use of initial conditions for a bus with input signals of different data types. Is there an example?

Best Answer

The attached files illustrate the method to use this functionality. Please execute the following steps:
1. Download the attached three files and store it in a location in your MATLAB path (exampleW.mdl, CreateIC.m, & BusObject.mat).
2. Run the 'CreateIC.m' file. This creates a bus object with required signals in the base workspace and the MATLAB structure with initial condition using the command 'Simulink.Bus.createMATLABStruct'.
3. Now run the model and observe the scope. You will see that the initial conditions that are set in the 'CreateIC' MATLAB script takes effect.
Also please note that to use Bus initial condtions you will need to satisfy the following two validity checks:
1. Strict bus modeling: To enable this diagnostic, set the 'Mux blocks used to create bus signals' option to 'error' in Configuration Parameters Dialog -> Diagnostics -> Connectivity.
2. Underspecified initialization detection: To enable this diagnostic, set the 'Underspecified initialization detection' to 'Simplified' in Configuration Parameters Dialog -> Diagnostics -> Data Validity -> Model Initialization