Пример #1
0
import fmdtools.faultsim.propagate as propagate
import fmdtools.resultdisp as rd
from tank_model import Tank
from fmdtools.modeldef import SampleApproach

# Nominal Run - nothing happens
mdl = Tank()

endresults, resgraph, mdlhist = propagate.nominal(mdl)

rd.plot.mdlhistvals(mdlhist)
rd.graph.show(resgraph)

# Faulty Run - nothing happens b/c no fault
endresults, resgraph, mdlhist = propagate.one_fault(mdl,
                                                    'Human',
                                                    'NotVisible',
                                                    time=2)

rd.plot.mdlhistvals(mdlhist, fault='NotVisible', time=2)
rd.graph.show(resgraph, faultscen='NotVisible', time=2)

endresults, resgraph, mdlhist = propagate.one_fault(mdl,
                                                    'Human',
                                                    'FalseReach',
                                                    time=2,
                                                    gtype='component')

rd.plot.mdlhistvals(mdlhist, fault='FalseReach', time=2)
rd.graph.show(resgraph, gtype='bipartite', faultscen='FalseReach', time=2)

#import matplotlib.pyplot as plt
Пример #2
0
nominal_state_table = rd.tabulate.hist(mdlhist)
print(nominal_state_table)
#this table is a pandas dataframe we can export with:
# nominal_state_table.to_csv("filename.csv")

#plots can be made on the bipartite version of the graph
endresults_bip, resgraph_bip, mdlhist2 = propagate.nominal(mdl,
                                                           gtype='bipartite')
rd.graph.show(resgraph_bip, gtype='bipartite', scale=2)

##SINGLE-FAULT PLOTS
## SCENARIO 1
##We might further query the faults to see what happens to the various states
endresults, resgraph, mdlhist = propagate.one_fault(mdl,
                                                    'MoveWater',
                                                    'short',
                                                    time=10,
                                                    staged=True)
#Here we again make a plot of states--however, looking at this might not tell us what degraded/failed
short_state_table = rd.tabulate.hist(mdlhist)
print(short_state_table)
#short_state_table.to_csv("test.csv")

#We can further process this table to get tables that show what degraded over time
reshist, diff1, summary = rd.process.hist(mdlhist)
rd.graph.result_from(mdl, reshist, 50)
rd.graph.result_from(mdl, reshist, 50, gtype='normal')
# We can also look at heat maps of the effect of the flow over time
heatmaps = rd.process.heatmaps(reshist, diff1)
# this is the amount of time each are degraded
rd.graph.show(mdl.bipartite,
Пример #3
0
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  8 18:46:24 2020

@author: hulsed
"""
import sys
sys.path.append('../')
from eps import EPS
import fmdtools.faultsim.propagate as propagate
import fmdtools.resultdisp as rd

mdl= EPS()
rd.graph.show(mdl.bipartite, gtype='bipartite')

endresults,resgraph, mdlhists = propagate.one_fault(mdl, 'EE_to_ME', 'toohigh_torque')
rd.graph.show(resgraph)


endclasses, mdlhists = propagate.single_faults(mdl)

reshists, diffs, summary = rd.process.hists(mdlhists)

sumtable = rd.tabulate.summary(summary)


degtimemap = rd.process.avgdegtimeheatmap(reshists)

rd.graph.show(mdl.bipartite,gtype='bipartite', heatmap=degtimemap)
rd.graph.show(resgraph,heatmap=degtimemap)
Пример #4
0
        'line': 'emland'
    }
}  #continue, to_home, to_nearest, emland
mdl = Drone(params=params)
endresults_nom, resgraph, mdlhist = propagate.nominal(mdl)
rd.graph.show(resgraph, pos=mdl.graph_pos)  #, showfaultlabels=False)
#fp.plotflowhist(flowhist3, 'N/A', time=0)
##

#params={'flightplan':{ 1:[0,0,50], 2:[100, 0, 50], 3:[100, 100, 50], 4:[150, 150, 50], 5:[0,0,50], 6:[0,0,0] }}
mdl = Drone(params=params)
## #Check various scenarios individually
##
endresults, resgraph, mdlhist = propagate.one_fault(mdl,
                                                    'StoreEE',
                                                    'S1P1nocharge',
                                                    time=5,
                                                    staged=True,
                                                    gtype='bipartite')

rd.graph.show(resgraph,
              gtype='bipartite',
              pos=mdl.bipartite_pos,
              faultscen='StoreEE S1P1nocharge',
              time=5,
              showfaultlabels=False)
###
#rp.plot_mdlhistvals(mdlhist, 'DistEE short', time=20) #, fxnflows=['StoreEE'])
rd.plot.mdlhistvals(mdlhist,
                    'StoreEE S1P1nocharge',
                    fxnflowvals={'Planpath': ['dx', 'dy', 'dz']},
                    time=5)
Пример #5
0
import fmdtools.faultsim.propagate as propagate

mdl_split = x_to_mdl([1, 1, 55, 2, 0], loc='rural')
mdl_med = x_to_mdl([0, 1, 55, 2, 0], loc='rural')
mdl_med.params['respolicy']

#testing mechanical fault response
#endresults_med, resgraph, mdlhist_med = propagate.one_fault(mdl_med,'AffectDOF', 'RFmechbreak', time=6)
#rd.plot.mdlhistvals(mdlhist_med, fxnflowvals = {'RSig_Traj':'mode', 'Planpath':'mode', 'DOFs': ['planvel','uppwr', 'planpwr'], 'AffectDOF':['LRstab', 'FRstab']}, time=6)
#plot_faulttraj(mdlhist_med, mdl_med.params)
#plot_xy(mdlhist_med['faulty'], endresults_med)

#testing battery fault response
#endresults_med, resgraph, mdlhist_med = propagate.one_fault(mdl_med,'StoreEE', 'S1P1nocharge', time=4)
endresults_med, resgraph, mdlhist_med = propagate.one_fault(mdl_med,
                                                            'StoreEE',
                                                            'S1P1nocharge',
                                                            time=6)
rd.plot.mdlhistvals(mdlhist_med,
                    fxnflowvals={
                        'RSig_Traj': 'mode',
                        'Planpath': 'mode',
                        'DOFs': 'planvel',
                        'StoreEE': 'soc'
                    },
                    time=4,
                    legend=False)
plot_faulttraj(mdlhist_med, mdl_med.params)
plot_xy(mdlhist_med['faulty'], endresults_med)

#testing battery fault response
#endresults_med, resgraph, mdlhist_med = propagate.one_fault(mdl_med,'StoreEE', 'S1P1nocharge', time=4)