05-11-2011 03:58 PM
I am trying to perform a calculation for peak sun hours in DIAdem that we typically perform in Excel. Any advice on how to approach this calculation in the DIAdem environment much appreciated.
Solved! Go to Solution.
05-13-2011 12:49 PM
Hi moses montoya,
I was able to recreate the Peak Sun Hours data with the following script.
Dim PeakSun, intLoop
PeakSun = ChnAlloc("Peak Sun Hours")
Data.Root.ChannelGroups(1).Channels("Peak Sun Hours").Values(1) = 0
For intLoop = 2 to (Data.Root.ChannelGroups(1).Channels("Channel 2").Size - 1)
Data.Root.ChannelGroups(1).Channels("Peak Sun Hours").Values(intLoop) = Data.Root.ChannelGroups(1).Channels("Peak Sun Hours").Values(intLoop - 1) _
+ (Data.Root.ChannelGroups(1).Channels("Channel 1").Values(intLoop) - Data.Root.ChannelGroups(1).Channels("Channel 1").Values(intLoop - 1)) * 24 / 1000 _
* Data.Root.ChannelGroups(1).Channels("Channel 2").Values(intLoop)
Next
Channel 1 was the time, and Channel 2 is the irradiance.
Regards,
Brandon V.
Applications Engineering
National Instruments
05-13-2011 05:03 PM
Brandon,
This did the trick and gave me some pointers on how to deal with some of our legacy Excel files.
Thanks for your help!
-mm
05-13-2011 05:25 PM
Hello moses montoya,
Anytime! I'm glad it worked for you.
Regards,
Brandon V.
Applications Engineering
National Instruments