DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use ChnCalculate in a Worker Script

Can I use ChnCalculate in a Worker script?  I like that I can do channel manipulations in my master application like "LocalWorker.MasterApplication.Data.Root..." but can I use ChnCalculate for channels in my Master Application within my worker script?

0 Kudos
Message 1 of 2
(2,775 Views)

Hi Julia,

 

I haven't tried this in a worker myself, but if you have Data.Root access to the master's Data Portal, then I would expect the method of passing channel objects to the newer Calculate() command should work:

 

Set MasterGroup = LocalWorker.MasterApplication.Data.Root.ChannelGroups(1)
Set NewMasterChannel = MasterGroup.Channels.Add("Power", DataTypeChnFloat64)
MasterChannels = Array(NewMasterChannel, MasterGroup.Channels(3), MasterGroup.Channels(4))
Symbols = Array("Power", "RPM", "Torque")
Call Calculate("Power = RPM*Torque*2*Pi/60", Symbols, MasterChannels)

 

BTW, ChnFind() now also accepts channel objects,

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 2
(2,725 Views)