Degradation Modelling

This rover shows how degradation modelling can be performed to model the resilience of an engineered system over its entire lifecycle.

[1]:
import fmdtools.analyze as an
import fmdtools.sim.propagate as prop
import numpy as np
import matplotlib.pyplot as plt
import multiprocessing as mp
[2]:
from examples.rover.rover_degradation import DriveDegradation, PSFDegradationLong, PSFDegradationShort

Degradation models are defined independently of the fault model, but have attributes (e.g., functions) which may correspond to it directly.

Because degradation may only occur in specific functions/flows (and may not have inter-functional dependencies), it is not necessary for the degradation model to have the same

[3]:
deg_mdl = DriveDegradation()
deg_mdl
[3]:
drivedegradation DriveDegradation
- DriveDegradationStates(wear=0.0, corrosion=0.0, friction=0.0, drift=0.0)
[4]:
deg_mdl_hum_long = PSFDegradationLong()
deg_mdl_hum_long
[4]:
psfdegradationlong PSFDegradationLong
- PSFDegradationLongStates(experience=0.0)
[5]:
deg_mdl_hum_short = PSFDegradationShort()
deg_mdl_hum_short
[5]:
psfdegradationshort PSFDegradationShort
- PSFDegradationShortStates(fatigue=0.0, stress=0.0, experience=1.0)
[6]:
from examples.rover.rover_model import Rover, plot_map
fault_mdl = Rover(p={'ground':{'linetype': 'turn'}})
graph = fault_mdl.as_modelgraph()
fig, ax = graph.draw()
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_7_0.png
[7]:
fig.savefig("func_model.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)
[8]:
endresults, mdlhist = prop.nominal(fault_mdl)
fig, ax = plot_map(fault_mdl, mdlhist)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_9_0.png
[9]:
fig.savefig("sine_rover_environment.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

As shown, there are two degradation models here:

  • one which focusses solely on faults in the drive system, and

  • one which focusses on the human degradation of fatigue Below we simulate these to model to the degradation behaviors being modelled in this drive system.

Drive Degradation

[10]:
deg_mdl = DriveDegradation()
endresults, mdlhist = prop.nominal(deg_mdl)
fig, ax = mdlhist.plot_line('s.wear', 's.corrosion', 's.friction', 's.drift', 'r.s.corrode_rate', 'r.s.wear_rate', 'r.s.yaw_load')
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_13_0.png

The major behaviors are:

  • wear

  • corrosion

  • friction

  • drift

These behaviors result from the accumulation of the following rates over each time-step:

  • yaw_load

  • corrode_rate

  • wear_rate

These degradation behaviors have additionally been defined to simulate stochastically if desired:

[11]:
deg_mdl = DriveDegradation()
endresults, mdlhist = prop.nominal(deg_mdl, run_stochastic=True)
fig, ax = mdlhist.plot_line('s.wear', 's.corrosion', 's.friction', 's.drift', 'r.s.corrode_rate', 'r.s.wear_rate', 'r.s.yaw_load')
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_15_0.png

To get averages/percentages over a number of scenarios, we can view these behaviors over a given number of random seeds:

[12]:
from fmdtools.sim.sample import ParameterSample
ps = ParameterSample()
ps.add_variable_replicates([], replicates=100, seed_comb='independent')
endclasses_deg, mdlhists_deg = prop.parameter_sample(deg_mdl, ps, run_stochastic=True)
SCENARIOS COMPLETE: 100%|██████████| 100/100 [00:01<00:00, 74.02it/s]
[13]:
fig, ax = mdlhists_deg.plot_line('s.wear', 's.corrosion', 's.friction', 's.drift',
                                 'r.s.corrode_rate', 'r.s.wear_rate', 'r.s.yaw_load',
                                 title="", xlabel='lifecycle time (months)', aggregation = 'mean_bound')
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_18_0.png
[14]:
fig.savefig("drive_degradations.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

As shown, while wear and friction proceed monotonically, drift can go one way or another, meaning that whether the rover drifts left or right is basically up to chance. We can further look at slices of these distributions:

[15]:
fig, axs = mdlhists_deg.plot_metric_dist([1, 10, 20, 25], 's.wear', 's.corrosion', 's.friction', 's.drift', bins=10, alpha=0.5)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_21_0.png
[16]:
from IPython.display import HTML
ani = mdlhists_deg.animate('plot_metric_dist_from',
                           plot_values=( 's.wear', 's.corrosion', 's.friction', 's.drift'),
                                        bins=10, alpha=0.5)
HTML(ani.to_jshtml())
[16]:
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_22_1.png

Given the parameter information (friction and drift) that the degradation model produced, we can now simulate the model with this information over time in the nominal scenarios.

[17]:
from fmdtools.sim.sample import ParameterDomain, ParameterHistSample
from examples.rover.rover_model import RoverParam

We can do this using a ParameterHistSample to sample the histories of the various scenarios at different times.

First, by defining a ParameterDomain:

[18]:
rpd = ParameterDomain(RoverParam)
rpd.add_variables('degradation.friction', 'degradation.drift')
rpd.add_constant('drive_modes', {"mode_options": "manual"})
rpd(1, 10).degradation
[18]:
DegParam(friction=1.0, drift=10.0)

And then by defining the class:

[19]:
phs = ParameterHistSample(mdlhists_deg, 's.friction', 's.drift', paramdomain=rpd)
phs._get_repname('default', 1)
phs.add_hist_groups(reps= 10, ts = [1, 2, 5, 10])
len(phs.scenarios())
[19]:
40

Simulating the nominal scenario for these parameters:

[20]:
mdl=Rover(p={'drive_modes': {'mode_options': "manual"}})
behave_endclasses, behave_mdlhists = prop.parameter_sample(fault_mdl, phs)
SCENARIOS COMPLETE: 100%|██████████| 40/40 [00:08<00:00,  4.46it/s]
[21]:
mdl.fxns['drive'].m.faultmodes
[21]:
{'elec_open': Fault(prob=1.0, cost=0.0, phases=(('drive', 1.0), ('start', 1.0)), disturbances=(('s.transfer', 0.0),), units='sim'),
 'stuck': Fault(prob=1.0, cost=0.0, phases=(('drive', 1.0), ('start', 1.0)), disturbances=(('s.friction', 10.0),), units='sim'),
 'stuck_right': Fault(prob=1.0, cost=0.0, phases=(('drive', 1.0), ('start', 1.0)), disturbances=(('s.friction', 3.0), ('s.drift', 0.2)), units='sim'),
 'stuck_left': Fault(prob=1.0, cost=0.0, phases=(('drive', 1.0), ('start', 1.0)), disturbances=(('s.friction', 3.0), ('s.drift', -0.2)), units='sim')}
[22]:
fig, ax = plot_map(fault_mdl, behave_mdlhists)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_32_0.png
[23]:
behave_endclasses.state_probabilities('prob')
[23]:
{'nominal mission': 12.0, 'incomplete mission': 28.0}
[24]:
from fmdtools.analyze.tabulate import NominalEnvelope
[25]:
ne = NominalEnvelope(phs, behave_endclasses, 'classification',
                     'p.degradation.friction', 'p.degradation.drift',
                     func = lambda x: x == 'nominal mission')
ne.plot_scatter()
[25]:
(<Figure size 600x400 with 1 Axes>,
 <Axes: xlabel='p.degradation.friction', ylabel='p.degradation.drift'>)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_35_1.png
[26]:
ne = NominalEnvelope(phs, behave_endclasses, 'classification',
                     'inputparams.t', 'inputparams.rep',
                     func = lambda x: x == 'nominal mission')
ne.plot_scatter()
[26]:
(<Figure size 600x400 with 1 Axes>,
 <Axes: xlabel='inputparams.t', ylabel='inputparams.rep'>)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_36_1.png
[27]:
fig.savefig("drive_deg_envelope.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

As shown, as the time (and thus degradation) increases, the rover becomes more likely to be unable to complete the mission. In this case, it results in the rover not completing the mission in time.

[28]:
from fmdtools.sim.sample import SampleApproach
sa = SampleApproach(mdl)
sa.add_faultdomain('drive_faults', 'all_fxnclass_modes', 'Drive')
sa.add_faultsample('drive_faults', 'fault_phases', 'drive_faults',"start")
# sa.scenarios()
[29]:
sa.scenarios()
[29]:
[SingleFaultScenario(sequence={15.0: Injection(faults={'drive': ['elec_open']}, disturbances={})}, times=(15.0,), function='drive', fault='elec_open', rate=1.0, name='drive_elec_open_t15p0', time=15.0, phase='start'),
 SingleFaultScenario(sequence={15.0: Injection(faults={'drive': ['stuck']}, disturbances={})}, times=(15.0,), function='drive', fault='stuck', rate=1.0, name='drive_stuck_t15p0', time=15.0, phase='start'),
 SingleFaultScenario(sequence={15.0: Injection(faults={'drive': ['stuck_right']}, disturbances={})}, times=(15.0,), function='drive', fault='stuck_right', rate=1.0, name='drive_stuck_right_t15p0', time=15.0, phase='start'),
 SingleFaultScenario(sequence={15.0: Injection(faults={'drive': ['stuck_left']}, disturbances={})}, times=(15.0,), function='drive', fault='stuck_left', rate=1.0, name='drive_stuck_left_t15p0', time=15.0, phase='start')]
[30]:
sa.mdl.fxns['drive'].m.get_fault_disturbances("elec_open")
[30]:
{'s.transfer': 0.0}
[31]:
ec_nest, hist_nest, app_nest = prop.nested_sample(mdl, phs, faultdomains={'drive_faults':  (('all_fxnclass_modes', 'Drive'), {})},
                                                  faultsamples={'drive_faults': (('fault_phases', 'drive_faults', "start"), {})},
                                                  pool=mp.Pool(5))

NESTED SCENARIOS COMPLETE: 100%|██████████| 40/40 [00:19<00:00,  2.01it/s]

Finally, we can also visualize simulate and then view the effect of the degradation on average resilience…

[32]:
from fmdtools.analyze.tabulate import NestedComparison
nc = NestedComparison(ec_nest, phs, ['inputparams.t'], app_nest, ['fault'], metrics=['tot_deviation', 'end_dist'], default_stat=np.mean, ci_metrics=['end_dist', 'tot_deviation'])
[33]:
nc
[33]:
{'tot_deviation': {(1, 'stuck_right'): 0.2122008447070285, (1, 'stuck'): 0.17741358098055582, (1, 'stuck_left'): 0.22585859248347112, (1, 'elec_open'): 0.17741358098055582, (2, 'stuck_right'): 0.2154062932318482, (2, 'stuck'): 0.21244297315280317, (2, 'stuck_left'): 0.21799419044902096, (2, 'elec_open'): 0.21244297315280317, (10, 'stuck_right'): 0.239650488703671, (10, 'stuck'): 0.239650488703671, (10, 'stuck_left'): 0.239650488703671, (10, 'elec_open'): 0.239650488703671, (5, 'stuck_right'): 0.22662710510353062, (5, 'stuck'): 0.22662710510353062, (5, 'stuck_left'): 0.22662710510353062, (5, 'elec_open'): 0.22662710510353062}, 'end_dist': {(1, 'stuck_right'): 26.149794135632316, (1, 'stuck'): 26.7615436033567, (1, 'stuck_left'): 26.12964183389251, (1, 'elec_open'): 26.810953321711242, (2, 'stuck_right'): 27.14069806457217, (2, 'stuck'): 27.530138594718, (2, 'stuck_left'): 27.427612431838053, (2, 'elec_open'): 27.540601134348616, (10, 'stuck_right'): 28.44145758903839, (10, 'stuck'): 28.44145758903839, (10, 'stuck_left'): 28.44145758903839, (10, 'elec_open'): 28.44145758903839, (5, 'stuck_right'): 28.07252010847223, (5, 'stuck'): 28.07252010847223, (5, 'stuck_left'): 28.07252010847223, (5, 'elec_open'): 28.07252010847223}, 'end_dist_lb': {(1, 'stuck_right'): 24.806792332640534, (1, 'stuck'): 26.21243310256646, (1, 'stuck_left'): 25.2085956507613, (1, 'elec_open'): 26.28915085806621, (2, 'stuck_right'): 25.163491272261655, (2, 'stuck'): 26.93591879390105, (2, 'stuck_left'): 26.54926575282524, (2, 'elec_open'): 26.956896116421504, (10, 'stuck_right'): 28.35437228863548, (10, 'stuck'): 28.356400879363925, (10, 'stuck_left'): 28.35511456234135, (10, 'elec_open'): 28.352595345837702, (5, 'stuck_right'): 27.485676556127757, (5, 'stuck'): 27.50040864501531, (5, 'stuck_left'): 27.4848030612941, (5, 'elec_open'): 27.507634814538296}, 'tot_deviation_lb': {(1, 'stuck_right'): 0.20800406295938587, (1, 'stuck'): 0.14873327868502723, (1, 'stuck_left'): 0.21561794129228773, (1, 'elec_open'): 0.1496744721902481, (2, 'stuck_right'): 0.21001138544999473, (2, 'stuck'): 0.2043504388180765, (2, 'stuck_left'): 0.21143929562145514, (2, 'elec_open'): 0.20416704651362036, (10, 'stuck_right'): 0.2295598553435188, (10, 'stuck'): 0.2293091159149224, (10, 'stuck_left'): 0.2294234604140766, (10, 'elec_open'): 0.22939823505662363, (5, 'stuck_right'): 0.21907063748993963, (5, 'stuck'): 0.21923755291167102, (5, 'stuck_left'): 0.21924198277310622, (5, 'elec_open'): 0.21902754664255789}, 'end_dist_ub': {(1, 'stuck_right'): 27.11959159913305, (1, 'stuck'): 27.528641207359307, (1, 'stuck_left'): 27.186727968555807, (1, 'elec_open'): 27.57133133958842, (2, 'stuck_right'): 27.91637312439142, (2, 'stuck'): 28.070834721761443, (2, 'stuck_left'): 27.99845997445673, (2, 'elec_open'): 28.068573624548176, (10, 'stuck_right'): 28.521231623216337, (10, 'stuck'): 28.52146724738778, (10, 'stuck_left'): 28.52133133096186, (10, 'elec_open'): 28.520263472169535, (5, 'stuck_right'): 28.35628657861365, (5, 'stuck'): 28.360964970024472, (5, 'stuck_left'): 28.362315523761833, (5, 'elec_open'): 28.35676475760873}, 'tot_deviation_ub': {(1, 'stuck_right'): 0.2169285376018674, (1, 'stuck'): 0.1993955402040386, (1, 'stuck_left'): 0.2371400363110748, (1, 'elec_open'): 0.19960393406503726, (2, 'stuck_right'): 0.220495675308664, (2, 'stuck'): 0.21892259395060673, (2, 'stuck_left'): 0.22712173845503855, (2, 'elec_open'): 0.21875412644139342, (10, 'stuck_right'): 0.2540501684563075, (10, 'stuck'): 0.2539151740776304, (10, 'stuck_left'): 0.2535322488756938, (10, 'elec_open'): 0.25388084424359814, (5, 'stuck_right'): 0.23595229900189352, (5, 'stuck'): 0.23608687947760418, (5, 'stuck_left'): 0.23621468614968316, (5, 'elec_open'): 0.23612235175942192}}
[34]:
nc.sort_by_factor("fault")
nc.sort_by_factor("inputparams.t")
fig, ax = nc.as_plots('end_dist', 'tot_deviation', figsize=(8,4))
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_46_0.png
[35]:
nc
[35]:
{'tot_deviation': {(1, 'elec_open'): 0.17741358098055582, (1, 'stuck'): 0.17741358098055582, (1, 'stuck_left'): 0.22585859248347112, (1, 'stuck_right'): 0.2122008447070285, (2, 'elec_open'): 0.21244297315280317, (2, 'stuck'): 0.21244297315280317, (2, 'stuck_left'): 0.21799419044902096, (2, 'stuck_right'): 0.2154062932318482, (5, 'elec_open'): 0.22662710510353062, (5, 'stuck'): 0.22662710510353062, (5, 'stuck_left'): 0.22662710510353062, (5, 'stuck_right'): 0.22662710510353062, (10, 'elec_open'): 0.239650488703671, (10, 'stuck'): 0.239650488703671, (10, 'stuck_left'): 0.239650488703671, (10, 'stuck_right'): 0.239650488703671}, 'end_dist': {(1, 'elec_open'): 26.810953321711242, (1, 'stuck'): 26.7615436033567, (1, 'stuck_left'): 26.12964183389251, (1, 'stuck_right'): 26.149794135632316, (2, 'elec_open'): 27.540601134348616, (2, 'stuck'): 27.530138594718, (2, 'stuck_left'): 27.427612431838053, (2, 'stuck_right'): 27.14069806457217, (5, 'elec_open'): 28.07252010847223, (5, 'stuck'): 28.07252010847223, (5, 'stuck_left'): 28.07252010847223, (5, 'stuck_right'): 28.07252010847223, (10, 'elec_open'): 28.44145758903839, (10, 'stuck'): 28.44145758903839, (10, 'stuck_left'): 28.44145758903839, (10, 'stuck_right'): 28.44145758903839}, 'end_dist_lb': {(1, 'elec_open'): 26.28915085806621, (1, 'stuck'): 26.21243310256646, (1, 'stuck_left'): 25.2085956507613, (1, 'stuck_right'): 24.806792332640534, (2, 'elec_open'): 26.956896116421504, (2, 'stuck'): 26.93591879390105, (2, 'stuck_left'): 26.54926575282524, (2, 'stuck_right'): 25.163491272261655, (5, 'elec_open'): 27.507634814538296, (5, 'stuck'): 27.50040864501531, (5, 'stuck_left'): 27.4848030612941, (5, 'stuck_right'): 27.485676556127757, (10, 'elec_open'): 28.352595345837702, (10, 'stuck'): 28.356400879363925, (10, 'stuck_left'): 28.35511456234135, (10, 'stuck_right'): 28.35437228863548}, 'tot_deviation_lb': {(1, 'elec_open'): 0.1496744721902481, (1, 'stuck'): 0.14873327868502723, (1, 'stuck_left'): 0.21561794129228773, (1, 'stuck_right'): 0.20800406295938587, (2, 'elec_open'): 0.20416704651362036, (2, 'stuck'): 0.2043504388180765, (2, 'stuck_left'): 0.21143929562145514, (2, 'stuck_right'): 0.21001138544999473, (5, 'elec_open'): 0.21902754664255789, (5, 'stuck'): 0.21923755291167102, (5, 'stuck_left'): 0.21924198277310622, (5, 'stuck_right'): 0.21907063748993963, (10, 'elec_open'): 0.22939823505662363, (10, 'stuck'): 0.2293091159149224, (10, 'stuck_left'): 0.2294234604140766, (10, 'stuck_right'): 0.2295598553435188}, 'end_dist_ub': {(1, 'elec_open'): 27.57133133958842, (1, 'stuck'): 27.528641207359307, (1, 'stuck_left'): 27.186727968555807, (1, 'stuck_right'): 27.11959159913305, (2, 'elec_open'): 28.068573624548176, (2, 'stuck'): 28.070834721761443, (2, 'stuck_left'): 27.99845997445673, (2, 'stuck_right'): 27.91637312439142, (5, 'elec_open'): 28.35676475760873, (5, 'stuck'): 28.360964970024472, (5, 'stuck_left'): 28.362315523761833, (5, 'stuck_right'): 28.35628657861365, (10, 'elec_open'): 28.520263472169535, (10, 'stuck'): 28.52146724738778, (10, 'stuck_left'): 28.52133133096186, (10, 'stuck_right'): 28.521231623216337}, 'tot_deviation_ub': {(1, 'elec_open'): 0.19960393406503726, (1, 'stuck'): 0.1993955402040386, (1, 'stuck_left'): 0.2371400363110748, (1, 'stuck_right'): 0.2169285376018674, (2, 'elec_open'): 0.21875412644139342, (2, 'stuck'): 0.21892259395060673, (2, 'stuck_left'): 0.22712173845503855, (2, 'stuck_right'): 0.220495675308664, (5, 'elec_open'): 0.23612235175942192, (5, 'stuck'): 0.23608687947760418, (5, 'stuck_left'): 0.23621468614968316, (5, 'stuck_right'): 0.23595229900189352, (10, 'elec_open'): 0.25388084424359814, (10, 'stuck'): 0.2539151740776304, (10, 'stuck_left'): 0.2535322488756938, (10, 'stuck_right'): 0.2540501684563075}}
[36]:
# fig.savefig("drive_resilience_degradation.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

As shown, while there is some resilience early in the lifecycle (resulting in a small proportion of faults being recovered), this resilience goes away with degradation.

Human Degradation

We can also perform this assessment for the human error model, which is split up into two parts:

  • long term “degradation” of experience over months

  • short term “degradation” of stress and fatigue over a day

[37]:
psf_long = PSFDegradationLong()
endresults,  hist_psf_long = prop.nominal(psf_long)
[38]:
hist_psf_long.plot_line('s.experience')
[38]:
(<Figure size 300x200 with 1 Axes>,
 [<Axes: title={'center': 's.experience'}, xlabel='time'>])
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_53_1.png
[39]:
hist_psf_long.plot_line('s.experience')
[39]:
(<Figure size 300x200 with 1 Axes>,
 [<Axes: title={'center': 's.experience'}, xlabel='time'>])
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_54_1.png
[40]:
from examples.rover.rover_degradation import LongParams
pd_hl = ParameterDomain(LongParams)
pd_hl.add_variable("experience_param", var_lim=())
pd_hl
[40]:
ParameterDomain with:
 - variables: {'experience_param': ()}
 - constants: {}
 - parameter_initializer: LongParams
[41]:
pd_hl(10)
[41]:
LongParams(experience_param=10.0, training_frequency=8.0, experience_scale_max=10.0)
[42]:
ps_hl = ParameterSample(pd_hl)
xs = np.random.default_rng(seed=101).gamma(1,1.9,101)
# round so that dist is 0-10
xs = [min(x, 9.9) for x in xs]
weight = 1/len(xs)
for x in xs:
    ps_hl.add_variable_scenario(x, weight=weight)
ps_hl
[42]:
ParameterSample of scenarios:
 - var_0
 - var_1
 - var_2
 - var_3
 - var_4
 - var_5
 - var_6
 - var_7
 - var_8
 - var_9
 - ... (101 total)
[43]:
ec_psf_long, hist_psf_long= prop.parameter_sample(psf_long, ps_hl, run_stochastic=True)
SCENARIOS COMPLETE: 100%|██████████| 101/101 [00:00<00:00, 152.56it/s]
[44]:
hist_psf_long.plot_line('s.experience')
[44]:
(<Figure size 300x200 with 1 Axes>,
 [<Axes: title={'center': 's.experience'}, xlabel='time'>])
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_59_1.png
[45]:
fig, axs = hist_psf_long.plot_metric_dist([0, 40, 50, 60, 100], 's.experience', bins=20, alpha=0.5, figsize=(8,4))
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_60_0.png
[46]:
# fig.savefig("experience_degradation.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

Short-term degradation

[47]:
psf_short = PSFDegradationShort()
er, hist_short = prop.nominal(psf_short)
fig, axs = hist_short.plot_line('s.fatigue', 's.stress')
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_63_0.png

short-term degradation (over no external params)

[48]:
ps_psf_short = ParameterSample()
ps_psf_short.add_variable_replicates([], replicates=25)
ps_psf_short.scenarios()
[48]:
[ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3260115135}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep0_var_0'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 1527593760}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep1_var_1'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3553332276}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep2_var_2'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 416346916}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep3_var_3'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 275661808}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep4_var_4'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 890341436}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep5_var_5'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 385631715}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep6_var_6'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3098464938}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep7_var_7'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2778547411}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep8_var_8'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2432285396}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep9_var_9'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 852786859}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep10_var_10'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 371586865}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep11_var_11'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2409107686}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep12_var_12'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 1790397850}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep13_var_13'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3008926919}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep14_var_14'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2611997323}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep15_var_15'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2535376944}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep16_var_16'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 4119765411}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep17_var_17'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 1860726807}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep18_var_18'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3810481707}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep19_var_19'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 1844188210}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep20_var_20'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 2143319789}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep21_var_21'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 535481333}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep22_var_22'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 1032032967}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep23_var_23'),
 ParameterScenario(sequence={}, times=(), p={}, r={'seed': 3764718571}, sp={}, prob=0.04, inputparams={}, rangeid='', name='rep24_var_24')]
[49]:
ec_psf_short, hist_psf_short = prop.parameter_sample(psf_short, ps_psf_short, run_stochastic=True)
fig, axs = hist_psf_short.plot_line('s.fatigue', 's.stress', 'r.s.fatigue_param', aggregation="percentile")
SCENARIOS COMPLETE: 100%|██████████| 25/25 [00:00<00:00, 423.61it/s]
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_66_1.png

short-term degradation over long-term params

[50]:
from examples.rover.rover_degradation import PSFShortParams
pd_short_long = ParameterDomain(PSFShortParams)
pd_short_long.add_variable("experience")
ps_short_long = ParameterHistSample(hist_psf_long, 's.experience', paramdomain=pd_short_long)
ps_short_long.add_hist_groups(reps= 10, ts = [0, 40, 50, 60, 100])

# note - need to add a way to combine replicates (seeds) over replicates (input times/groups/)
[51]:
pd_short_long(10)
[51]:
PSFShortParams(experience=10.0, stress_param=0.0, fatigue_param=1.0)
[52]:
ps_short_long.scenarios()
[52]:
[ParameterScenario(sequence={}, times=(), p={'experience': 0.0147852093576427}, r={'seed': 2967806006}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_0', 't': 0}, rangeid='', name='hist_0'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.355521540650882}, r={'seed': 2967806006}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_0', 't': 40}, rangeid='', name='hist_1'),
 ParameterScenario(sequence={}, times=(), p={'experience': 7.926159730949486}, r={'seed': 2967806006}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_0', 't': 50}, rangeid='', name='hist_2'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.498252713597697}, r={'seed': 2967806006}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_0', 't': 60}, rangeid='', name='hist_3'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.999122355752638}, r={'seed': 2967806006}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_0', 't': 100}, rangeid='', name='hist_4'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.003707397123126116}, r={'seed': 1138931898}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_1', 't': 0}, rangeid='', name='hist_5'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.6197044104299785}, r={'seed': 1138931898}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_1', 't': 40}, rangeid='', name='hist_6'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.890918517769909}, r={'seed': 1138931898}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_1', 't': 50}, rangeid='', name='hist_7'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.258304854924205}, r={'seed': 1138931898}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_1', 't': 60}, rangeid='', name='hist_8'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996496965739947}, r={'seed': 1138931898}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_1', 't': 100}, rangeid='', name='hist_9'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.0040328347821078905}, r={'seed': 3168452858}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_2', 't': 0}, rangeid='', name='hist_10'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.7372307652324728}, r={'seed': 3168452858}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_2', 't': 40}, rangeid='', name='hist_11'),
 ParameterScenario(sequence={}, times=(), p={'experience': 5.1013174827709795}, r={'seed': 3168452858}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_2', 't': 50}, rangeid='', name='hist_12'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.376073873906922}, r={'seed': 3168452858}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_2', 't': 60}, rangeid='', name='hist_13'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996779663860996}, r={'seed': 3168452858}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_2', 't': 100}, rangeid='', name='hist_14'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.004105645810848513}, r={'seed': 711731257}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_3', 't': 0}, rangeid='', name='hist_15'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.7630764252943243}, r={'seed': 711731257}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_3', 't': 40}, rangeid='', name='hist_16'),
 ParameterScenario(sequence={}, times=(), p={'experience': 5.1460417740129625}, r={'seed': 711731257}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_3', 't': 50}, rangeid='', name='hist_17'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.40027584188355}, r={'seed': 711731257}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_3', 't': 60}, rangeid='', name='hist_18'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996836779451714}, r={'seed': 711731257}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_3', 't': 100}, rangeid='', name='hist_19'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.0037569908838189204}, r={'seed': 3428388650}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_4', 't': 0}, rangeid='', name='hist_20'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.6378293230060559}, r={'seed': 3428388650}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_4', 't': 40}, rangeid='', name='hist_21'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.924140166096661}, r={'seed': 3428388650}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_4', 't': 50}, rangeid='', name='hist_22'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.277342402550868}, r={'seed': 3428388650}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_4', 't': 60}, rangeid='', name='hist_23'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996543208332358}, r={'seed': 3428388650}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_4', 't': 100}, rangeid='', name='hist_24'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.0035576861892378416}, r={'seed': 142725353}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_5', 't': 0}, rangeid='', name='hist_25'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.5645112885019485}, r={'seed': 142725353}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_5', 't': 40}, rangeid='', name='hist_26'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.7879419002260555}, r={'seed': 142725353}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_5', 't': 50}, rangeid='', name='hist_27'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.198196150411718}, r={'seed': 142725353}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_5', 't': 60}, rangeid='', name='hist_28'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996349553773157}, r={'seed': 142725353}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_5', 't': 100}, rangeid='', name='hist_29'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.006841983111062025}, r={'seed': 3312068378}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_6', 't': 0}, rangeid='', name='hist_30'),
 ParameterScenario(sequence={}, times=(), p={'experience': 2.629719998704038}, r={'seed': 3312068378}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_6', 't': 40}, rangeid='', name='hist_31'),
 ParameterScenario(sequence={}, times=(), p={'experience': 6.386297198063246}, r={'seed': 3312068378}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_6', 't': 50}, rangeid='', name='hist_32'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.974697629346908}, r={'seed': 3312068378}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_6', 't': 60}, rangeid='', name='hist_33'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.99810213629282}, r={'seed': 3312068378}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_6', 't': 100}, rangeid='', name='hist_34'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.003743727872745982}, r={'seed': 223795235}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_7', 't': 0}, rangeid='', name='hist_35'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.632989788946346}, r={'seed': 223795235}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_7', 't': 40}, rangeid='', name='hist_36'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.915297962215212}, r={'seed': 223795235}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_7', 't': 50}, rangeid='', name='hist_37'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.272292001415185}, r={'seed': 223795235}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_7', 't': 60}, rangeid='', name='hist_38'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996530961505558}, r={'seed': 223795235}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_7', 't': 100}, rangeid='', name='hist_39'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.014556312791561945}, r={'seed': 2928550493}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_8', 't': 0}, rangeid='', name='hist_40'),
 ParameterScenario(sequence={}, times=(), p={'experience': 4.317146303403044}, r={'seed': 2928550493}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_8', 't': 40}, rangeid='', name='hist_41'),
 ParameterScenario(sequence={}, times=(), p={'experience': 7.900357779757452}, r={'seed': 2928550493}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_8', 't': 50}, rangeid='', name='hist_42'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.490753491558548}, r={'seed': 2928550493}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_8', 't': 60}, rangeid='', name='hist_43'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.99910853568146}, r={'seed': 2928550493}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_8', 't': 100}, rangeid='', name='hist_44'),
 ParameterScenario(sequence={}, times=(), p={'experience': 0.003917700316414757}, r={'seed': 2494678793}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_9', 't': 0}, rangeid='', name='hist_45'),
 ParameterScenario(sequence={}, times=(), p={'experience': 1.6960297046671722}, r={'seed': 2494678793}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_9', 't': 40}, rangeid='', name='hist_46'),
 ParameterScenario(sequence={}, times=(), p={'experience': 5.028890434716651}, r={'seed': 2494678793}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_9', 't': 50}, rangeid='', name='hist_47'),
 ParameterScenario(sequence={}, times=(), p={'experience': 8.336273464537053}, r={'seed': 2494678793}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_9', 't': 60}, rangeid='', name='hist_48'),
 ParameterScenario(sequence={}, times=(), p={'experience': 9.996685016931059}, r={'seed': 2494678793}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'var_9', 't': 100}, rangeid='', name='hist_49')]
[53]:
ec, hist_short_long = prop.parameter_sample(psf_short, ps_short_long, run_stochastic=True)
SCENARIOS COMPLETE: 100%|██████████| 50/50 [00:00<00:00, 434.73it/s]
[54]:
fig, axs = hist_short_long.plot_line('s.fatigue', 's.stress', 'r.s.fatigue_param', aggregation="percentile")
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_72_0.png
[55]:
# fig.savefig("stress_degradation.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

Now sample in the model:

[56]:
from examples.rover.rover_model_human import RoverHuman, RoverHumanParam
pd_comb_mdl = ParameterDomain(RoverHumanParam)
# pd_comb_mdl.add_constant('drive_modes', {"mode_options": "manual"})
pd_comb_mdl.add_variable("psfs.fatigue")
pd_comb_mdl.add_variables("psfs.stress")
rpd.add_constant('drive_modes', {"mode_options": "manual"})
pd_comb_mdl(1,1)
[56]:
RoverHumanParam(ground=GroundParam(linetype='sine', amp=1.0, period=6.283185307179586, radius=20.0, x_start=10.0, y_end=10.0, x_min=0.0, x_max=30.0, x_res=0.1, path_buffer_on=0.2, path_buffer_poor=0.3, path_buffer_near=0.4, dest_buffer_on=1.0, dest_buffer_near=2.0), correction=ResCorrection(ub_f=10.0, lb_f=-1.0, ub_t=10.0, lb_t=0.0, ub_d=2.0, lb_d=-2.0, cor_d=0.0, cor_t=0.0, cor_f=0.0), degradation=DegParam(friction=0.0, drift=0.0), drive_modes={'mode_options': 'set'}, psfs=PSFParam(fatigue=1.0, stress=1.0))
[57]:
ps_comb_mdl = ParameterHistSample(hist_short_long, "s.fatigue", "s.stress", paramdomain=pd_comb_mdl)
ps_comb_mdl.add_hist_groups(reps= 10, ts = [0, 1, 3, 5, 6, 8])
ps_comb_mdl.scenarios()
[57]:
[ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 1.0187601080280608, 'stress': 0.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 0}, rangeid='', name='hist_0'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 3.9464313330923826, 'stress': 1.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 1}, rangeid='', name='hist_1'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 7.883961251275318, 'stress': 100.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 3}, rangeid='', name='hist_2'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 5}, rangeid='', name='hist_3'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 6}, rangeid='', name='hist_4'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 3566986185}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_0', 't': 8}, rangeid='', name='hist_5'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 1.0187601080280608, 'stress': 0.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 0}, rangeid='', name='hist_6'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 3.9464313330923826, 'stress': 1.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 1}, rangeid='', name='hist_7'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 7.883961251275318, 'stress': 3.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 3}, rangeid='', name='hist_8'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 5}, rangeid='', name='hist_9'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 8.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 6}, rangeid='', name='hist_10'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 15.0}}, r={'seed': 4275468961}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_1', 't': 8}, rangeid='', name='hist_11'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 1.0187601080280608, 'stress': 0.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 0}, rangeid='', name='hist_12'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 3.9464313330923826, 'stress': 1.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 1}, rangeid='', name='hist_13'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 7.883961251275318, 'stress': 3.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 3}, rangeid='', name='hist_14'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 5.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 5}, rangeid='', name='hist_15'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 6}, rangeid='', name='hist_16'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 10.0}}, r={'seed': 1325132478}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_2', 't': 8}, rangeid='', name='hist_17'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 1.0187601080280608, 'stress': 0.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 0}, rangeid='', name='hist_18'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 3.9464313330923826, 'stress': 1.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 1}, rangeid='', name='hist_19'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 7.883961251275318, 'stress': 3.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 3}, rangeid='', name='hist_20'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 5.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 5}, rangeid='', name='hist_21'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 6}, rangeid='', name='hist_22'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 9.0}}, r={'seed': 2323213004}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_3', 't': 8}, rangeid='', name='hist_23'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 1.0187601080280608, 'stress': 0.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 0}, rangeid='', name='hist_24'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 3.9464313330923826, 'stress': 1.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 1}, rangeid='', name='hist_25'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 7.883961251275318, 'stress': 3.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 3}, rangeid='', name='hist_26'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 5.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 5}, rangeid='', name='hist_27'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 6}, rangeid='', name='hist_28'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 8.0}}, r={'seed': 3437754821}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_4', 't': 8}, rangeid='', name='hist_29'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 0.5074430948724504, 'stress': 0.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 0}, rangeid='', name='hist_30'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 2.919646783967142, 'stress': 1.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 1}, rangeid='', name='hist_31'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 5.762986161529959, 'stress': 100.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 3}, rangeid='', name='hist_32'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 5}, rangeid='', name='hist_33'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 6}, rangeid='', name='hist_34'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 100.0}}, r={'seed': 2236262237}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_5', 't': 8}, rangeid='', name='hist_35'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 0.5074430948724504, 'stress': 0.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 0}, rangeid='', name='hist_36'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 2.919646783967142, 'stress': 1.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 1}, rangeid='', name='hist_37'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 5.762986161529959, 'stress': 4.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 3}, rangeid='', name='hist_38'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 14.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 5}, rangeid='', name='hist_39'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 25.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 6}, rangeid='', name='hist_40'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 70.0}}, r={'seed': 2279745543}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_6', 't': 8}, rangeid='', name='hist_41'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 0.5074430948724504, 'stress': 0.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 0}, rangeid='', name='hist_42'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 2.919646783967142, 'stress': 1.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 1}, rangeid='', name='hist_43'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 5.762986161529959, 'stress': 3.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 3}, rangeid='', name='hist_44'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 5}, rangeid='', name='hist_45'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 8.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 6}, rangeid='', name='hist_46'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 14.0}}, r={'seed': 1706294374}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_7', 't': 8}, rangeid='', name='hist_47'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 0.5074430948724504, 'stress': 0.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 0}, rangeid='', name='hist_48'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 2.919646783967142, 'stress': 1.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 1}, rangeid='', name='hist_49'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 5.762986161529959, 'stress': 3.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 3}, rangeid='', name='hist_50'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 5.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 5}, rangeid='', name='hist_51'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 6}, rangeid='', name='hist_52'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 9.0}}, r={'seed': 1399866498}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_8', 't': 8}, rangeid='', name='hist_53'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 0.5074430948724504, 'stress': 0.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 0}, rangeid='', name='hist_54'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 2.919646783967142, 'stress': 1.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 1}, rangeid='', name='hist_55'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 5.762986161529959, 'stress': 3.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 3}, rangeid='', name='hist_56'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 5.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 5}, rangeid='', name='hist_57'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 6.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 6}, rangeid='', name='hist_58'),
 ParameterScenario(sequence={}, times=(), p={'psfs': {'fatigue': 10.0, 'stress': 8.0}}, r={'seed': 3823745630}, sp={}, prob=1.0, inputparams={'comp_group': 'default', 'rep': 'hist_9', 't': 8}, rangeid='', name='hist_59')]
[58]:
mdl_hum = RoverHuman()
[59]:
ec, hist = prop.nominal(mdl_hum)
plot_map(mdl_hum, hist)
ec
[59]:
endclass:
--rate:                              1.0
--cost:                                0
--prob:                              1.0
--expected_cost:                       0
--in_bound:                         True
--at_finish:                        True
--line_dist:                           1
--num_modes:                           0
--end_dist:                          0.0
--tot_deviation:     0.11859644458085598
--faults:                       array(0)
--classification:        nominal mission
--end_x:              29.254775331608617
--end_y:             -0.7827640334587979
--endpt:                        array(2)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_78_1.png
[60]:
ec_comb, hist_comb = prop.parameter_sample(mdl_hum, ps_comb_mdl)
SCENARIOS COMPLETE: 100%|██████████| 60/60 [00:27<00:00,  2.19it/s]
[61]:
fig, ax = plot_map(mdl_hum, hist_comb)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_80_0.png
[62]:
hist_comb.plot_line('flows.psfs.s.attention', 'flows.motor_control.s.rpower', 'flows.motor_control.s.lpower')
[62]:
(<Figure size 600x400 with 4 Axes>,
 array([<Axes: title={'center': 'flows.psfs.s.attention'}, xlabel=' '>,
        <Axes: title={'center': 'flows.motor_control.s.rpower'}, xlabel='time'>,
        <Axes: title={'center': 'flows.motor_control.s.lpower'}, xlabel='time'>,
        <Axes: >], dtype=object))
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_81_1.png
[63]:
ne = NominalEnvelope(ps_comb_mdl, ec_comb, 'at_finish',
                     'p.psfs.fatigue', 'p.psfs.stress',
                     func=lambda x: x == True)
ne.plot_scatter()
[63]:
(<Figure size 600x400 with 1 Axes>,
 <Axes: xlabel='p.psfs.fatigue', ylabel='p.psfs.stress'>)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_82_1.png

(note, this is different in the turn case because of the long straightaway)

[64]:
mdl_hum = RoverHuman(p={'ground': {'linetype': 'turn'}})
ec, hist = prop.nominal(mdl_hum)
plot_map(mdl_hum, hist)
ec
[64]:
endclass:
--rate:                              1.0
--cost:                                0
--prob:                              1.0
--expected_cost:                       0
--in_bound:                         True
--at_finish:                        True
--line_dist:                           1
--num_modes:                           0
--end_dist:                          0.0
--tot_deviation:    0.005246344989065292
--faults:                       array(0)
--classification:        nominal mission
--end_x:              29.813614084369863
--end_y:               17.26588133276667
--endpt:                        array(2)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_84_1.png
[65]:
ec_comb, hist_comb = prop.parameter_sample(mdl_hum, ps_comb_mdl)
SCENARIOS COMPLETE: 100%|██████████| 60/60 [00:27<00:00,  2.18it/s]
[66]:
fig, ax = plot_map(mdl_hum, hist_comb)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_86_0.png
[67]:
hist_comb.plot_line('flows.psfs.s.attention', 'flows.motor_control.s.rpower', 'flows.motor_control.s.lpower')
[67]:
(<Figure size 600x400 with 4 Axes>,
 array([<Axes: title={'center': 'flows.psfs.s.attention'}, xlabel=' '>,
        <Axes: title={'center': 'flows.motor_control.s.rpower'}, xlabel='time'>,
        <Axes: title={'center': 'flows.motor_control.s.lpower'}, xlabel='time'>,
        <Axes: >], dtype=object))
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_87_1.png
[68]:
ne = NominalEnvelope(ps_comb_mdl, ec_comb, 'at_finish',
                     'p.psfs.fatigue', 'p.psfs.stress',
                     func=lambda x: x == True)
ne.plot_scatter()
[68]:
(<Figure size 600x400 with 1 Axes>,
 <Axes: xlabel='p.psfs.fatigue', ylabel='p.psfs.stress'>)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_88_1.png

We can thus see how degradation time effects this:

[69]:
ne = NominalEnvelope(ps_comb_mdl, ec_comb, 'at_finish',
                     'inputparams.t', 'inputparams.rep',
                     func=lambda x: x == True)
ne.plot_scatter()
[69]:
(<Figure size 600x400 with 1 Axes>,
 <Axes: xlabel='inputparams.t', ylabel='inputparams.rep'>)
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_90_1.png

To re-implement:

  • Need to be able to jointly plot/tabulate by single-day time + multi-day time

  • Combining approaches?

As for the human resilience:

[70]:
ec_nest, hist_nest, app_nest = prop.nested_sample(mdl, phs, faultdomains={'drive_faults':  (('all_fxnclass_modes', 'Drive'), {})},
                                                  faultsamples={'drive_faults': (('fault_phases', 'drive_faults', "start"), {})},
                                                  pool=mp.Pool(5))
NESTED SCENARIOS COMPLETE: 100%|██████████| 40/40 [00:19<00:00,  2.04it/s]
[71]:
nc = NestedComparison(ec_nest, phs, ['inputparams.t'], app_nest, ['fault'], metrics=['tot_deviation', 'end_dist'], default_stat=np.mean, ci_metrics=['end_dist', 'tot_deviation'])
[72]:
nc.sort_by_factor("fault")
nc.sort_by_factor("inputparams.t")
fig, ax = nc.as_plots('end_dist', 'tot_deviation', figsize=(8,4))
../../../_images/examples_rover_degradation_modelling_Degradation_Modelling_Notebook_95_0.png
[73]:
# fig.savefig("human_resilience_degradation.pdf", format="pdf", bbox_inches = 'tight', pad_inches = 0)

Combined Degradation

Idea: make same resilience plots as before but with degradation of resilience to drive faults at 0, 4, and 8 hours of fatigue.

Need method of doing this:

  • take params for one and replace with the other (kind of hacky and requires independence)

  • create composite of both? (how do you determine the merge between output params?)

  • use a combined method with both histories as input and sample over t_life and t_day (use this one)

[ ]:

Resilience assessment

[ ]: