Bug 1216

Summary: RvBatteryModel segfalts if the update event happens before load changes
Product: ns-3 Reporter: Claudio <claudio-daniel.freire>
Component: energyAssignee: Cristiano Tapparello <cristiano.tapparello>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Mercurial patchset. Import with "hg import <patchfile>"

Description Claudio 2011-07-13 11:10:05 EDT
Created attachment 1198 [details]
Mercurial patchset. Import with "hg import <patchfile>"

Fix RvBatteryModel: it could cause segfaults at some times, if somehow Discharge() was called with an empty m_timeStamps (ie, if the energy model update event happened before load changes)

I found this condition when running benchmarks (repeated execution of tests), so it's not an impossible path.

The modified logic, also, is independent of at what timestamp the simulator starts processing model changes (ie, a model that is assigned in the middle of the simulation would have its DoStart method called at non-zero time).
Comment 1 Cristiano Tapparello 2015-04-30 18:32:50 EDT
Used the patch for updating the RV Battery Model behavior.