Recording Maximum Values


Recommended Posts

There are different ways, depending on whether you have the history for the max range you want. If, for example, you want the daily max, and your history is long enough to cover that period, you can just do:

max(windSpeed[0h,systime()])

to get the time of that max, just do:

getTime(max(windSpeed[0h,systime()]))

If, however, you want, say daily, weekly and monthly maxes, you'll need a variable to store each, initialized to some unattainable minimum (say -1 for wind speed). Then in the event for the windspeed channel, do something like:

if (windSpeed[0] > dailyMaxWindSpeed)
   dailyMaxWindSpeed = windSpeed[0]
endif

You can then display that variable anywhere, and to get the time, again use getTime(dailyMaxWindSpeed).

To reset, just set dailyMaxWindSpeed to -1 again. To do that at the end of the day, do something like before the above script:

if (formatDateTime("%d", windSpeed.time[0]) != formatDateTime("%d", windSpeed.time[1]))
   dailyMaxWindSpeed = -1
endif

Use %W for weekly, %m for monthly. Note that these values will reset if you restart DF.

Link to comment
Share on other sites

  • 1 month later...

After a few weeks of illness I have tried these suggestions and do not get very far. I created a variable box for the gust speed, and entered the expression into the expression box exactly as you indicated. it placed a number into the box which promptly became static despite changing wind speed. I also created a time box using your suggestion, which again did the same thing.

Have I put the correct values in the proper places please or is there more to do? I also need to convert the time to Windows format but that may well have to wait until the gust measurement is solved.

Thanks once again.

Mike

Link to comment
Share on other sites

I managed to get the recording maximum value, once I had checked the syntax and discovered a missing bracket.

However, i am still struggling to get the time number converted to a standard date format. The date is recorded in a long number, but I need to make it understandable.

I have been experimenting with FormatDateTime() but cannot find the right place/syntax for it. I have looked in the manual and it indicates I should use %c to convert to "Windows" time. I have tried allocating the MaxGust to a defined variable T$, but got nowhere with that. Any pointers please on syntax? I am including this in the Expression of a Variable Value Component.

Thanks

Best wishes

Mike

PS ctl attachedSolar.ctl

Link to comment
Share on other sites

Its simply:

formatTime("%c", getTime(Max(Wind_Speed[0h,SysTime()])))

I'm not really sure what you were doing. First, T$ is not a valid DAQFactory name. Second, the variable value takes an Expression. An Expression is something that would exist on the right side of an = sign. You put a statement. A statement is a line of script, and in your case, includes the = sign.

Also, you have max(Wind_speed(0)[0h,systime()])

this is incorrect subsetting. Drop the (0)

Link to comment
Share on other sites

Most internal functions are listed at the end of the Expressions chapter of the user's guide. Object specific functions (i.e. system functions, channel functions, component functions, etc) are described with the object, system functions at the end of the Sequences chapter I believe.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.