add and simulate faults in system composer models -凯发k8网页登录

main content

add and simulate faults in system composer models

if you have system composer™, you can add faults to the ports of components in your model. after adding faults, you can simulate the model to see their effect. you can apply and simulate faults assigned to scalar or bus connections.

add faults to component ports

you can add faults to component input or output ports. to add faults to system composer component ports:

  1. in a saved system composer model, select a connection.

  2. open the fault analyzer app. in the apps tab, click fault analyzer.

  3. in the fault analyzer tab, in the prepare faults section, click add fault.

  4. in the add fault window, set the properties for the new fault.

  5. click ok.

faults in system composer models have the same properties as faults in simulink® models. for more information, see . you can add faults to component ports associated with any component type.

programmatically add faults

to add faults to a component port, use the function and specify the model element as the port. for example, to add a fault to the first output port of the component mycomponent, in the system composer model, mymodel, enter this command:

simulink.fault.addfault("mymodel/mycomponent/outport/1")

simulate faults on components

to simulate faults in system composer models, follow these guidelines:

  • you must add behaviors to the faults before simulating the model. fault behaviors for system composer models are stored in simulink models. see .

  • the components must be simulink model references. see implement component behavior using simulink (system composer).

  • if the connections are buses, they must be nonvirtual and must use bus compatible blocks. for more information, see .

  • if a component takes a bus as an input, you must define the input elements manually to match the bus elements it receives.

after you simulate, if you log the signals in any of the referenced models, you can view the injection status of the fault and the logged signals from the architectural model by viewing them in the simulation data inspector. in the fault analyzer tab, in the review results section, click data inspector.

example system composer model with fault

this example shows how to model faults in a system composer model. the model contains three simulink model references, and one of the connections has a fault.

inspect the model

in this example, the signals referenced model produces a bus that contains three scalar elements. the transformer referenced model takes the signals and sends each bus element to a minmax block. finally, the reader referenced model reads the signal from transformer. this architectural model uses two nonvirtual buses. the signals model outputs a nonvirtual bus, systembus, which contains the noise, sine, and step elements. signals sends this bus to transformer, which outputs the nonvirtual bus labeled transformedbus to the reader referenced model.

open the transformer referenced model to view the bus handling. the model input contains the same elements as the input bus, signals. because the connection is a bus, and the minmax block does not support buses, the transformer model separates the bus into its elements first by using a bus selector block, and then collects the elements into the transformedbus bus by using a bus creator block.

the in bus element block represents the input port and manually defines the bus elements in order from signals. if these elements do not match the incoming bus, the model is unable to simulate. open the in bus element block to view the element assignments.

inspect the fault

this model has a fault on the output connection of the transformer referenced model. open the fault model, faulted_system_model_faultmodel and click the fault subsystem block outbus_fault to view the fault behavior. the fault behavior splits the bus into its elements to affect each element behavior and combines the elements into a nonvirtual bus. to maintain consistency with the input, the bus creator block creates a bus and assigns it to same nonvirtual bus that transformer outputs.

simulate the model and view the results

simulate the faulted_system_model model. you can view the result in the scope block in the reader referenced model. reader also logs the signal from the input port. you can view the signal results and the fault status in the simulation data inspector. in the fault analyzer tab, in the review results section, click data inspector. you can view the logged signals in the signals section or the fault injection status, outbus_fault, in the fault section.

see also

related topics

    网站地图