Add reconstruction unit tests#128
Add reconstruction unit tests#128HenryGeorgist merged 19 commits intoUSACE:reconstruction-lifecyclefrom
Conversation
HenryGeorgist
left a comment
There was a problem hiding this comment.
This was great. im asking you to remove files from the commit history that are not directly needed for the tests. i think that there are about 12 files currently included in this, we probably need only about 3 or 4 files total for this to be complete. lets make sure we only are changing those (to minimize our chances for accidentally checking in something we dont want to change)
| t2 := time.Date(1984, time.Month(1), 11, 0, 0, 0, 0, time.UTC) // reconstruction from event 1 should be 50% complete at this time | ||
| d2.SetArrivalTime(t2) | ||
|
|
||
| events := []hazards.HazardEvent{d1, d2} |
|
@HenryGeorgist I think I have removed all the edits to files that aren't involved in this PR. |
|
@HenryGeorgist this implementation now keeps track of structure/content values and the overall damage level throughout the series of events. When a new event arrives, we first calculate how much of the total damage (not just from the previous event) has been repaired since the last event ended. Then we calculate loss by applying the damage function to the adjusted structure value. Finally we calculate reconstruction time and completion date based on the total current damage state not just the loss from the current event. |
| panic(err) | ||
| } | ||
| //compute consequences. | ||
| StreamAbstract(dfr, nsp, w) |
There was a problem hiding this comment.
ismt it cool that we get such robustly different behavior out of streamabstract when we leverage the abstractions!
| process HazardFunction | ||
| } | ||
|
|
||
| type ADDProperties struct { // will try to not use this |
There was a problem hiding this comment.
my first response was why not just use a csv... but json is fine it really doesnt matter. You could also just randomly generate this information or hard code in the list of events for this level of testing we are currenly working on.
| "github.com/USACE/go-consequences/hazards" | ||
| ) | ||
|
|
||
| type jsonArrivalDepthDurationMultiHazardProvider struct { |
There was a problem hiding this comment.
using cogs at this point is overkill
This PR adds two functions to the
structuresmodule.computeConsequencesWithReconstruction()calculates the number of days to complete construction on a damaged structure and includes this in the resultTestComputeConsequencesWithReconstruction()computeConsequencesMulti()calculates the number of days and final date to complete reconstruction for an array of hazard events.TestComputeConsequencesMulti()