From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Create X-Y plots with repeating X channel

Solved!
Go to solution

I'm trying to create Pressure and Volume plots for cylinder pressure data. 

 

The pressure data comes in with 216,000 data points (720 samples over 300 engine cycles)

 

The volume data comes in with only 720 samples.  The volume simply repeats every 720 degrees, and doesn't change. (Think of it as simply 2 cycles of a sine wave). 

 

What is the best way to plot this x-y data?  I'm looking for speed.  Does Diadem have a "block mode" where it recognizes that every 720 samples of the pressure data corresponds with the volume data? Or should I simply extend the 720 samples of volume data out 300 times? Seems like that would be slow. 

0 Kudos
Message 1 of 6
(2,973 Views)
Solution
Accepted by topic author RussellSenior

Hi RussellSenior,

 

To plot the pressure data against the volume data, both channels must have the same length. Therefore you can extend the volume channel and append for each cycle the 720 samples. Please have a look at the script (which takes on my PC 0.1 sec.):

 

dim iLoop, iNoOfCycles, oChnSource, oChn

iNoOfCycles     = 300
set oChnSource  = Data.Root.ChannelGroups(1).Channels("Test")
set oChn        = Data.Root.ActiveChannelGroup.Channels.Add("NewChn",DataTypeChnFloat64)

oChn.ReservedSize = iNoOfCycles * oChnSource.Size
for iLoop = 1 to iNoOfCycles
  call oChn.SetValuesBlock(oChnSource.GetValuesBlock(1, oChnSource.Size, eValueBlockVbArray) ,oChn.Size + 1, eValueBlockValueInsert)
next

Greetings

Walter

Message 2 of 6
(2,952 Views)

SetValuesBlock appears to be a Diadem 2015 addition, yes?  I'm still on 2014, since my add-on is not yet compatible with 2015's bar manager.  So, am I stuck with DataBlCopy until I finally update to 2015?  

0 Kudos
Message 3 of 6
(2,937 Views)
Solution
Accepted by topic author RussellSenior

Hi Russell,

 

You can use the old DataBlCopy() command instead.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 4 of 6
(2,935 Views)

Thanks!  

 

On the same vein, if I am plotting 300 cycles of engine data on a P-V plot, how could I view only one cycle, or a block of data?  Say I want to view cycle 45, so I would like to view only samples 32,400 through 33,120 on both the pressure (y-axis) and volume (x-axis) plots?

0 Kudos
Message 5 of 6
(2,930 Views)

HI Russell,

 

I'm afraid the only solutions are to scale the X axis to just that value range or to extract that value range from the X and Y channels and put them into new, much smaller Xcyc and Ycyc channels that you then plot.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 6
(2,922 Views)