File Exchange

image thumbnail

Fault Injection Block (FIBlock)

version 1.0.3 (90.2 KB) by Tagir Fabarisov
FIBlock allows to conduct a fault injection experiment in Simulink models


Updated 12 Nov 2020

From GitHub

View Version History

View license on GitHub

Fault Injection Block for Simulink models.
FIBlock allows to conduct a fault injection experiment in Simulink models
Co-authors: Mustafa Saraoğlu
and Andrey Morozov

Please refer to a comprehensive article regarding the FIBLock:
This block allows to conduct a fault injection experiment (refer to help if needed).
-name of the block instance.
-type of fault: Stuck-at, Package drop, Bias/Offset, Bit flips, Time delay, Noise.
-fault event: Failure probability, Mean Time to Failure, Failure Rate Distribution.
-fault effect: Once, Constant time, Infinite time, Mean Time to Repair.

Failure rate distribution is not supported yet! Bit flips, Time delay, and Noise faults may have some bugs :D In different FIBlock instances, the 'name' of the block in GUI must be different (must be an integer number).

This block allows to conduct a fault injection experiment. Specify:

1) Number of the block instance (e.i. 'name' of the fault injector, name shall be unique).

2) Type of fault:
-Stuck-at. The block output stays constant, preserving the latest correct value before the error occurrence.
-Package drop. The correct output is replaced by the specified Value, emulating a package drop.
-Bias/Offset . The defined positive or negative Bias value is added to the block output.
-Noise. A random noise value is added. The Boundaries are defined as the percentage of the correct value.
-Time delay. A delay is introduced into the signal. During the delay the value is zero.
-Bit flips. The defined Number of bits are inverted in the binary representation of the correct value.

3) Fault event:
-Failure probability. Errors are injected based on the constant Failure probability for each execution of the block function.
-Mean Time to Failure. Errors are injected according to the specified MTTF. Normal distribution.

4) Fault effect:
-Once. An error appears only one time during a simulation.
-Constant time. The block produces erroneous output during the specified Time period.
-Infinite time. The block produces erroneous output until the end of the simulation.
-Mean Time to Repair. Normally distributed MTTR regulates the time of the error effect.

FIBlock also provide, what we call, a chained fault injection. Second output of the FIBlock emits a trigger flag. This output signal could be connected to the second input of the FIBlock. In case of the fault injection, this signal will force trigger fault injectionin second FIBlock.

Made By Tagir Fabarisov, TU Dresden 2020, GNU General Public License v3.0

Cite As

Tagir Fabarisov (2021). Fault Injection Block (FIBlock) (, GitHub. Retrieved .

Comments and Ratings (7)

Tagir Fabarisov

Dear Ahmed,

Thanks for letting me know about this issue. I will be taking a look at it and will return to you back. Mind please, it may take around a week. Rather got overwhelmed with current stuff :D

Please do not hesitate to write me via emai in case of further updates:

Ahmed Fahmy

Perhaps I found some of the issues with bit inversion :
1. The block always expects input data to be double, so if I give it an int or unit of any size it throws an error because of input data mismatch
2. When casting the integer data to double the representation is completely different and when bit flips occur the difference between input data and output data sometimes could be insignificant. This is mainly because of using a typecast function in es_inject_error_bitflip.
3. Even when fixing 2 and replacing typecast with the cast, there is another fundamental problem; The picked bit location(s) for injecting the fault(s) got randomized each cycle which results in unrealistic faulty data.

Ahmed Fahmy

Also, I found another issue with this block. It has 5 ms discrete sample time which doesn't work with any sample time. Ideally, the sample time of this block should follow the sample time of the input signal.

Ahmed Fahmy

Thanks for this great submission.
I have a question regarding bit-flip option. In fact, I wasn't able to get it to work. It doesn't seem to accept fixed-point data types or boolean inputs. Even when I give it a double input I don't see any effect on the signal. I tried to scale my input, but still I don't see any effect. Is there something I am missing that is needed to see its effect?
Thanks again

Andrey Morozov

Mustafa Saraoglu

Tagir Fabarisov

FYI: there is an example Simulink model included to the package with two FIBlock.
You can read more here:

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!