DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel calculation in DIAdem for Peak Sun Hours

Solved!
Go to solution

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.

0 Kudos
Message 1 of 4
(4,697 Views)
Solution
Accepted by topic author moses_montoya

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

www.ni.com/support

Message 2 of 4
(4,678 Views)

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

0 Kudos
Message 3 of 4
(4,670 Views)

Hello moses montoya,

 

Anytime!  I'm glad it worked for you.

 

Regards,

 

Brandon V.

Applications Engineering

National Instruments

www.ni.com/support

 

 

0 Kudos
Message 4 of 4
(4,668 Views)