You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
This PR implements the Vensim DEPRECIATE STRAIGHTLINE function as required in #258.
The C implementation is similar to FIXED DELAY. It uses a ring buffer to accumulate contributions from an input stream uniformly spread over a depreciation time. Unlike FIXED DELAY, which is a special kind of level, DEPRECIATE STRAIGHTLINE is an aux variable. The implementation assigns a variable subtype of depreciation to trigger special handling in code gen. Also unlike FIXED DELAY, it is necessary to initialize the ring buffer values to zero, because the buffer contents will start to be emitted on the very first time step. (The FIXED DELAY buffer has to fill up first before emitting any data.)
A new depreciate test model demonstrates the function.
The fisc fiscal period argument is not supported in this implementation.
The reason will be displayed to describe this comment to others. Learn more.
@ToddFincannonEI: This all looks like a clean addition to me, thanks.
Re: this comment in the PR description:
The fisc fiscal period argument is not supported in this implementation.
I think it would be good to have a table in the README (or somewhere in the docs) that lists out all the supported Vensim functions along with any per-function limitations/caveats. I just filed #265 today to track improvements I've been wanting to make to the README and docs in general, so assuming I add that table of supported functions as part of that work, I can include a note about fiscal period being unimplemented at this time.
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.
Fixes #258
This PR implements the Vensim
DEPRECIATE STRAIGHTLINE
function as required in #258.The C implementation is similar to
FIXED DELAY
. It uses a ring buffer to accumulate contributions from an input stream uniformly spread over a depreciation time. UnlikeFIXED DELAY
, which is a special kind of level,DEPRECIATE STRAIGHTLINE
is an aux variable. The implementation assigns a variable subtype ofdepreciation
to trigger special handling in code gen. Also unlikeFIXED DELAY
, it is necessary to initialize the ring buffer values to zero, because the buffer contents will start to be emitted on the very first time step. (TheFIXED DELAY
buffer has to fill up first before emitting any data.)A new
depreciate
test model demonstrates the function.The
fisc
fiscal period argument is not supported in this implementation.