fmdtools 2.0.7__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. {fmdtools-2.0.7 → fmdtools-2.1.0}/LICENSE +1 -1
  2. {fmdtools-2.0.7/fmdtools.egg-info → fmdtools-2.1.0}/PKG-INFO +4 -4
  3. {fmdtools-2.0.7 → fmdtools-2.1.0}/README.md +2 -2
  4. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/asg_demo/demo_model.py +6 -5
  5. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/eps/eps.py +29 -29
  6. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/eps/test_eps.py +5 -6
  7. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/drone_mdl_dynamic.py +7 -8
  8. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/drone_mdl_hierarchical.py +19 -18
  9. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/drone_mdl_rural.py +22 -21
  10. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/drone_mdl_static.py +22 -23
  11. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/drone_mdl_urban.py +3 -3
  12. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/test_multirotor.py +29 -18
  13. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/ex_pump.py +12 -11
  14. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/test_pump.py +1 -1
  15. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/test_pump_example.py +10 -8
  16. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/test_pump_stochastic.py +9 -7
  17. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/optimization/search_rover.py +28 -24
  18. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/rover_model.py +81 -85
  19. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/rover_model_human.py +16 -8
  20. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/tank/tank_model.py +54 -40
  21. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/tank/tank_optimization_model.py +5 -5
  22. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/tank/test_tank.py +10 -14
  23. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/ATC.py +3 -1
  24. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/asset.py +6 -6
  25. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/__init__.py +1 -1
  26. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/graph/label.py +2 -1
  27. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/graph/model.py +2 -1
  28. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/history.py +2 -1
  29. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/tabulate.py +27 -25
  30. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/action.py +1 -4
  31. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/base.py +0 -39
  32. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/component.py +0 -2
  33. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/function.py +4 -80
  34. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/block/action.py +1 -0
  35. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/block/base.py +117 -54
  36. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/block/function.py +6 -35
  37. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/base.py +5 -0
  38. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/mode.py +220 -234
  39. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/object/base.py +73 -19
  40. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/sim/propagate.py +5 -3
  41. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/sim/sample.py +86 -85
  42. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/sim/scenario.py +2 -1
  43. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/sim/search.py +200 -139
  44. {fmdtools-2.0.7 → fmdtools-2.1.0/fmdtools.egg-info}/PKG-INFO +4 -4
  45. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools.egg-info/SOURCES.txt +0 -2
  46. {fmdtools-2.0.7 → fmdtools-2.1.0}/pyproject.toml +1 -1
  47. fmdtools-2.0.7/examples/rover/opt_rover.py +0 -75
  48. fmdtools-2.0.7/examples/rover/optimization/untitled2.py +0 -7
  49. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/__init__.py +0 -0
  50. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/asg_demo/__init__.py +0 -0
  51. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/eps/__init__.py +0 -0
  52. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multiflow_demo/__init__.py +0 -0
  53. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multiflow_demo/multiflow_demo.py +0 -0
  54. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multiflow_demo/test_multiflow.py +0 -0
  55. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/__init__.py +0 -0
  56. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/multirotor/opt_drone_rural.py +0 -0
  57. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/__init__.py +0 -0
  58. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/jointfaults_ex.py +0 -0
  59. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/parallelism_methods.py +0 -0
  60. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/pump_indiv.py +0 -0
  61. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/pump/pump_stochastic.py +0 -0
  62. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/__init__.py +0 -0
  63. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/optimization/ea_analysis.py +0 -0
  64. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/rover_degradation.py +0 -0
  65. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/rover_mode_space.py +0 -0
  66. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/rover/test_rover.py +0 -0
  67. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/tank/__init__.py +0 -0
  68. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/common.py +0 -0
  69. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/model.py +0 -0
  70. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/test_asset.py +0 -0
  71. {fmdtools-2.0.7 → fmdtools-2.1.0}/examples/taxiway/test_model.py +0 -0
  72. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/__init__.py +0 -0
  73. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/common.py +0 -0
  74. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/graph/__init__.py +0 -0
  75. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/graph/base.py +0 -0
  76. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/graph/style.py +0 -0
  77. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/phases.py +0 -0
  78. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/analyze/result.py +0 -0
  79. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/__init__.py +0 -0
  80. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/__init__.py +0 -0
  81. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/architecture/geom.py +0 -0
  82. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/base.py +0 -0
  83. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/block/__init__.py +0 -0
  84. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/block/component.py +0 -0
  85. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/__init__.py +0 -0
  86. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/parameter.py +0 -0
  87. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/rand.py +0 -0
  88. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/state.py +0 -0
  89. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/container/time.py +0 -0
  90. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/environment.py +0 -0
  91. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/flow/__init__.py +0 -0
  92. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/flow/base.py +0 -0
  93. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/flow/commsflow.py +0 -0
  94. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/flow/multiflow.py +0 -0
  95. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/object/__init__.py +0 -0
  96. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/object/coords.py +0 -0
  97. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/object/geom.py +0 -0
  98. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/define/object/timer.py +0 -0
  99. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools/sim/__init__.py +0 -0
  100. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools.egg-info/dependency_links.txt +0 -0
  101. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools.egg-info/requires.txt +0 -0
  102. {fmdtools-2.0.7 → fmdtools-2.1.0}/fmdtools.egg-info/top_level.txt +0 -0
  103. {fmdtools-2.0.7 → fmdtools-2.1.0}/setup.cfg +0 -0
  104. {fmdtools-2.0.7 → fmdtools-2.1.0}/tests/test_graph.py +0 -0
  105. {fmdtools-2.0.7 → fmdtools-2.1.0}/tests/test_hierarchical.py +0 -0
  106. {fmdtools-2.0.7 → fmdtools-2.1.0}/tests/test_packages.py +0 -0
@@ -1,4 +1,4 @@
1
- fmdtools version 2.0.7
1
+ fmdtools version 2.1.0
2
2
  ---------------------------
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: fmdtools
3
- Version: 2.0.7
3
+ Version: 2.1.0
4
4
  Summary: System resilience modelling, simulation, and assessment in Python
5
5
  Author: fmdtools Developers
6
6
  Maintainer-email: Daniel Hulse <daniel.e.hulse@nasa.gov>
7
- License: fmdtools version 2.0.7
7
+ License: fmdtools version 2.1.0
8
8
  ---------------------------
9
9
  Apache License
10
10
  Version 2.0, January 2004
@@ -357,7 +357,7 @@ This may then be installed using:
357
357
  Note that this version reflects the latest version on the ``main`` git branch along with any local changes. To use a particular version of ``fmdtools`` you can checkout the tag corresponding to the version you want, e.g.:
358
358
 
359
359
  ```
360
- git checkout v2.0.7
360
+ git checkout v2.1.0
361
361
  ```
362
362
 
363
363
 
@@ -495,7 +495,7 @@ To cite a particular version of the fmdtools, you may use:
495
495
  author = {{NASA}},
496
496
  title = {fmdtools},
497
497
  url = {https://github.com/nasa/fmdtools},
498
- version = {2.0.7},
498
+ version = {2.1.0},
499
499
  date = {2024-11-13},
500
500
  }
501
501
  ```
@@ -97,7 +97,7 @@ This may then be installed using:
97
97
  Note that this version reflects the latest version on the ``main`` git branch along with any local changes. To use a particular version of ``fmdtools`` you can checkout the tag corresponding to the version you want, e.g.:
98
98
 
99
99
  ```
100
- git checkout v2.0.7
100
+ git checkout v2.1.0
101
101
  ```
102
102
 
103
103
 
@@ -235,7 +235,7 @@ To cite a particular version of the fmdtools, you may use:
235
235
  author = {{NASA}},
236
236
  title = {fmdtools},
237
237
  url = {https://github.com/nasa/fmdtools},
238
- version = {2.0.7},
238
+ version = {2.1.0},
239
239
  date = {2024-11-13},
240
240
  }
241
241
  ```
@@ -52,7 +52,8 @@ class Hazard(Flow):
52
52
 
53
53
 
54
54
  class ActionMode(Mode):
55
- fm_args = ('failed', 'unable')
55
+ fault_failed = ()
56
+ fault_unable = ()
56
57
  mode: str = 'nominal'
57
58
  exclusive = True
58
59
 
@@ -191,8 +192,8 @@ class HazardModel(FunctionArchitecture):
191
192
  if __name__ == '__main__':
192
193
  import fmdtools.sim.propagate as prop
193
194
  mdl = HazardModel()
194
- result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard',
195
- 'act_unable', time=4,
195
+ result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard.aa.acts.act',
196
+ 'unable', time=4,
196
197
  desired_result='graph')
197
198
 
198
199
  result_fault.graph.draw()
@@ -203,7 +204,7 @@ if __name__ == '__main__':
203
204
  'aa.flows.hazard.s.percieved',
204
205
  'aa.flows.hazard.s.mitigated', figsize=(10,5))
205
206
 
206
- result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard',
207
- 'perceive_failed', time=4,
207
+ result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard.aa.acts.perceive',
208
+ 'failed', time=4,
208
209
  desired_result='graph.fxns.detect_hazard.aa')
209
210
  result_fault.graph.fxns.detect_hazard.aa.draw_graphviz(layout='dot')
@@ -58,9 +58,9 @@ class Signal(Flow):
58
58
 
59
59
 
60
60
  class ImportEEModes(Mode):
61
- fm_args = {"low_v": (1e-5, 100),
62
- "high_v": (5e-6, 100),
63
- "no_v": (1e-5, 300)}
61
+ fault_low_v = (1e-5, 100)
62
+ fault_high_v = (5e-6, 100)
63
+ fault_no_v = (1e-5, 300)
64
64
 
65
65
 
66
66
  class ImportEE(Function):
@@ -96,8 +96,8 @@ class ImportEE(Function):
96
96
 
97
97
 
98
98
  class ImportSigModes(Mode):
99
- fm_args = {"partial_signal": (1e-5, 750),
100
- "no_signal": (1e-6, 750)}
99
+ fault_partial_signal = (1e-5, 750)
100
+ fault_no_signal = (1e-6, 750)
101
101
 
102
102
 
103
103
  class ImportSig(Function):
@@ -117,8 +117,8 @@ class ImportSig(Function):
117
117
 
118
118
 
119
119
  class StoreEEModes(Mode):
120
- fm_args = {"low_storage": (5e-6, 2000),
121
- "no_storage": (5e-6, 2000)}
120
+ fault_low_storage = (5e-6, 2000)
121
+ fault_no_storage = (5e-6, 2000)
122
122
 
123
123
 
124
124
  class StoreEE(Function):
@@ -149,11 +149,11 @@ class StoreEE(Function):
149
149
 
150
150
 
151
151
  class SupplyEEModes(Mode):
152
- fm_args = {"adverse_resist": (2e-6, 400),
153
- "minor_overload": (1e-5, 400),
154
- "major_overload": (3e-6, 400),
155
- "short": (1e-7, 400),
156
- "open_circuit": (5e-8, 200)}
152
+ fault_adverse_resist = (2e-6, 400)
153
+ fault_minor_overload = (1e-5, 400)
154
+ fault_major_overload = (3e-6, 400)
155
+ fault_short = (1e-7, 400)
156
+ fault_open_circuit = (5e-8, 200)
157
157
 
158
158
 
159
159
  class SupplyEE(Function):
@@ -193,10 +193,10 @@ class SupplyEE(Function):
193
193
 
194
194
 
195
195
  class DistEEModes(Mode):
196
- fm_args = {"adverse_resist": (1e-5, 1500),
197
- "poor_alloc": (2e-5, 500),
198
- "short": (2e-5, 1500),
199
- "open_circuit": (3e-5, 1500)}
196
+ fault_adverse_resist = (1e-5, 1500)
197
+ fault_poor_alloc = (2e-5, 500)
198
+ fault_short = (2e-5, 1500)
199
+ fault_open_circuit = (3e-5, 1500)
200
200
 
201
201
 
202
202
  class DistEE(Function):
@@ -247,8 +247,8 @@ class DistEE(Function):
247
247
 
248
248
 
249
249
  class ExportHEModes(Mode):
250
- fm_args = {"hot_sink": (1e-5, 500),
251
- "ineffective_sink": (0.5e-5, 1000)}
250
+ fault_hot_sink = (1e-5, 500)
251
+ fault_ineffective_sink = (0.5e-5, 1000)
252
252
 
253
253
 
254
254
  class ExportHE(Function):
@@ -286,11 +286,11 @@ class ExportOE(Function):
286
286
 
287
287
 
288
288
  class EEtoMEModes(Mode):
289
- fm_args = {"high_torque": (1e-4, 200),
290
- "low_torque": (1e-4, 200),
291
- "toohigh_torque": (5e-5, 200),
292
- "open_circuit": (5e-5, 200),
293
- "short": (5e-5, 200)}
289
+ fault_high_torque = (1e-4, 200)
290
+ fault_low_torque = (1e-4, 200)
291
+ fault_toohigh_torque = (5e-5, 200)
292
+ fault_open_circuit = (5e-5, 200)
293
+ fault_short = (5e-5, 200)
294
294
 
295
295
 
296
296
  class EEtoME(Function):
@@ -333,10 +333,10 @@ class EEtoME(Function):
333
333
 
334
334
 
335
335
  class EEtoHEModes(Mode):
336
- fm_args = {"low_heat": (2e-6, 200),
337
- "high_heat": (1e-7, 200),
338
- "toohigh_heat": (5e-7, 200),
339
- "open_circuit": (1e-7, 200)}
336
+ fault_low_heat = (2e-6, 200)
337
+ fault_high_heat = (1e-7, 200)
338
+ fault_toohigh_heat = (5e-7, 200)
339
+ fault_open_circuit = (1e-7, 200)
340
340
 
341
341
 
342
342
  class EEtoHE(Function):
@@ -372,8 +372,8 @@ class EEtoHE(Function):
372
372
 
373
373
 
374
374
  class EEtoOEModes(Mode):
375
- fm_args = {"optical_resist": (5e-7, 70),
376
- "burnt_out": (2e-6, 100)}
375
+ fault_optical_resist = (5e-7, 70)
376
+ fault_burnt_out = (2e-6, 100)
377
377
 
378
378
 
379
379
  class EEtoOE(Function):
@@ -40,7 +40,7 @@ class epsTests(unittest.TestCase, CommonTests):
40
40
  """
41
41
  res, hist = prop.one_fault(self.mdl, "distribute_ee", "short",
42
42
  desired_result="endfaults")
43
- self.assertEqual(res["endfaults"]["store_ee"], ["no_storage"])
43
+ self.assertEqual(res["endfaults"], ['store_ee.no_storage', 'distribute_ee.short'])
44
44
 
45
45
  def test_backward_fault_prop_2(self):
46
46
  """Tests that defined fault cases that require reverse propagation propagate
@@ -48,8 +48,7 @@ class epsTests(unittest.TestCase, CommonTests):
48
48
  """
49
49
  res, hist = prop.one_fault(self.mdl, "ee_to_me", "short",
50
50
  desired_result="endfaults")
51
- self.assertEqual(res["endfaults"]["store_ee"], ["no_storage"])
52
- self.assertEqual(res["endfaults"]["distribute_ee"], ["short"])
51
+ self.assertEqual(res["endfaults"], ['store_ee.no_storage', 'distribute_ee.short', 'ee_to_me.short'])
53
52
 
54
53
  def test_all_faults(self):
55
54
  """Some basic tests for propagating lists of faults in the model--
@@ -57,7 +56,7 @@ class epsTests(unittest.TestCase, CommonTests):
57
56
  than repairs"""
58
57
  mdl = self.mdl
59
58
  res, hist = prop.single_faults(mdl, showprogress=False)
60
- actual_num_faults = np.sum([len(f.m.faultmodes) for f in mdl.fxns.values()
59
+ actual_num_faults = np.sum([len(f.m.get_all_faultnames()) for f in mdl.fxns.values()
61
60
  if hasattr(f, 'm')])
62
61
  self.assertEqual(len(res.nest(1)), actual_num_faults + 1)
63
62
  hist_len_is_1 = all([len(v) == 1 for v in hist.values()])
@@ -66,7 +65,7 @@ class epsTests(unittest.TestCase, CommonTests):
66
65
  if 'nominal' not in k])
67
66
  # all endresults have positive costs
68
67
  self.assertTrue(all_have_costs)
69
- repcosts = np.sum([np.sum([m["cost"] for m in f.m.faultmodes.values()])
68
+ repcosts = np.sum([np.sum([m["cost"] for m in f.m.get_faults().values()])
70
69
  for f in mdl.fxns.values() if hasattr(f, 'm')])
71
70
  # fault costs higher than if it was just repairs
72
71
  total_simcosts = sum([v for v in res.get_values('.cost').values()])
@@ -75,7 +74,7 @@ class epsTests(unittest.TestCase, CommonTests):
75
74
  def test_fault_app(self):
76
75
  """Tests that the expected number of scenarios are generated for a given
77
76
  approach"""
78
- tot_faults = [len(f.m.faultmodes) for f in self.mdl.fxns.values()
77
+ tot_faults = [len(f.m.get_all_faultnames()) for f in self.mdl.fxns.values()
79
78
  if hasattr(f, 'm')]
80
79
  actual_num_faults = int(np.sum(tot_faults))
81
80
  for n_joint in [2, 3, actual_num_faults]:
@@ -36,6 +36,7 @@ import fmdtools.sim as fs
36
36
 
37
37
  import numpy as np
38
38
 
39
+
39
40
  class DroneEnvironmentGridParam(CoordsParam):
40
41
  """
41
42
  Define the grid parameters.
@@ -161,8 +162,8 @@ class PlanPathMode(Mode):
161
162
  """
162
163
 
163
164
  failrate = 1e-5
164
- fm_args = {'noloc': (0.2, 10000),
165
- 'degloc': (0.8, 10000)}
165
+ fault_noloc = (0.2, 10000)
166
+ fault_degloc = (0.8, 10000)
166
167
  opermodes = ('taxi', 'hover', 'move', 'descend', 'land')
167
168
  mode: int = 'taxi'
168
169
 
@@ -452,10 +453,8 @@ class Drone(FunctionArchitecture):
452
453
  else:
453
454
  crashcost = 0
454
455
 
455
- modes, modeprops = self.return_faultmodes()
456
- repcost = sum([c['cost']
457
- for f, m in modeprops.items()
458
- for a, c in m.items()])
456
+ modeprops = self.return_faultmodes()
457
+ repcost = sum([m['cost'] for f, m in modeprops.items()])
459
458
 
460
459
  totcost = repcost + crashcost + lostcost
461
460
  rate = scen.rate
@@ -554,5 +553,5 @@ if __name__ == "__main__":
554
553
  import doctest
555
554
  # doctest.testmod(verbose=True)
556
555
  # script_nominal_viewed()
557
- # script_faulty_trajectories()
558
- ani = script_env_viewed()
556
+ script_faulty_trajectories()
557
+ # ani = script_env_viewed()
@@ -168,16 +168,16 @@ class AffectDOF(AffectDOFDynamic):
168
168
  def reconfig_faults(self):
169
169
  """Corrects for individual line faultmodes by turning off the opposite rotor
170
170
  and upping the throttle (amp_factor)"""
171
- for fault in self.m.faults:
172
- if fault in self.ca.m.sub_modes:
173
- comp = self.ca.m.sub_modes[fault]
174
- opp = self.ca.p.opposite[comp]
175
- if self.ca.s.forward[comp] != 0.0:
176
- self.ca.s.forward[comp] = 0.0
177
- self.ca.s.upward[comp] = 0.0
178
- if self.ca.s.forward[opp] != 0.0:
179
- self.ca.s.forward[opp] = 0.0
180
- self.ca.s.upward[opp] = 0.0
171
+ if self.get_faults(with_base_faults=False, only_present=True):
172
+ for cname, comp in self.ca.comps.items():
173
+ if comp.m.faults:
174
+ oname = self.ca.p.opposite[cname]
175
+ if self.ca.s.forward[cname] != 0.0:
176
+ self.ca.s.forward[cname] = 0.0
177
+ self.ca.s.upward[cname] = 0.0
178
+ if self.ca.s.forward[oname] != 0.0:
179
+ self.ca.s.forward[oname] = 0.0
180
+ self.ca.s.upward[oname] = 0.0
181
181
  tot_comps = len(self.ca.comps)
182
182
  empty_comps = len([c for c in self.ca.s.forward if self.ca.s.forward[c] == 0.0])
183
183
  try:
@@ -305,25 +305,26 @@ if __name__ == "__main__":
305
305
 
306
306
  # check rf_mechbreack fault propagation in quad architecture:
307
307
  hierarchical_model = Drone(p=DroneParam(arch='quad'))
308
- endclass, mdlhist = fs.propagate.one_fault(hierarchical_model,
309
- 'affect_dof',
310
- 'rf_mechbreak',
311
- time=5)
312
- mdlhist.plot_line('flows.dofs.s.x', 'flows.dofs.s.y', 'flows.dofs.s.z', 'fxns.store_ee.s.soc')
308
+ # endclass, mdlhist = fs.propagate.one_fault(hierarchical_model,
309
+ # 'affect_dof.ca.comps.rf',
310
+ # 'mechbreak',
311
+ # time=5)
312
+ # mdlhist.plot_line('flows.dofs.s.x', 'flows.dofs.s.y', 'flows.dofs.s.z', 'fxns.store_ee.s.soc')
313
313
 
314
314
  # check rr2_propstuck fault in oct architecture over several times:
315
315
  mdl = Drone(p=DroneParam(arch='oct'))
316
316
  rr2_faults = FaultDomain(mdl)
317
- rr2_faults.add_fault('affect_dof', 'rr2_propstuck')
317
+ # rr2_faults.add_fault('affect_dof.ca.comps.rr2', 'propstuck')
318
+ rr2_faults.add_all_fxn_modes("affect_dof")
318
319
 
319
320
  rr2_samp = FaultSample(rr2_faults, phasemap=PhaseMap(mdl.sp.phases))
320
321
  rr2_samp.add_fault_phases()
321
322
 
322
- ec, hist = fs.propagate.fault_sample(mdl, rr2_samp , staged=True, pool=mp.Pool(4))
323
+ ec, hist = fs.propagate.fault_sample(mdl, rr2_samp, staged=True)
323
324
 
324
325
  # plot a single scen (at t=8)
325
326
  fault_kwargs = {'alpha': 0.2, 'color': 'red'}
326
- h_plot = hist.get('nominal', 'affect_dof_rr2_propstuck_t8p0').flatten()
327
+ h_plot = hist.get('nominal', 'affect_dof_ca_comps_rr2_propstuck_t8p0').flatten()
327
328
  h_plot.plot_line('flows.dofs.s.x', 'flows.dofs.s.y', 'flows.dofs.s.z', 'fxns.store_ee.s.soc')
328
329
 
329
330
  # plot all scens
@@ -188,12 +188,12 @@ class BatMode(Mode):
188
188
  """
189
189
 
190
190
  failrate = 1e-4
191
- fm_args = {'short': (0.2, 100, {"taxi": 0.3, "move": 0.3, "land": 0.3}),
192
- 'degr': (0.2, 100, {"taxi": 0.3, "move": 0.3, "land": 0.3}),
193
- 'break': (0.2, 100, {"taxi": 0.3, "move": 0.3, "land": 0.3}),
194
- 'nocharge': (0.6, 100, {"taxi": 0.7, "move": 0.2, "land": 0.1}),
195
- 'lowcharge': (0.4, 100, {"taxi": 0.5, "move": 0.2, "land": 0.3})}
196
- units = 'hr'
191
+ fault_short = (0.2, 100, (("taxi", 0.3), ("move", 0.3), ("land", 0.3)))
192
+ fault_degr = (0.2, 100, (("taxi", 0.3), ("move", 0.3), ("land", 0.3)))
193
+ fault_break = (0.2, 100, (("taxi", 0.3), ("move", 0.3), ("land", 0.3)))
194
+ fault_nocharge = (0.6, 100, (("taxi", 0.7), ("move", 0.2), ("land", 0.1)))
195
+ fault_lowcharge = (0.4, 100, (("taxi", 0.5), ("move", 0.2), ("land", 0.3)))
196
+ default_units = 'hr'
197
197
 
198
198
 
199
199
  class BatParam(Parameter):
@@ -347,8 +347,9 @@ class StoreEEMode(Mode):
347
347
  """Overall StoreEE mode."""
348
348
 
349
349
  failrate = 1e-4
350
- fm_args = {'nocharge': (0.2, 0, {"taxi": 0.6, "move": 0.2, "land": 0.2}),
351
- 'lowcharge': (0.7, 0, {"taxi": 0.6, "move": 0.2, "land": 0.2})}
350
+ fault_nocharge = (0.2, 0)
351
+ fault_lowcharge = (0.7, 0)
352
+ default_phases = (("taxi", 0.6), ("move", 0.2), ("land", 0.2))
352
353
  units = 'hr'
353
354
 
354
355
 
@@ -421,9 +422,10 @@ class HoldPayloadMode(Mode):
421
422
  """
422
423
 
423
424
  failrate = 1e-6
424
- fm_args = {'break': (0.2, 1000, {"taxi": 0.3, "move": 0.3, "land": 0.3}),
425
- 'deform': (0.8, 1000, {"taxi": 0.3, "move": 0.3, "land": 0.3})}
426
- units = 'hr'
425
+ fault_break = (0.2, 1000)
426
+ fault_deform = (0.8, 1000)
427
+ default_phases = (("taxi", 0.3), ("move", 0.3), ("land", 0.3))
428
+ default_units = 'hr'
427
429
 
428
430
 
429
431
  class HoldPayload(HoldPayloadDyn):
@@ -444,7 +446,7 @@ class ManageHealthMode(Mode):
444
446
  """
445
447
 
446
448
  failrate = 1e-6
447
- fm_args = {'lostfunction': (0.05, 1000, {"taxi": 0.3, "move": 0.3, "land": 0.3})}
449
+ fault_lostfunction = (0.05, 1000, (("taxi", 0.3), ("move", 0.3), ("land", 0.3)))
448
450
  units = 'hr'
449
451
 
450
452
 
@@ -513,8 +515,8 @@ class CtlDOFMode(Mode):
513
515
  """
514
516
 
515
517
  failrate = 1e-5
516
- fm_args = {'noctl': (0.2, 1000, {"taxi": 0.6, "move": 0.3, "land": 0.1}),
517
- 'degctl': (0.8, 1000, {"taxi": 0.6, "move": 0.3, "land": 0.1})}
518
+ fault_noctl = (0.2, 1000, (("taxi", 0.6), ("move", 0.3), ("land", 0.1)))
519
+ fault_degctl = (0.8, 1000, (("taxi", 0.6), ("move", 0.3), ("land", 0.1)))
518
520
  mode: str = 'nominal'
519
521
  units = 'hr'
520
522
 
@@ -551,9 +553,9 @@ class PlanPathMode(Mode):
551
553
  """
552
554
 
553
555
  failrate = 1e-5
554
- fm_args = {'noloc': (0.2, 1000),
555
- 'degloc': (0.8, 1000)}
556
- phases = {"taxi": 0.6, "move": 0.3, "land": 0.1}
556
+ fault_noloc = (0.2, 1000)
557
+ fault_degloc = (0.8, 1000)
558
+ default_phases = (("taxi", 0.6), ("move", 0.3), ("land", 0.1))
557
559
  opermodes = ('taxi', 'to_nearest', 'to_home', 'emland', 'land', 'move')
558
560
  mode: str = 'taxi'
559
561
  exclusive = False
@@ -738,10 +740,8 @@ class Drone(FunctionArchitecture):
738
740
  ----------
739
741
  scen : Scenario
740
742
  Fault Scenario
741
- viewed : TYPE
742
- DESCRIPTION.
743
- faulttime : TYPE
744
- DESCRIPTION.
743
+ faulttime : int
744
+ time when the fault occurs.
745
745
 
746
746
  Returns
747
747
  -------
@@ -924,6 +924,7 @@ if __name__ == "__main__":
924
924
  import fmdtools.sim.propagate as prop
925
925
  from fmdtools.analyze import phases
926
926
  from fmdtools.sim.sample import SampleApproach
927
+ from fmdtools.define.architecture.function import FunctionArchitectureGraph
927
928
 
928
929
  # check operational phases
929
930
  mdl = Drone()
@@ -203,7 +203,7 @@ class StoreEEMode(Mode):
203
203
  """Specifies fault modes for battery (e.g., lowcharge)."""
204
204
 
205
205
  failrate = 1e-5
206
- fm_args = {"nocharge": (1, 300)}
206
+ fault_nocharge = (1, 300)
207
207
 
208
208
 
209
209
  class StoreEEState(State):
@@ -245,9 +245,9 @@ class DistEEMode(Mode):
245
245
  """
246
246
 
247
247
  failrate = 1e-5
248
- fm_args = {"short": (0.3, 3000),
249
- "degr": (0.5, 1000),
250
- "break": (0.2, 2000)}
248
+ fault_short = (0.3, 3000)
249
+ fault_degr = (0.5, 1000)
250
+ fault_break = (0.2, 2000)
251
251
 
252
252
 
253
253
  class DistEEState(State):
@@ -337,8 +337,8 @@ class HoldPayloadMode(Mode):
337
337
  """
338
338
 
339
339
  failrate = 1e-6
340
- fm_args = {"break": (0.2, 10000),
341
- "deform": (0.8, 10000)}
340
+ fault_break = (0.2, 10000)
341
+ fault_deform = (0.8, 10000)
342
342
 
343
343
 
344
344
  class HoldPayloadState(State):
@@ -468,18 +468,16 @@ class AffectDOFMode(Mode):
468
468
  """
469
469
 
470
470
  failrate = 1e-5
471
- fm_args = {
472
- "short": (0.1, 200),
473
- "openc": (0.1, 200),
474
- "ctlup": (0.2, 500),
475
- "ctldn": (0.2, 500),
476
- "ctlbreak": (0.2, 1000),
477
- "mechbreak": (0.1, 500),
478
- "mechfriction": (0.05, 500),
479
- "propwarp": (0.01, 200),
480
- "propstuck": (0.02, 200),
481
- "propbreak": (0.03, 200),
482
- }
471
+ fault_short = (0.1, 200)
472
+ fault_openc = (0.1, 200)
473
+ fault_ctlup = (0.2, 500)
474
+ fault_ctldn = (0.2, 500)
475
+ fault_ctlbreak = (0.2, 1000)
476
+ fault_mechbreak = (0.1, 500)
477
+ fault_mechfriction = (0.05, 500)
478
+ fault_propwarp = (0.01, 200)
479
+ fault_propstuck = (0.02, 200)
480
+ fault_propbreak = (0.03, 200)
483
481
 
484
482
 
485
483
  class BaseLine(object):
@@ -596,8 +594,8 @@ class CtlDOFMode(Mode):
596
594
  """Controller Modes, noctl (lack of control) and degctl (degraded control)."""
597
595
 
598
596
  failrate = 1e-5
599
- fm_args = {"noctl": (0.2, 10000),
600
- "degctl": (0.8, 10000)}
597
+ fault_noctl = (0.2, 10000)
598
+ fault_degctl = (0.8, 10000)
601
599
 
602
600
 
603
601
  class CtlDOF(Function):
@@ -670,7 +668,8 @@ class PlanPathMode(Mode):
670
668
  """Path planning modes (no location and degraded location)."""
671
669
 
672
670
  failrate = 1e-5
673
- fm_args = {"noloc": (0.2, 10000), "degloc": (0.8, 10000)}
671
+ fault_noloc = (0.2, 10000)
672
+ fault_degloc = (0.8, 10000)
674
673
 
675
674
 
676
675
  class PlanPath(Function):
@@ -791,8 +790,8 @@ class Drone(FunctionArchitecture):
791
790
 
792
791
  def find_classification(self, scen, mdlhist):
793
792
  """Calculate rate, cost, expected cost based on cost of repair information."""
794
- modes, modeprops = self.return_faultmodes()
795
- repcost = sum([c["cost"] for f, m in modeprops.items() for a, c in m.items()])
793
+ modeprops = self.return_faultmodes()
794
+ repcost = sum([m["cost"] for f, m in modeprops.items()])
796
795
 
797
796
  totcost = repcost
798
797
  rate = scen.rate
@@ -178,9 +178,9 @@ class ComputerVisionMode(Mode):
178
178
  doesn't detect occupied spaces
179
179
  """
180
180
 
181
- fm_args = {'undesired_detection': (0.5,),
182
- 'lack_of_detection': (0.5,)}
183
- units = 'hr'
181
+ fault_undesired_detection = (0.5,)
182
+ fault_lack_of_detection = (0.5,)
183
+ default_units = 'hr'
184
184
 
185
185
 
186
186
  class ComputerVision(Component):