Skip to content

Topology-based simulation and diagnosis of faulty program spectra

License

Notifications You must be signed in to change notification settings

aperez/sfl-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFL Simulator

Topology-based simulation and diagnosis of faulty program spectra, inspired by TU Delft’s SFL simulator.

Our simulator uses DendoPy’s phylogenetic tree simulation to generate a random tree-based topology of components, which emulates a system’s structure. Tests are generated by activating components, and propagating these activations in the topology. The simulator is also able to perform fault injection conditioned by a goodness parameter.

Usage

To run a simulation:

make run desc=example.yml

In the example above, the option desc=example.yml tells the simulator to use the experiment description from file example.yml. A full-fledged experimental description file is also included in the repository: tse.yml.

After running a simulation, results can be plotted by:

make plot desc=example.yml

Python Library

Below is a step-by-step example of simulating and diagnosing faulty spectra with our simulator library.

Setting up

import simulator

Generating a topology

components = 20
topology_generator = simulator.TopologyGenerator(components)
topology = topology_generator.generate()
topology.print_plot()

Simulate transactions

activator = simulator.CoverageActivator(topology)
simulated_transactions = activator.generate(reps = 20)
print("Simulated ", simulated_transactions.transactions, "transactions")

Sample matrices

Default activation probability

spectrum1 = [s for s in simulated_transactions.sample_spectra(1)][0]
spectrum1.print_spectrum()
simulator.print_metrics(spectrum1)

Low activation probability:

simulated_transactions = activator.generate(reps = 20, coefs=[0.5])
spectrum2 = [s for s in simulated_transactions.sample_spectra(1)][0]
spectrum2.print_spectrum()
simulator.print_metrics(spectrum2)

High activation probability

simulated_transactions = activator.generate(reps = 20, coefs=[3.0])
spectrum3 = [s for s in simulated_transactions.sample_spectra(1)][0]
spectrum3.print_spectrum()
simulator.print_metrics(spectrum3)

Inject faults

Single fault

faulty_spectrum1 = spectrum1.copy()
faults = faulty_spectrum1.inject_fault(cardinality=1)
print("Faults: ", faulty_spectrum1.faults)
faulty_spectrum1.print_spectrum()

Multiple faults

faulty_spectrum2 = spectrum1.copy()
faults = faulty_spectrum2.inject_fault(cardinality=1)
faults = faulty_spectrum2.inject_fault(cardinality=1)
print("Faults: ", faulty_spectrum2.faults)
faulty_spectrum2.print_spectrum()

Dependent faults

faulty_spectrum3 = spectrum1.copy()
faults = faulty_spectrum3.inject_fault(cardinality=2)
print("Faults: ", faulty_spectrum3.faults)
faulty_spectrum3.print_spectrum()

Diagnosis

Barinel

mhs = simulator.MHS()
barinel = simulator.Barinel()

trie = mhs.calculate(faulty_spectrum1)
report = barinel.diagnose(faulty_spectrum1, trie)
for index, (candidate, probability) in enumerate(report):
    if index >= 5: break
    print(candidate, probability)

Measuring diagnostic effort

effort = simulator.effort_reduced(faulty_spectrum1, report)
print("Effort to diagnose: ", effort)

About

Topology-based simulation and diagnosis of faulty program spectra

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published