Repository navigation
One discounted EAC of age replacement; value_plan takes a unit's plan - #502
Merged
Merged
Conversation
maintenance._options.cycle_eac is the one equivalent annual cost of age replacement at a discount rate (Fox, 1966), with every category of a unit's own (failure and planned prices, its downtime over repairs and planned work that take time). NonRepairable's discounted optimum and run to failure and a diagram component's node_eac take it; the shared arithmetic is the old two's, so no value changes. value_plan takes UnitPlan.to_dict() as its diagram, valued as the plan's one-node diagram; the npv-1 schema says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One EAC. The equivalent annual cost of age replacement at a discount rate (Fox, 1966) is now defined in one place:
maintenance._options.cycle_eac. It covers every cost category that belongs to the unit itself: the failure price, the planned price, and the unit's downtime during repairs and during planned work that takes time.Before this change,
NonRepairable's discounted optimum and run to failure (_cycle_valueanddiscounted_run_to_failure) and a diagram component'srbd._discounted_long_run.node_eaceach had their own copy of this formula. All of them now callcycle_eac. The shared function keeps the old arithmetic operation for operation, so no value changes. The tests of every caller pass with their reference values unchanged.value_plan takes plans.
value_plannow acceptsUnitPlan.to_dict()as its"diagram"and values it as the plan's one-node diagram. Thenpv-1.jsonschema description says so.Type of change
Checklist
Tests added.
test_one_eac.py:cycle_eacagainst Fox's closed form for an exponential life;node_eacand the part's discounted optimum and run to failure againstcycle_eac;test_value_plan.pygains a test that a plan's document is valued as its diagram.black, isort and flake8 on the changed files, and mypy on the changed modules. Tests run (one process):
test_one_eac,test_value_plan,test_discounted_long_run,test_npv_intervalsandtest_exact_or_horizon(81 passed), plus the doctests of the three changed modules.CHANGELOG.mdupdatedMonte-Carlo tests are seeded (none added)
Notes for reviewers
These are still separate: the diagram's shutdown dicts versus
Opportunities, and bracketed discounting in the calendar'sfailures_by_period. Neither is part of this change.Generated by Claude Code