[Manure] Adds option for partial emptying of manure storages - #3246
matthew7838 wants to merge 24 commits into
Conversation
787af15 to
80410fd
Compare
80410fd to
d5da787
Compare
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1136 |
|
🚨 Please update the changelog. This PR cannot be merged until |
# Conflicts: # README.md # input/data/end_to_end_testing/open_lot/e2e_json_manure_filter.json
…ter merge Dev split unreleased entries into changelog_WIP.md, so the PR 3246 entry moves out of the released v1.0.5 section of changelog.md. Both dev and this branch regenerated the open_lot manure expected results, so the conflicting anaerobic lagoon values are taken from a fresh run on the merged code; all non-lagoon values stay at dev's baseline.
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1167 |
Passes the StorageCover enum instead of its string value, and narrows the optional storage time period before arithmetic.
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1164 |
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1164 |
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1164 |
|
Current Coverage: 99% Mypy errors on manure-partial-empty branch: 1164 |
Adds an optional
emptying_fractioninput to manure storage configs so storages can be partially emptied, and fixes partial-emptying routing so the emptied manure (not the retained manure) is what leaves the storage.Context
Issue(s) closed by this pull request: closes #2963
Related: #3228 plans to treat the
Manure.Storage.*emptied_manure_*outputs as sold manure in the economics module. This PR keeps those outputs consistent for that use: at every emptying event, theemptied_*variables report exactly the manure removed from the storage, whether the emptying is full or partial.What
emptying_fraction(0.0-1.0): the fraction of stored manure removed at each scheduled emptying event. Supported by all storage types exceptDailySpread. Omitted, behavior is unchanged (full emptying; anaerobic lagoons keep their default sludge retention).Storage.process_manure()returned the retained stream for downstream routing instead of the emptied stream, so the emptied manure vanished from the processor chain and the retained manure was duplicated (kept in storage and passed downstream). Currently this affected anaerobic lagoons, which empty fractionally by default.Why
Users have asked to simulate manure storages that are not fully emptied (X% emptied per emptying interval, #2963). The
_emptying_fractionhook added in #2638 already splits the stored manure but was not user-configurable. The routing fix is also a prerequisite for #3228: "emptied = sold" only holds if the emptied stream is what actually leaves the storage.How
Storage.__init__acceptsemptying_fractionand validates it to [0.0, 1.0] at initialization; the_emptying_fractionproperty returns the configured value when provided, otherwise the class default (1.0; anaerobic lagoons:1 - ANAEROBIC_LAGOON_MANURE_RETENTION). All storage subclasses exceptDailySpreadpass the parameter through.Storage.process_manure()now returns the emptied stream for routing to connected processors; the retained stream stays instored_manure.emptying_fractionto the storage properties inRUFAS/input/metadata/properties/default.json, range-checked during input validation.accumulated_*andstorage_methaneare computed on the emptied stream (day 364; values increase ~9x since the lagoon empties 90%).emptied_manure_*values are unchanged.Test plan
Storage.process_manureassert the emptied stream is reported and returned while the retained stream stays stored; init-time validation of out-of-range fractions; lagoon default retention vs. configured override.InputManagerrun on a modified open_lot config:emptying_fraction: 0.4loads and reaches the constructed storage;1.5is rejected at input validation.emptying_fraction: 0.4andstorage_time_period: 10: on every emptying day the emptied mass and nitrogen are exactly 0.4 of the stored amount, the retained 0.6 stays in storage, and day-over-day storage balance holds.manure_typedictionary-item-added failure that reproduces identically on plain dev (verified in a clean dev worktree), so it is pre-existing and unrelated to this change; its recorded expected results are untouched by this PR.Input Changes
emptying_fractionkey for storage configs in themanure_managementinput (all storage types exceptDailySpread). Existing inputs are unaffected.Output Changes
Manure.Storage.*.accumulated_*andManure.Storage.*.storage_methanereflect the emptied stream instead of the retained stream. Only storages with fractional emptying are affected - currently anaerobic lagoons, once perstorage_time_period.Filter
{ "name": "lagoon_emptying", "filters": ["Manure.Storage.AnaerobicLagoon.*"] }