fmdtools 2.0.7__tar.gz → 2.1.1__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.1}/LICENSE +1 -1
  2. {fmdtools-2.0.7/fmdtools.egg-info → fmdtools-2.1.1}/PKG-INFO +22 -13
  3. {fmdtools-2.0.7 → fmdtools-2.1.1}/README.md +18 -10
  4. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/asg_demo/demo_model.py +6 -5
  5. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/eps/eps.py +29 -29
  6. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/eps/test_eps.py +5 -6
  7. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/drone_mdl_dynamic.py +7 -8
  8. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/drone_mdl_hierarchical.py +19 -18
  9. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/drone_mdl_rural.py +22 -21
  10. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/drone_mdl_static.py +22 -23
  11. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/drone_mdl_urban.py +3 -3
  12. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/test_multirotor.py +29 -18
  13. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/ex_pump.py +12 -11
  14. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/test_pump.py +1 -1
  15. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/test_pump_example.py +10 -8
  16. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/test_pump_stochastic.py +9 -7
  17. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/optimization/search_rover.py +28 -24
  18. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/rover_mode_space.py +27 -30
  19. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/rover_model.py +65 -107
  20. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/rover_model_human.py +16 -8
  21. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/tank/tank_model.py +54 -40
  22. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/tank/tank_optimization_model.py +5 -5
  23. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/tank/test_tank.py +10 -14
  24. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/ATC.py +3 -1
  25. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/asset.py +6 -6
  26. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/__init__.py +1 -1
  27. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/graph/label.py +2 -1
  28. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/graph/model.py +2 -1
  29. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/history.py +2 -1
  30. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/tabulate.py +27 -25
  31. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/action.py +1 -4
  32. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/base.py +0 -39
  33. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/component.py +0 -2
  34. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/function.py +4 -80
  35. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/block/action.py +1 -0
  36. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/block/base.py +125 -55
  37. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/block/function.py +6 -35
  38. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/base.py +7 -2
  39. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/mode.py +174 -236
  40. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/environment.py +1 -1
  41. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/flow/commsflow.py +7 -6
  42. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/flow/multiflow.py +10 -4
  43. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/object/base.py +73 -19
  44. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/object/coords.py +29 -24
  45. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/sim/propagate.py +10 -18
  46. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/sim/sample.py +204 -90
  47. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/sim/scenario.py +23 -9
  48. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/sim/search.py +200 -139
  49. {fmdtools-2.0.7 → fmdtools-2.1.1/fmdtools.egg-info}/PKG-INFO +22 -13
  50. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools.egg-info/SOURCES.txt +0 -2
  51. {fmdtools-2.0.7 → fmdtools-2.1.1}/pyproject.toml +1 -1
  52. {fmdtools-2.0.7 → fmdtools-2.1.1}/tests/test_hierarchical.py +7 -21
  53. fmdtools-2.0.7/examples/rover/opt_rover.py +0 -75
  54. fmdtools-2.0.7/examples/rover/optimization/untitled2.py +0 -7
  55. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/__init__.py +0 -0
  56. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/asg_demo/__init__.py +0 -0
  57. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/eps/__init__.py +0 -0
  58. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multiflow_demo/__init__.py +0 -0
  59. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multiflow_demo/multiflow_demo.py +0 -0
  60. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multiflow_demo/test_multiflow.py +0 -0
  61. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/__init__.py +0 -0
  62. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/multirotor/opt_drone_rural.py +0 -0
  63. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/__init__.py +0 -0
  64. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/jointfaults_ex.py +0 -0
  65. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/parallelism_methods.py +0 -0
  66. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/pump_indiv.py +0 -0
  67. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/pump/pump_stochastic.py +0 -0
  68. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/__init__.py +0 -0
  69. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/optimization/ea_analysis.py +0 -0
  70. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/rover_degradation.py +0 -0
  71. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/rover/test_rover.py +0 -0
  72. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/tank/__init__.py +0 -0
  73. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/common.py +0 -0
  74. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/model.py +0 -0
  75. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/test_asset.py +0 -0
  76. {fmdtools-2.0.7 → fmdtools-2.1.1}/examples/taxiway/test_model.py +0 -0
  77. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/__init__.py +0 -0
  78. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/common.py +0 -0
  79. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/graph/__init__.py +0 -0
  80. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/graph/base.py +0 -0
  81. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/graph/style.py +0 -0
  82. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/phases.py +0 -0
  83. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/analyze/result.py +0 -0
  84. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/__init__.py +0 -0
  85. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/__init__.py +0 -0
  86. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/architecture/geom.py +0 -0
  87. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/base.py +0 -0
  88. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/block/__init__.py +0 -0
  89. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/block/component.py +0 -0
  90. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/__init__.py +0 -0
  91. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/parameter.py +0 -0
  92. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/rand.py +0 -0
  93. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/state.py +0 -0
  94. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/container/time.py +0 -0
  95. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/flow/__init__.py +0 -0
  96. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/flow/base.py +0 -0
  97. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/object/__init__.py +0 -0
  98. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/object/geom.py +0 -0
  99. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/define/object/timer.py +0 -0
  100. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools/sim/__init__.py +0 -0
  101. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools.egg-info/dependency_links.txt +0 -0
  102. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools.egg-info/requires.txt +0 -0
  103. {fmdtools-2.0.7 → fmdtools-2.1.1}/fmdtools.egg-info/top_level.txt +0 -0
  104. {fmdtools-2.0.7 → fmdtools-2.1.1}/setup.cfg +0 -0
  105. {fmdtools-2.0.7 → fmdtools-2.1.1}/tests/test_graph.py +0 -0
  106. {fmdtools-2.0.7 → fmdtools-2.1.1}/tests/test_packages.py +0 -0
@@ -1,4 +1,4 @@
1
- fmdtools version 2.0.7
1
+ fmdtools version 2.1.1
2
2
  ---------------------------
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -1,10 +1,10 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: fmdtools
3
- Version: 2.0.7
3
+ Version: 2.1.1
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.1
8
8
  ---------------------------
9
9
  Apache License
10
10
  Version 2.0, January 2004
@@ -257,6 +257,7 @@ Requires-Dist: recordclass==0.22.1
257
257
  Requires-Dist: pytest
258
258
  Requires-Dist: graphviz
259
259
  Requires-Dist: shapely>=2.0
260
+ Dynamic: license-file
260
261
 
261
262
  [![fmdtools logo - titanic](/docs-source/figures/logo/logo-titanic.png)](https://github.com/nasa/fmdtools)
262
263
 
@@ -296,7 +297,7 @@ Simulation techniques in fmdtools represent the state-of-the-art in dynamical sy
296
297
  <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/efficient.svg">
297
298
 
298
299
  ### Efficient Analysis Process
299
- Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can write 2-3 lines of code to visualize model behavior instead of spending hours writing it yourself.
300
+ Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can easily leverage our existing methods to understand simulation results instead of spending hours implementing your own.
300
301
 
301
302
 
302
303
 
@@ -314,23 +315,31 @@ The fmdtools library is developed in Python 3.11 but tested to maintain compatib
314
315
 
315
316
  Further (functional and integration) tests are performed in the Python 3.11 to ensure that examples run as desired. Thus, it is generally reccommended to use Python 3.11 to keep pace with development, especially when running examples.
316
317
 
317
- ### Set up python environment
318
+ ### Set up python tooling environment
318
319
 
319
- The fmdtools library was developed to run in an anaconda python environment. If you do not have an existing python environment, first [download and install anaconda.](https://docs.anaconda.com/free/anaconda/install/index.html).
320
+ The fmdtools library was developed to run in a python development environments.
320
321
 
321
- After the base installation, set up a new `Python 3.11` environment for fmdtools and install these external external (non-python) packages in it:
322
+ If you do not have an existing python environment, first [download and install anaconda](https://docs.anaconda.com/free/anaconda/install/index.html) or [uv]().
323
+
324
+ After the base installation, set up a new `Python 3.11` environment for fmdtools and install these external external packages in it:
322
325
 
323
326
  ```
327
+ spyder-kernels
328
+ # used for: working with external IDEs
329
+ # license: ()
330
+ # install from: (comes with anaconda) or `uv pip install spyder-kernels`
324
331
  jupyter notebook
325
332
  # used for: repository notebooks
326
333
  # license: (BSD-3) https://jupyter.org/governance/projectlicense.html
327
- # install from: (should be installed already)
334
+ # install from: (comes with anaconda) or `uv pip install jupyter`
328
335
  graphviz
329
336
  # used for: plotting graphs using graphviz
330
337
  # license: (CPL 1.0) https://graphviz.org/license/
331
- # install from: https://anaconda.org/anaconda/graphviz
338
+ # install from: https://anaconda.org/anaconda/graphviz or https://graphviz.org/download/
332
339
  ```
333
340
 
341
+ From there, it can be helpful to install an IDE like [VSCode](https://code.visualstudio.com/) or [Spyder](https://www.spyder-ide.org/).
342
+
334
343
  Note: On Windows, some versions `fmdtools` dependencies may require a compiler such as that provided with [Microsoft Studio Build tools](https://visualstudio.microsoft.com/downloads/?q=build+tools) to build, so it (while not required) may be helpful to install it also.
335
344
 
336
345
 
@@ -357,13 +366,13 @@ This may then be installed using:
357
366
  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
367
 
359
368
  ```
360
- git checkout v2.0.7
369
+ git checkout v2.1.1
361
370
  ```
362
371
 
363
372
 
364
373
  #### Dependencies
365
374
 
366
- fmdtools requires `Python 3.11` (anaconda recommended) and depends directly on the packages below (see requirements.txt). Note that the use of these depencencies is governed by their respective licences, which may be obtained at the provided links.
375
+ fmdtools requires `Python 3.11` and depends directly on the packages below (see requirements.txt). Note that the use of these depencencies is governed by their respective licences, which may be obtained at the provided links.
367
376
 
368
377
  ```
369
378
  scipy
@@ -495,12 +504,12 @@ To cite a particular version of the fmdtools, you may use:
495
504
  author = {{NASA}},
496
505
  title = {fmdtools},
497
506
  url = {https://github.com/nasa/fmdtools},
498
- version = {2.0.7},
507
+ version = {2.1.1},
499
508
  date = {2024-11-13},
500
509
  }
501
510
  ```
502
511
 
503
- To cite a particular fmdtools example or published research methodology, use the relevant reference provided in the in accompanying README file for the example.
512
+ To cite a particular fmdtools example use the relevant reference provided in the in accompanying README file for the example. To cite a given published research methodology embodied by fmdtools, see our [publication list](PUBLICATIONS.md).
504
513
 
505
514
  ## License/Notices
506
515
 
@@ -36,7 +36,7 @@ Simulation techniques in fmdtools represent the state-of-the-art in dynamical sy
36
36
  <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/efficient.svg">
37
37
 
38
38
  ### Efficient Analysis Process
39
- Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can write 2-3 lines of code to visualize model behavior instead of spending hours writing it yourself.
39
+ Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can easily leverage our existing methods to understand simulation results instead of spending hours implementing your own.
40
40
 
41
41
 
42
42
 
@@ -54,23 +54,31 @@ The fmdtools library is developed in Python 3.11 but tested to maintain compatib
54
54
 
55
55
  Further (functional and integration) tests are performed in the Python 3.11 to ensure that examples run as desired. Thus, it is generally reccommended to use Python 3.11 to keep pace with development, especially when running examples.
56
56
 
57
- ### Set up python environment
57
+ ### Set up python tooling environment
58
58
 
59
- The fmdtools library was developed to run in an anaconda python environment. If you do not have an existing python environment, first [download and install anaconda.](https://docs.anaconda.com/free/anaconda/install/index.html).
59
+ The fmdtools library was developed to run in a python development environments.
60
60
 
61
- After the base installation, set up a new `Python 3.11` environment for fmdtools and install these external external (non-python) packages in it:
61
+ If you do not have an existing python environment, first [download and install anaconda](https://docs.anaconda.com/free/anaconda/install/index.html) or [uv]().
62
+
63
+ After the base installation, set up a new `Python 3.11` environment for fmdtools and install these external external packages in it:
62
64
 
63
65
  ```
66
+ spyder-kernels
67
+ # used for: working with external IDEs
68
+ # license: ()
69
+ # install from: (comes with anaconda) or `uv pip install spyder-kernels`
64
70
  jupyter notebook
65
71
  # used for: repository notebooks
66
72
  # license: (BSD-3) https://jupyter.org/governance/projectlicense.html
67
- # install from: (should be installed already)
73
+ # install from: (comes with anaconda) or `uv pip install jupyter`
68
74
  graphviz
69
75
  # used for: plotting graphs using graphviz
70
76
  # license: (CPL 1.0) https://graphviz.org/license/
71
- # install from: https://anaconda.org/anaconda/graphviz
77
+ # install from: https://anaconda.org/anaconda/graphviz or https://graphviz.org/download/
72
78
  ```
73
79
 
80
+ From there, it can be helpful to install an IDE like [VSCode](https://code.visualstudio.com/) or [Spyder](https://www.spyder-ide.org/).
81
+
74
82
  Note: On Windows, some versions `fmdtools` dependencies may require a compiler such as that provided with [Microsoft Studio Build tools](https://visualstudio.microsoft.com/downloads/?q=build+tools) to build, so it (while not required) may be helpful to install it also.
75
83
 
76
84
 
@@ -97,13 +105,13 @@ This may then be installed using:
97
105
  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
106
 
99
107
  ```
100
- git checkout v2.0.7
108
+ git checkout v2.1.1
101
109
  ```
102
110
 
103
111
 
104
112
  #### Dependencies
105
113
 
106
- fmdtools requires `Python 3.11` (anaconda recommended) and depends directly on the packages below (see requirements.txt). Note that the use of these depencencies is governed by their respective licences, which may be obtained at the provided links.
114
+ fmdtools requires `Python 3.11` and depends directly on the packages below (see requirements.txt). Note that the use of these depencencies is governed by their respective licences, which may be obtained at the provided links.
107
115
 
108
116
  ```
109
117
  scipy
@@ -235,12 +243,12 @@ To cite a particular version of the fmdtools, you may use:
235
243
  author = {{NASA}},
236
244
  title = {fmdtools},
237
245
  url = {https://github.com/nasa/fmdtools},
238
- version = {2.0.7},
246
+ version = {2.1.1},
239
247
  date = {2024-11-13},
240
248
  }
241
249
  ```
242
250
 
243
- To cite a particular fmdtools example or published research methodology, use the relevant reference provided in the in accompanying README file for the example.
251
+ To cite a particular fmdtools example use the relevant reference provided in the in accompanying README file for the example. To cite a given published research methodology embodied by fmdtools, see our [publication list](PUBLICATIONS.md).
244
252
 
245
253
  ## License/Notices
246
254
 
@@ -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()