=95.6 and X<=100,Z*(X*0.0455-4.15),null)" 'msgbox formulasymbols="array("X","Y","Z")Call" data.root.channelgroups("excessfuel").channels.add("prod5",datatypechnfloat64)redim binchannels(2)set binchannels(0)="Data.Root.ChannelGroups("ExcessFuel").Channels("OilCmbdSen_tSnsr")Set" binchannels(1)="Data.Root.ChannelGroups("ExcessFuel").Channels("Prod5")Set" binchannels(2)="Data.Root.ChannelGroups("ExcessFuel").Channels("massoffuelinoil")Call" calculate(formula,symbols,binchannels)end if you would have any idea about the option read in values through excel please let me know. appriciate your help. jan ">

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

09-06-2017 04:27 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi,

I have got two channels, for the sake of simplicity lets call them x (1 to 10 with increments of 1) and y(20 to 30 with increments of 1) with the same length.

What I would like to do is to go through channel x, look what at each instant corresponding value of channel y is and depending on that multiply channel x with factor and create new channel with this results.

I was thinking that the easiest way would be to create table in excel, but then I am lost in how to script it in DIAdem to be able to read the table and get the result.

Any idea would be very helpful.

Solved! Go to Solution.

09-21-2017 06:28 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi JanSantora,

It sounds like you have two questions. First, how to import/create the data channels you want in DIAdem, and the second, how to conditionally multiply them to create a third channel in DIAdem. The example of the two channels you mentioned would be easy to construct by hand in DIAdem VIEW, just like you would create them in Excel. But I'm guessing you want to perform this on data that you have stored some place. What file format is that data in that you want to perform this conditional, row-by-row analysis on?

Also, what exactly does each row's multiplication "depend on"? If you can express the logic you have in mind, I can send you the Channel Calculator syntax that performs that analysis with optimal speed.

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Highlighted
Options

09-22-2017 05:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Brad,

Thank you for your reply.

What I have done was wrote a script which will read arrays and than made a formula for interlpolation. But what I would prefer if it can go through Excel file which would have x axis values, y axis values, and z axis values. Similar to lookup table.

Here is the script I have done using arrays.:

Dim formula,symbols,binchannels

Dim TemperatureArray,FactorArray,tempFactor

TemperatureArray = Array(95.6,100,106.7,114.9,123.8,138.1)

FactorArray = Array(0.6,0.8,0.9,1,1.1,1.2)

Dim i

formula = ""

For i = 0 to uBound(TemperatureArray)-1

TempFactor = (FactorArray(i+1) - FactorArray(i))/(TemperatureArray(i+1)-TemperatureArray(i))

formula = formula & "iif(X>=" & TemperatureArray(i) & " and X<=" & TemperatureArray(i+1) & ",Z*(X*" & TempFactor & " - " & Tempfactor * TemperatureArray(i) - FactorArray(i) & "),0) + "

next

Formula = "Y=" & left(formula,len(formula)-3)

'formula = "Y=iif(X>=95.6 and X<=100,Z*(X*0.0455-4.15),null)"

'msgbox formula

Symbols = array("X","Y","Z")

Call Data.Root.ChannelGroups("ExcessFuel").Channels.Add("Prod5",DataTypeChnFloat64)

Redim Binchannels(2)

Set BinChannels(0) = Data.Root.ChannelGroups("ExcessFuel").Channels("OilCmbdSen_tSnsr")

Set BinChannels(1) = Data.Root.ChannelGroups("ExcessFuel").Channels("Prod5")

Set BinChannels(2) = Data.Root.ChannelGroups("ExcessFuel").Channels("massoffuelinoil")

Call Calculate(formula,symbols,binchannels)

end If

If you would have any idea about the option to read in the values through excel please let me know.

I appriciate your help.

Jan

09-22-2017 09:48 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Jan,

The best way to read values from an Excel file is to create a DataPlugin for that type of Excel file. The other option is to read in values using Excel's ActiveX calls in VBScript.

Could you send me a sample Excel file that has those parallel arrays (lookup table) arranged the way you would like it to be in Excel? I can then send you a DataPlugin and the VBScript code to call it.

This will address the first issue I mentioned above. It looks like from your posted VBScript code that you don't need help with the second issue I mentioned above.

Brad Turpin

DIAdem Product Support Engineer

National Instruments

09-25-2017 01:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Brad,

Thank you for your reply, please find attached sample excel file with the 3d table.

Jan

Solution

Accepted by topic author JanSantora

09-26-2017 01:30 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Jan,

Here is a DataPlugin that reads the values from the one Excel file you sent me into DataPortal channels in a structure DIAdem calls "Matrix" orientation, which is ready for 3D display or analysis.

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Solution

Accepted by topic author JanSantora

09-27-2017 02:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Brad,

Thanks for your reply.

Unfortunately after loading the excel file with the DataPluging gives me an error.

Error attached.

Many thanks

Jan

09-27-2017 03:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Brad,

I am sorry I loaded something else. It is working now.

Once again, many thanks.

Jan

09-27-2017 03:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Brad,

Now I can load the excel file with the help of your dataplugin.

What I would like to do now is to go through two channels and depending on the values link it to the table and multiply other channel with the value which the look up table will get (depending on the two values from the two channels).

Is that even possible?

Many thanks for your help, highly appreciated.

Jan

09-27-2017 01:51 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi Jan,

I'm struggling with your terminology. You say you would like to "go through 2 channels". The DataPlugin I sent you loads from the Excel file you sent me 11 different channels. Which 2 are you referring to here?

You also talk about "other" channel. Can you please refer to the channels by the name that the DataPlugin loads them with into the Data Portal? I don't know which "other" channel you mean.

Finally, you refer to "the value which the look up table will get". I thought we loaded the channels from the Excel file in order to have the look up table in DIAdem? If so, which channels in DIAdem are the look up table?

Brad Turpin

DIAdem Product Support Engineer

National Instruments