time-series in Ruby

0 views
Skip to first unread message

Jason

unread,
May 6, 2008, 2:47:38 PM5/6/08
to Water Resources Engineering
Question for you about general time-series issues.

I've got a Ruby class put together that spits out an array of either
time increments [1,2,3,...] or dates [10-1-2007, 10-2-2007, ...] using
inputs of start time, duration, and timestep length. I started
thinking about how to integrate this with a simple subroutine like
calculate demand with a monthly demand pattern and ran into a
question.

Do you think it is appropriate to specify demand pattern by iteration
like this? (note I'm using a horrible form of psudo code):

define demand pattern array (or hash) => dmd = [jan = 0.1, feb =
0.12, ...]
for i in years do {
if d.month == "jan" then
dmd[0]
if d.month == "feb" then
dmd[1]
etc.
} #iterate through each year

'd.month' is known by referencing my handy time-series class I
mentioned at the beginning.

This brings up the really big question: This is much simpler than what
discrete event and coninuous simulation modeling systems do (like
AnyLogic). If I continue down this path of creating time-series files
using these simpleton methods, am I going to suddenly hit a
performance wall or other bad issue?

This is what I've seen in a FORTRAN water rights model, so at least
I'm not the only one...
Reply all
Reply to author
Forward
0 new messages