fmdtools 2.0.4__tar.gz → 2.0.6__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 (105) hide show
  1. {fmdtools-2.0.4 → fmdtools-2.0.6}/LICENSE +1 -1
  2. {fmdtools-2.0.4 → fmdtools-2.0.6}/PKG-INFO +8 -6
  3. {fmdtools-2.0.4 → fmdtools-2.0.6}/README.md +4 -4
  4. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/asg_demo/demo_model.py +2 -2
  5. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multiflow_demo/multiflow_demo.py +5 -5
  6. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/drone_mdl_dynamic.py +11 -9
  7. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/drone_mdl_rural.py +5 -5
  8. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/drone_mdl_static.py +1 -1
  9. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/test_multirotor.py +1 -1
  10. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/ex_pump.py +1 -1
  11. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/parallelism_methods.py +36 -17
  12. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/pump_stochastic.py +7 -7
  13. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/test_pump_stochastic.py +2 -2
  14. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/rover_model.py +3 -3
  15. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/tank/tank_model.py +7 -3
  16. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/asset.py +4 -5
  17. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/test_asset.py +4 -4
  18. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/__init__.py +1 -1
  19. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/common.py +168 -13
  20. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/graph/base.py +1 -1
  21. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/graph/model.py +20 -3
  22. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/history.py +121 -135
  23. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/phases.py +18 -21
  24. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/result.py +122 -93
  25. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/tabulate.py +7 -9
  26. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/base.py +5 -3
  27. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/function.py +5 -3
  28. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/base.py +7 -1
  29. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/block/base.py +6 -5
  30. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/block/function.py +1 -1
  31. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/rand.py +5 -6
  32. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/environment.py +8 -10
  33. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/flow/commsflow.py +59 -9
  34. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/flow/multiflow.py +96 -10
  35. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/object/base.py +18 -13
  36. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/object/coords.py +782 -607
  37. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/sim/propagate.py +8 -4
  38. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/sim/sample.py +4 -4
  39. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/sim/search.py +138 -20
  40. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools.egg-info/PKG-INFO +8 -6
  41. {fmdtools-2.0.4 → fmdtools-2.0.6}/pyproject.toml +3 -1
  42. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/__init__.py +0 -0
  43. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/asg_demo/__init__.py +0 -0
  44. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/eps/__init__.py +0 -0
  45. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/eps/eps.py +0 -0
  46. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/eps/test_eps.py +0 -0
  47. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multiflow_demo/__init__.py +0 -0
  48. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multiflow_demo/test_multiflow.py +0 -0
  49. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/__init__.py +0 -0
  50. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/drone_mdl_hierarchical.py +0 -0
  51. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/drone_mdl_urban.py +0 -0
  52. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/multirotor/opt_drone_rural.py +0 -0
  53. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/__init__.py +0 -0
  54. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/jointfaults_ex.py +0 -0
  55. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/pump_indiv.py +0 -0
  56. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/test_pump.py +0 -0
  57. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/pump/test_pump_example.py +0 -0
  58. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/__init__.py +0 -0
  59. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/opt_rover.py +0 -0
  60. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/optimization/ea_analysis.py +0 -0
  61. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/optimization/search_rover.py +0 -0
  62. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/optimization/untitled2.py +0 -0
  63. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/rover_degradation.py +0 -0
  64. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/rover_mode_space.py +0 -0
  65. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/rover_model_human.py +0 -0
  66. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/rover/test_rover.py +0 -0
  67. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/tank/__init__.py +0 -0
  68. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/tank/tank_optimization_model.py +0 -0
  69. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/tank/test_tank.py +0 -0
  70. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/ATC.py +0 -0
  71. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/common.py +0 -0
  72. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/model.py +0 -0
  73. {fmdtools-2.0.4 → fmdtools-2.0.6}/examples/taxiway/test_model.py +0 -0
  74. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/__init__.py +0 -0
  75. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/graph/__init__.py +0 -0
  76. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/graph/label.py +0 -0
  77. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/analyze/graph/style.py +0 -0
  78. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/__init__.py +0 -0
  79. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/__init__.py +0 -0
  80. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/action.py +0 -0
  81. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/component.py +0 -0
  82. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/architecture/geom.py +0 -0
  83. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/block/__init__.py +0 -0
  84. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/block/action.py +0 -0
  85. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/block/component.py +0 -0
  86. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/__init__.py +0 -0
  87. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/base.py +0 -0
  88. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/mode.py +0 -0
  89. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/parameter.py +0 -0
  90. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/state.py +0 -0
  91. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/container/time.py +0 -0
  92. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/flow/__init__.py +0 -0
  93. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/flow/base.py +0 -0
  94. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/object/__init__.py +0 -0
  95. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/object/geom.py +0 -0
  96. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/define/object/timer.py +0 -0
  97. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/sim/__init__.py +0 -0
  98. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools/sim/scenario.py +0 -0
  99. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools.egg-info/SOURCES.txt +0 -0
  100. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools.egg-info/dependency_links.txt +0 -0
  101. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools.egg-info/requires.txt +0 -0
  102. {fmdtools-2.0.4 → fmdtools-2.0.6}/fmdtools.egg-info/top_level.txt +0 -0
  103. {fmdtools-2.0.4 → fmdtools-2.0.6}/setup.cfg +0 -0
  104. {fmdtools-2.0.4 → fmdtools-2.0.6}/tests/test_graph.py +0 -0
  105. {fmdtools-2.0.4 → fmdtools-2.0.6}/tests/test_packages.py +0 -0
@@ -1,4 +1,4 @@
1
- fmdtools version 2.0.4
1
+ fmdtools version 2.0.6
2
2
  ---------------------------
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fmdtools
3
- Version: 2.0.4
3
+ Version: 2.0.6
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.4
7
+ License: fmdtools version 2.0.6
8
8
  ---------------------------
9
9
  Apache License
10
10
  Version 2.0, January 2004
@@ -236,7 +236,9 @@ Project-URL: Documentation, https://nasa.github.io/fmdtools/
236
236
  Project-URL: source-code, https://github.com/nasa/fmdtools
237
237
  Classifier: Development Status :: 5 - Production/Stable
238
238
  Classifier: Intended Audience :: Science/Research
239
+ Classifier: Programming Language :: Python :: 3.10
239
240
  Classifier: Programming Language :: Python :: 3.11
241
+ Classifier: Programming Language :: Python :: 3.12
240
242
  Classifier: License :: OSI Approved :: Apache Software License
241
243
  Classifier: Operating System :: OS Independent
242
244
  Classifier: Topic :: Scientific/Engineering
@@ -268,7 +270,7 @@ Requires-Dist: shapely>=2.0
268
270
  [![GitHub Tag](https://img.shields.io/github/v/tag/nasa/fmdtools)](https://github.com/nasa/fmdtools/tags)
269
271
  [![CodeFactor](https://www.codefactor.io/repository/github/nasa/fmdtools/badge)](https://www.codefactor.io/repository/github/nasa/fmdtools)
270
272
  [![Tests Status](./reports/full-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/junit/report.html)
271
- [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage/index.html)
273
+ [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage_html/index.html)
272
274
  [![GitHub License](https://img.shields.io/badge/License-Apache%202.0-green)](https://github.com/nasa/fmdtools/blob/main/LICENSE)
273
275
  [![NASA Software Classification](https://img.shields.io/badge/Software_Class-E-blue)](https://nodis3.gsfc.nasa.gov/displayDir.cfm?Internal_ID=N_PR_7150_002D_&page_name=AppendixD)
274
276
 
@@ -355,7 +357,7 @@ This may then be installed using:
355
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.:
356
358
 
357
359
  ```
358
- git checkout v2.0.4
360
+ git checkout v2.0.6
359
361
  ```
360
362
 
361
363
 
@@ -493,8 +495,8 @@ To cite a particular version of the fmdtools, you may use:
493
495
  author = {{NASA}},
494
496
  title = {fmdtools},
495
497
  url = {https://github.com/nasa/fmdtools},
496
- version = {2.0.4}, # <- replace with your version number
497
- date = {2024-10-25},
498
+ version = {2.0.6},
499
+ date = {2024-11-13},
498
500
  }
499
501
  ```
500
502
 
@@ -10,7 +10,7 @@
10
10
  [![GitHub Tag](https://img.shields.io/github/v/tag/nasa/fmdtools)](https://github.com/nasa/fmdtools/tags)
11
11
  [![CodeFactor](https://www.codefactor.io/repository/github/nasa/fmdtools/badge)](https://www.codefactor.io/repository/github/nasa/fmdtools)
12
12
  [![Tests Status](./reports/full-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/junit/report.html)
13
- [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage/index.html)
13
+ [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage_html/index.html)
14
14
  [![GitHub License](https://img.shields.io/badge/License-Apache%202.0-green)](https://github.com/nasa/fmdtools/blob/main/LICENSE)
15
15
  [![NASA Software Classification](https://img.shields.io/badge/Software_Class-E-blue)](https://nodis3.gsfc.nasa.gov/displayDir.cfm?Internal_ID=N_PR_7150_002D_&page_name=AppendixD)
16
16
 
@@ -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.4
100
+ git checkout v2.0.6
101
101
  ```
102
102
 
103
103
 
@@ -235,8 +235,8 @@ 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.4}, # <- replace with your version number
239
- date = {2024-10-25},
238
+ version = {2.0.6},
239
+ date = {2024-11-13},
240
240
  }
241
241
  ```
242
242
 
@@ -157,7 +157,7 @@ class ProduceHazard(Function):
157
157
  class PassStates(State):
158
158
  """Whether or not the hazard is ultimately passed or mitigated."""
159
159
 
160
- hazards_mitigated: int = 0
160
+ hazards_mitigated: int = 0
161
161
  hazards_propagated: int = 0
162
162
 
163
163
 
@@ -185,7 +185,7 @@ class HazardModel(FunctionArchitecture):
185
185
  self.add_flow("hazard", Hazard)
186
186
  self.add_fxn("produce_hazard", ProduceHazard, 'hazard')
187
187
  self.add_fxn("detect_hazard", DetectHazard, 'hazard')
188
- self.add_fxn("pass_hazard", PassHazard, 'hazard')
188
+ self.add_fxn("pass_hazard", PassHazard, 'hazard')
189
189
 
190
190
 
191
191
  if __name__ == '__main__':
@@ -66,10 +66,10 @@ class Mover(Function):
66
66
  # communicate
67
67
  if self.p.x_up != 0.0:
68
68
  self.internal_info.s.x = self.loc.s.x
69
- self.internal_info.send("all", "local", "x")
69
+ self.internal_info.send("all", "x")
70
70
  elif self.p.y_up != 0.0:
71
71
  self.internal_info.s.y = self.loc.s.y
72
- self.internal_info.send("all", "local", "y")
72
+ self.internal_info.send("all", "y")
73
73
 
74
74
  def find_classification(self, scen, fxnhist):
75
75
  return {"last_x": self.loc.s.x, "min_x": fxnhist.faulty.location.get(self.name).x}
@@ -89,8 +89,8 @@ class Coordinator(Function):
89
89
 
90
90
  def static_behavior(self, time):
91
91
  self.coord_view.receive()
92
- self.coord_view.update("local", "mover_1", "y")
93
- self.coord_view.update("local", "mover_2", "x")
92
+ self.coord_view.update("y", to_update="local", to_get="mover_1")
93
+ self.coord_view.update("x", to_update="local", to_get="mover_2")
94
94
 
95
95
 
96
96
  class ExModel(FunctionArchitecture):
@@ -100,7 +100,7 @@ class ExModel(FunctionArchitecture):
100
100
  def init_architecture(self, **kwargs):
101
101
 
102
102
  self.add_flow("communications", Communications)
103
- self.add_flow("location", Location)
103
+ self.add_flow("location", Location)
104
104
  self.add_fxn("mover_1", Mover, "communications", "location", p={"x_up": 1.0})
105
105
  self.add_fxn("mover_2", Mover, "communications", "location", p={"y_up": 1.0})
106
106
 
@@ -86,8 +86,8 @@ class SightGrid(Coords):
86
86
  container_p = DroneEnvironmentGridParam
87
87
 
88
88
  def init_properties(self, *args, **kwargs):
89
- """Set target true between 0 and 150 in the x and 10 and 160 in the y."""
90
- self.set_range("target", True, 0, 150, 10, 160)
89
+ """Set target true between 0 and 155 in the x and 10 and 155 in the y."""
90
+ self.set_range("target", True, 0, 155, 10, 155)
91
91
 
92
92
 
93
93
  class DroneEnvironment(Environment):
@@ -189,12 +189,12 @@ class PlanPathState(State):
189
189
  class PlanPathParams(Parameter):
190
190
  """Defines flightplan."""
191
191
 
192
- goals = ((0.0, 0.0, 50.0),
193
- (100.0, 0.0, 50.0),
194
- (100.0, 100.0, 50.0),
195
- (150.0, 150.0, 50.0),
196
- (0.0, 0.0, 50.0),
197
- (0.0, 0.0, 0.0))
192
+ goals = ((0.0, 0.0, 50.0),
193
+ (100.0, 0.0, 50.0),
194
+ (100.0, 100.0, 50.0),
195
+ (150.0, 150.0, 50.0),
196
+ (0.0, 0.0, 50.0),
197
+ (0.0, 0.0, 0.0))
198
198
 
199
199
 
200
200
  class PlanPathTime(Time):
@@ -391,7 +391,8 @@ class ViewEnvironment(Function):
391
391
  self.dofs.s.x - width/2,
392
392
  self.dofs.s.x + width/2,
393
393
  self.dofs.s.y - height/2,
394
- self.dofs.s.y + height/2)
394
+ self.dofs.s.y + height/2,
395
+ outside_error=False)
395
396
 
396
397
 
397
398
  class Drone(FunctionArchitecture):
@@ -542,6 +543,7 @@ if __name__ == "__main__":
542
543
  from fmdtools.sim.sample import SampleApproach
543
544
  from fmdtools.analyze.phases import PhaseMap
544
545
  from fmdtools import analyze as an
546
+ s = SightGrid()
545
547
  import doctest
546
548
  # doctest.testmod(verbose=True)
547
549
  # script_nominal_viewed()
@@ -111,7 +111,7 @@ class DroneParam(Parameter, readonly=True):
111
111
  phys_param: DronePhysicalParameters
112
112
  """
113
113
 
114
- respolicy: ResPolicy = ResPolicy()
114
+ respolicy: ResPolicy = ResPolicy()
115
115
  flightplan: tuple = ((0, 0, 0), # flies through a few points and back to the start
116
116
  (0, 0, 100),
117
117
  (100, 0, 100),
@@ -164,9 +164,9 @@ class BatState(State):
164
164
  Power transference with nominal value 1.0
165
165
  """
166
166
 
167
- soc: float = 100.0
167
+ soc: float = 100.0
168
168
  ee_e: float = 1.0
169
- e_t: float = 1.0
169
+ e_t: float = 1.0
170
170
 
171
171
 
172
172
  class BatMode(Mode):
@@ -347,7 +347,7 @@ 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}),
350
+ fm_args = {'nocharge': (0.2, 0, {"taxi": 0.6, "move": 0.2, "land": 0.2}),
351
351
  'lowcharge': (0.7, 0, {"taxi": 0.6, "move": 0.2, "land": 0.2})}
352
352
  units = 'hr'
353
353
 
@@ -934,7 +934,7 @@ if __name__ == "__main__":
934
934
 
935
935
  # run approach - all faults in "move" mode
936
936
  mdl = Drone()
937
- app = SampleApproach(mdl, phasemaps=phasemaps)
937
+ app = SampleApproach(mdl, phasemaps=phasemaps)
938
938
  app.add_faultdomain("drone_faults", "all")
939
939
  app.add_faultsample("move_scens", "fault_phases", "drone_faults", "move",
940
940
  phasemap='plan_path', args=(3,))
@@ -351,7 +351,7 @@ class HoldPayloadState(State):
351
351
  Force from the ground
352
352
  """
353
353
 
354
- force_gr: float = 1.0
354
+ force_gr: float = 1.0
355
355
 
356
356
 
357
357
  class HoldPayload(Function):
@@ -94,7 +94,7 @@ class DroneParameterTests(unittest.TestCase):
94
94
  mdl = Drone()
95
95
 
96
96
  sp = SingleFaultScenarioProblem(mdl, ("affect_dof", "rf_propwarp"),
97
- t_start=2.0, track=None)
97
+ sim_start=2.0, track=None)
98
98
  sp.add_result_objective("f1", "plan_path.t.time", time=15)
99
99
  sp.add_result_objective("f2", "dofs.s.x", time=15)
100
100
 
@@ -599,7 +599,7 @@ def script_fault_degradation_tables(**kwargs):
599
599
  """Show fault/degradation tables/plots for a given fault scenario."""
600
600
  mdl = Pump(**kwargs, track="all")
601
601
  endclass, mdlhist = propagate.one_fault(
602
- mdl, 'import_ee', 'no_v', time=29, staged=True)
602
+ mdl, 'import_ee', 'no_v', time=29, staged=True)
603
603
 
604
604
  ks = mdl.get_roles_as_dict("fxn", "flow", flex_prefixes=True)
605
605
  deghist = mdlhist.get_degraded_hist(*ks)
@@ -30,33 +30,42 @@ def close_pool(pool):
30
30
  pool.close()
31
31
  pool.terminate()
32
32
 
33
- def delay_test(delays = [i for i in range(0,100,10)]):
34
- """ Delay parameter use-case described in notebook--here we are using pool.map to manually
35
- simulate the model several times over parameters we want to run."""
33
+
34
+ def delay_test(delays=[i for i in range(0, 100, 10)]):
35
+ """
36
+ Delay parameter use-case described in notebook.
37
+
38
+ Uses pool.map to manually simulate the model several times over parameters we want
39
+ to run.
40
+ """
36
41
  pool = mp.Pool(4)
37
42
  resultslist = pool.map(one_delay_helper, delays)
38
43
  close_pool(pool)
39
44
  return resultslist
40
45
 
46
+
41
47
  def one_delay_helper(delay):
42
- """This helper function is used by pool.map to generate output over the given
43
- input delays"""
48
+ """Generate output over the given input delays."""
44
49
  mdl = Pump(p=PumpParam(delay=delay))
45
50
  endclasses, mdlhists = propagate.one_fault(mdl, 'export_water', 'block')
46
51
  return endclasses
47
52
 
48
- def compare_pools(mdl, app, pools, staged=False, track=False, verbose= True, track_times='all'):
53
+
54
+ def compare_pools(mdl, app, pools, staged=False, track=False, verbose=True,
55
+ track_times='all'):
49
56
  """
50
- Method to compare the performance of different process pools on a given model/fault sampling approach
57
+ Compare the performance for given a model and sampling approach.
51
58
 
52
59
  Parameters
53
60
  ----------
54
61
  mdl : Model
55
62
  fmdtools model
56
63
  app : FaultSample
57
- SampleApproach of fault scenarios to simulate the model over using propagate.fault_sample
64
+ SampleApproach of fault scenarios to simulate the model over using
65
+ propagate.fault_sample
58
66
  pools : dict
59
- Dictionary of parallel/process pools {'poolname':pool} to compare. Pools must have a map function.
67
+ Dictionary of parallel/process pools {'poolname':pool} to compare. Pools must
68
+ have a map function.
60
69
  staged : bool, optional
61
70
  Whether to use staged execution on the model. The default is False.
62
71
  track : str/bool, optional
@@ -67,7 +76,8 @@ def compare_pools(mdl, app, pools, staged=False, track=False, verbose= True, tra
67
76
  Defines what times to include in the history. Options are:
68
77
  'all'--all simulated times
69
78
  ('interval', n)--includes every nth time in the history
70
- ('times', [t1, ... tn])--only includes times defined in the vector [t1 ... tn]
79
+ ('times', [t1, ... tn])--only includes times defined in the vector
80
+ [t1 ... tn]
71
81
 
72
82
  Returns
73
83
  -------
@@ -114,31 +124,36 @@ def parallel_mc(iters=10):
114
124
  close_pool(pool)
115
125
  return res
116
126
 
127
+
117
128
  def parallel_mc2(iters=10):
118
- """run for performance evaluation of model with map function"""
129
+ """Run to evaluate performance of model with map function."""
119
130
  pool = mp.Pool(4)
120
131
  models = [Pump() for i in range(iters)]
121
132
  result_list = pool.map(propagate.nominal, models)
122
133
  close_pool(pool)
123
134
  return result_list
124
135
 
136
+
125
137
  def one_fault_helper(args):
126
- """Helper function for parallel_mc3 to run in pool.map"""
138
+ """Helper function for parallel_mc3 to run in pool.map."""
127
139
  mdl = Pump()
128
140
  endclasses, mdlhists = propagate.one_fault(mdl, args[0], args[1])
129
141
  return endclasses, mdlhists
130
142
 
143
+
131
144
  def parallel_mc3():
132
- """run for performance evaluation of model single fault simulation"""
145
+ """Run for performance evaluation of model single fault simulation."""
133
146
  pool = mp.Pool(4)
134
147
  mdl = Pump()
135
- inputlist = [(fxn,fm) for fxn in mdl.fxns for fm in mdl.fxns[fxn].faultmodes.keys()]
148
+ inputlist = [(fxn, fm) for fxn in mdl.fxns
149
+ for fm in mdl.fxns[fxn].faultmodes.keys()]
136
150
  resultslist = pool.map(one_fault_helper, inputlist)
137
151
  close_pool(pool)
138
152
  return resultslist
139
153
 
154
+
140
155
  def instantiate_pools(cores, with_pathos=False):
141
- """Used to instantiate multiprocessing pools for comparison"""
156
+ """Instantiate multiprocessing pools for comparison."""
142
157
  if with_pathos:
143
158
  from pathos.pools import ParallelPool, ProcessPool, SerialPool, ThreadPool
144
159
  return {'multiprocessing': mp.Pool(cores),
@@ -150,14 +165,18 @@ def instantiate_pools(cores, with_pathos=False):
150
165
  return {'multiprocessing': mp.Pool(cores),
151
166
  'multiprocess': ms.Pool(cores)}
152
167
 
168
+
153
169
  def terminate_pools(pools):
154
170
  """End pools after comparing them."""
155
171
  for pool in pools.values():
156
172
  pool.terminate()
157
173
 
158
174
 
159
- if __name__=='__main__':
160
- mdl=Pump(sp = dict(phases=(('start',0,4),('on',5, 49),('end',50,500)), end_time=500))
175
+ if __name__ == '__main__':
176
+ mdl = Pump(sp=dict(phases=(('start', 0, 4),
177
+ ('on', 5, 49),
178
+ ('end', 50, 500)),
179
+ end_time=500))
161
180
  from fmdtools.sim.sample import FaultDomain, FaultSample
162
181
  fd = FaultDomain(mdl)
163
182
  fd.add_all()
@@ -19,7 +19,7 @@ CONDITIONS OF ANY KIND, either express or implied. See the License for the
19
19
  specific language governing permissions and limitations under the License.
20
20
  """
21
21
 
22
- from examples.pump.ex_pump import MoveWat as DetMoveWat
22
+ from examples.pump.ex_pump import MoveWat as DetMoveWat
23
23
  from examples.pump.ex_pump import ImportWater, ExportWater
24
24
  from examples.pump.ex_pump import ImportEE as DetImportEE
25
25
  from examples.pump.ex_pump import ImportSig as DetImportSig
@@ -214,13 +214,13 @@ if __name__ == "__main__":
214
214
  # print(fxn.return_probdens())
215
215
  # print(getattr(fxn, 'pds', None))
216
216
 
217
- endresults, mdlhist = propagate.one_fault(mdl, 'export_water', 'block',
218
- time=20, staged=False, run_stochastic=False,
219
- new_params={'modelparams': {'seed': 50}})
217
+ endresults, mdlhist = propagate.one_fault(mdl, 'export_water', 'block',
218
+ time=20, staged=False, run_stochastic=False,
219
+ new_params={'modelparams': {'seed': 50}})
220
220
 
221
- endresults, mdlhist = propagate.one_fault(mdl, 'export_water', 'block',
222
- time=20, staged=False, run_stochastic=True,
223
- new_params={'modelparams': {'seed': 50}})
221
+ endresults, mdlhist = propagate.one_fault(mdl, 'export_water', 'block',
222
+ time=20, staged=False, run_stochastic=True,
223
+ new_params={'modelparams': {'seed': 50}})
224
224
 
225
225
  # mdlhist['faulty']['functions']['ImportEE']['probdens']
226
226
 
@@ -67,10 +67,10 @@ class StochasticPumpTests(unittest.TestCase, CommonTests):
67
67
  res_1, hist_1 = prop.nominal(mdl, run_stochastic=True, showprogress=False)
68
68
  res_f1, hist_f1 = prop.single_faults(mdl, run_stochastic=True,
69
69
  showprogress=False)
70
- if seed == None:
70
+ if seed is None:
71
71
  seed = mdl.r.seed
72
72
  mdl2 = Pump(r={'seed': seed})
73
- res_2, hist_2 = prop.nominal(mdl2, run_stochastic=True, showprogress=False)
73
+ res_2, hist_2 = prop.nominal(mdl2, run_stochastic=True, showprogress=False)
74
74
  res_f2, hist_f2 = prop.single_faults(mdl2, run_stochastic=True,
75
75
  showprogress=False)
76
76
  self.assertTrue(all(hist_1.fxns.move_water.s.eff ==
@@ -489,7 +489,7 @@ class PlanPathState(State):
489
489
 
490
490
  u_self: np.array = np.array([0.0, 0.0])
491
491
  u_lin: np.array = np.array([0.0, 0.0])
492
- u_lin_dev: np.array = np.array([0.0, 0.0])
492
+ u_lin_dev: np.array = np.array([0.0, 0.0])
493
493
  rdiff: float = 0.0
494
494
  vel_adj: float = 1.0
495
495
 
@@ -647,7 +647,7 @@ class DriveMode(Mode):
647
647
  self.init_n_faultstates(franges, phases=ph)
648
648
  if "range" in self.mode_args:
649
649
  franges = {"friction": {*np.linspace(0.0, 20, 10)},
650
- "transfer": {*np.linspace(1.0, 0.0, 10)},
650
+ "transfer": {*np.linspace(1.0, 0.0, 10)},
651
651
  "drift": {*np.linspace(-0.5, 0.5, 10)}}
652
652
  if "all" in self.mode_args:
653
653
  self.init_n_faultstates(franges, phases=ph, n="all")
@@ -668,7 +668,7 @@ class DriveMode(Mode):
668
668
 
669
669
  def add_n_modes(self, ph):
670
670
  franges = {"friction": {*np.linspace(0.0, 20, 10)},
671
- "transfer": {*np.linspace(1.0, 0.0, 10)},
671
+ "transfer": {*np.linspace(1.0, 0.0, 10)},
672
672
  "drift": {*np.linspace(-0.5, 0.5, 10)}}
673
673
  self.init_n_faultstates(franges, n=self.mode_args, phases=ph)
674
674
 
@@ -149,8 +149,8 @@ class GuideLiquidOut(GuideLiquid):
149
149
 
150
150
 
151
151
  class StoreLiquidState(State):
152
- level: float = 10.0
153
- net_flow: float = 0.0
152
+ level: float = 10.0
153
+ net_flow: float = 0.0
154
154
 
155
155
 
156
156
  class StoreLiquidMode(Mode):
@@ -419,11 +419,15 @@ if __name__ == '__main__':
419
419
  import fmdtools.sim.propagate as propagate
420
420
  from fmdtools.sim.sample import FaultDomain, FaultSample
421
421
 
422
- mdl = Tank()
422
+ mdl = Tank(track='all')
423
423
 
424
424
  endclass, mdlhist = propagate.one_fault(mdl, 'human', 'look_not_visible', time=2,
425
425
  staged=True)
426
426
 
427
+ from fmdtools.define.architecture.function import FunctionArchitectureGraph
428
+ mg = FunctionArchitectureGraph(mdl)
429
+ fig, ax = mg.draw_from(10, mdlhist)
430
+
427
431
  # nominal run
428
432
  endresults, mdlhist = propagate.nominal(mdl, desired_result=['endclass', 'graph'])
429
433
  mdlhist.plot_line("fxns.store_water.s.level")
@@ -25,7 +25,7 @@ CONDITIONS OF ANY KIND, either express or implied. See the License for the
25
25
  specific language governing permissions and limitations under the License.
26
26
  """
27
27
 
28
- from common import default_air_loc, AssetParams, Location, Requests, Environment
28
+ from common import AssetParams, Location, Requests, Environment
29
29
 
30
30
  from fmdtools.define.container.state import State
31
31
  from fmdtools.define.container.mode import Mode
@@ -33,7 +33,6 @@ from fmdtools.define.container.time import Time
33
33
  from fmdtools.define.block.function import Function
34
34
 
35
35
  from shapely.geometry import Point, Polygon
36
- from shapely.ops import nearest_points
37
36
  import numpy as np
38
37
 
39
38
 
@@ -73,7 +72,7 @@ class Asset(Function):
73
72
  self.perc_requests.s.put(asset_req="land")
74
73
  atc_requests.s.assign(self.perc_requests.s, as_copy=True)
75
74
 
76
- self.perc_requests.update("atc", "local", "asset_req")
75
+ self.perc_requests.update("asset_req", to_update="atc", to_get="local",)
77
76
 
78
77
  self.perc_location = self.location.create_local("percieved", s=self.location.s)
79
78
 
@@ -189,7 +188,7 @@ class Asset(Function):
189
188
  self.perc_requests.s.put(asset_req="none")
190
189
  def send_perception(self):
191
190
  self.perc_location.s.assign(self.location.s)
192
- self.perc_requests.send('atc', 'local', 'asset_req')
191
+ self.perc_requests.send('atc', 'asset_req')
193
192
  def determine_visioncov(self, xd, yd):
194
193
  """
195
194
  Creates the polygon corresponding to the asset's vision cone.
@@ -265,7 +264,7 @@ class Asset(Function):
265
264
  colassets[i] = local_pos.distance(assetpos)
266
265
  if len(colassets) > 0:
267
266
  asset = min(colassets, key=colassets.get)
268
- assetloc = getattr(self.location.glob, asset)
267
+ assetloc = getattr(self.location.glob, asset)
269
268
  distance = colassets[asset]
270
269
  if in_vision and assetloc:
271
270
  self.closest_location.s.assign(assetloc.s)
@@ -66,7 +66,7 @@ class LoadingForAircraft(Function):
66
66
 
67
67
  self.perc_requests.clear_inbox()
68
68
 
69
- self.perc_requests.send("ma1", "local", "atc_com", "route")
69
+ self.perc_requests.send("ma1", "atc_com", "route")
70
70
 
71
71
 
72
72
  class test_aircraft_model(FunctionArchitecture):
@@ -115,7 +115,7 @@ class LoadingForHeli(Function):
115
115
  self.ground.s.asset_assignment["h1"] = "air_loc"
116
116
  # update area allocation for route??
117
117
  self.perc_requests.clear_inbox()
118
- self.perc_requests.send("h1", "local", "atc_com")
118
+ self.perc_requests.send("h1", "atc_com")
119
119
 
120
120
 
121
121
  class test_heli_model(FunctionArchitecture):
@@ -241,7 +241,7 @@ class AssetTests(unittest.TestCase):
241
241
  self.two_ac_model,
242
242
  fhist,
243
243
  76,
244
- fxnattr="visioncov",
244
+ fxnattr="s.visioncov",
245
245
  assets_to_label=["ma1"],
246
246
  title="ma1 approaches ma2 with no vision cone",
247
247
  )
@@ -249,7 +249,7 @@ class AssetTests(unittest.TestCase):
249
249
  self.two_ac_model,
250
250
  fhist,
251
251
  77,
252
- fxnattr="faults",
252
+ fxnattr="m.faults",
253
253
  assets_to_label=["ma1"],
254
254
  title="ma1 crashes into ma2 (should show faults)",
255
255
  )
@@ -22,6 +22,6 @@ import fmdtools.sim as sim
22
22
  import fmdtools.analyze as analyze
23
23
 
24
24
  __all__ = ['analyze', 'sim', 'define']
25
- __version__ = '2.0.4'
25
+ __version__ = '2.0.6'
26
26
  __copyright__ = "Copyright 2024 United States Government"
27
27
  __license__ = "Apache-2.0"