06-01-2017 11:49 AM
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?
06-02-2017 07:50 AM - edited 06-02-2017 07:50 AM
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