|
OLE automation demo |
Top Previous Next |
|
The following VisualBasic code shows the control of a simple distributed computing simulation with SPRAY. Please read the comments that explain what happens.
Sub dc_test() Dim nr As Long Dim seconds, signal As Single
' Create the SPRAY Ole server Set spray = CreateObject("Spray99.Spray_Remote")
' Load the configuration spray.load_configuration = "c:/temp/dc_test/dc_test.s99" ' Show SPRAY spray.Show
' Switch off Excel warnings ' this avoids the popup message that Excel waits for another application ... DisplayAlerts = False
' Set the number of rays per spectral point spray.photons = 10000 ' Set the number of rays per task spray.dc_rays_per_task = 20000
' Start the distributed computing simulation spray.start_dc_computation
' Wait loop: spray.status is >=0 during the simulation and <0 when the job is finished nr = spray.Status While nr >= 0 ' wait for 3 seconds Application.Wait Now + TimeSerial(0, 0, 3) ' ask SPRAY again nr = spray.Status Wend
' get the time SPRAY needed for the last simulation seconds = spray.seconds_last_run ' Now you should pick up the results ... '. '. '.
' Delete the SPRAY ole server Set spray = Nothing
End Sub
|