DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

trouble changing DATA_3DR real-time plot to DATA_3DS

 
Post new topic   Reply to topic    DPlot Forum Index -> Basic
View previous topic :: View next topic  
Author Message
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Thu Feb 18, 2016 12:10 pm    Post subject: trouble changing DATA_3DR real-time plot to DATA_3DS Reply with quote

Hi David,

I am currently streaming live data to a DPLOT windows to create a 3DR contour surface (shaded band). My code is somewhat based on example BTEST3. It works well, but as more data is added, the more time it takes to draw the surface.

I think a simple solution for me is to just draw a scatter plot in real-time instead, then convert it to shaded band (add surface) after completion.

I thought I could just replace this line which works fine
Code:
ret = DPlot_AddData(DocNum, DATA_3DR, ptctr, 1, j, Zout(0))

with this line
Code:
ret = DPlot_AddData(DocNum, DATA_3DS, ptctr, 1, j, Zout(0))

but it doesn't work as expected. The function returns -16395 the first time, then returns -16390 for every cycle afterwards.

I am first creating a blank plot with
Code:
DocNum = DPlot_Command(0, "[FileNew(3)]")


Using Evisive branded version 2.3.2.7
Any suggestions?
thanks.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sat Feb 20, 2016 2:41 pm    Post subject: Reply with quote

Mike,
Unfortunately DPlot_AddData will only work for adding points to an existing 3D scatter plot. And there is not a way to create a blank document set up to accept DATA_3DS points. FileNew(3), for example, creates an empty plot set up to receive random 3D points for a surface plot.

The only way at present to make DPlot_AddData work with a 3D scatter plot is to first create a document (using DPlot_Plot or whatever) with 3D scatter plot points, and then use DPlot_AddData for additional points.

I need to add a new setting for FileNew to create a blank 3D scatter plot document.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Sat Feb 20, 2016 3:40 pm    Post subject: Reply with quote

Using DPlot_Plot can I set up an empty plot with zero data points? If not, I suppose I can create a new plot with one data point at (0,0)? I have some confusion on DPLOT structure regarding maximum number of data points. Do you have a real-time example using scatter plot? Any language would suffice.
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sun Feb 21, 2016 12:39 am    Post subject: Reply with quote

Yes, I do have an example. But this is now moot. I've changed the FileNew command to include support for creating an empty 3D scatter plot, and DPlot_AddData will now work as expected.

I'll e-mail you with a link to an updated EVImage tomorrow.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Sun Feb 21, 2016 6:54 pm    Post subject: Reply with quote

Mike,
You've got mail.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Mon Feb 22, 2016 1:06 pm    Post subject: Dplot_AddData with 3D scatter plot Reply with quote

Thanks, David.
I just started with it.
Creating a 3D scatter plot with FileNew(7) and the first several Dplot_AddData statements appear to work as expected, then DPLOT crashes and reopens full screen.
It seems to do this after a random amount of iterations. Sometimes immediately - sometimes after several minutes.

I am using the line of code to update:
Code:
ret = DPlot_AddData(DocNum, DATA_3DS, ptctr, 1, j, Zout(0))


The return value when responding properly is 1, but changes to -16395 for one cycle, then -16390 for remaining cycles when DPLOT restarts - surely b/c DocNum is now invalid.

Am I sending corrupt data to cause DPLOT to crash? It doesn't appear corrupt to me, and this didn't occur when sending data to 3DR surface.

Any specific setting differences between 3DR and 3DS that I may be configuring incorrectly?
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Mon Feb 22, 2016 9:36 pm    Post subject: Reply with quote

VB with the real-time examples had a big problem with overrunning the DDE management library (or something). See the btest3 and vbnettest3 examples. They both set a "Busy" flag that gets reset once the call to DPlot_AddData returns, and refuse to do anything until Busy=0.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Tue Feb 23, 2016 9:50 am    Post subject: Reply with quote

The return value from DPlot_AddData was 1 until DPLOT crashed, and it returned -16395 on the call that crashed it.
How do I know when its busy before it crashes?
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Tue Feb 23, 2016 3:29 pm    Post subject: Reply with quote

That's a timeout error, which is a little odd in this case. All of the dplotlib functions will wait up to 20 seconds before giving up, and you'd surely notice a 20 second delay.

My best guess is your code is calling DPlot_AddData multiple times before it returns. Tracking that sort of thing is difficult (is this me or is this the other me or the one after that?) and the best way to avoid associated problems is to not let it happen. Something like:

Code:
   if(busy) return;
   busy=1;
   ret = DPlot_AddData(....);
   if(ret < 0) // stop and get out, something is wrong
   busy = 0;

_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Wed Feb 24, 2016 12:13 pm    Post subject: Reply with quote

I took the easy way out. I am using the same XY plot code that already works well for me.

The surface or scatter plot wasn't necessary for realtime feedback to the user - it was just flashy. Actually turns out the XY plot is better for user feedback during use.

I'll keep the "busy" part in mind in case I run into more errors.
Back to top
View user's profile Send private message
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Thu Aug 03, 2017 11:15 am    Post subject: Reply with quote

In my VB6 application sending data to the 3D Scatter plot gives me timeout errors quicker than when sending data to a 3D Surface plot.

It appears I can eliminate the timeout error sending to 3D surface plot by reducing how often I send data.

Is the timeout error related to how often the addData calls are made, or how much data is being transferred?

In other words, can I call DPlot_AddData twice as often with half the number of data sets?
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Thu Aug 03, 2017 1:30 pm    Post subject: Reply with quote

Quote:
In other words, can I call DPlot_AddData twice as often with half the number of data sets?


With a 3D scatter plot it should make little or no difference. With multiple calls there is a bit of additional overhead, but I would think this would be small relative to the time required to draw the plot.

You may save enough time to prevent timeout errors by turning off anti-aliasing with GeneralOptions(0x00000020,0). You can later turn that back on with GeneralOptions(0x00000020,0x00000020).

With a 3D surface plot you'll definitely be better off minimizing the number of calls and sending bigger chunks of data. Whether you're adding one point or 100,0000, the entire surface must be triangulated again, and triangulation is the biggest bottleneck.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Thu Aug 03, 2017 5:49 pm    Post subject: Reply with quote

Quote:
Whether you're adding one point or 100,0000, the entire surface must be triangulated again, and triangulation is the biggest bottleneck

That was my reason to try the Scatter plot. I am turning off Anti-aliasing, and deferring MinMaxCheck

In my polling application, I am getting about 15 data points per sample, and am getting about 5-6 samples/sec. Sending every sample packet to a 3D contour plot keeps up until the number of data points to be triangulated starts to slow things down.

Sending the same to a 3D scatter plot will give me timeouts after 2-10 seconds. If I only send every 3rd packet(roughly 2 calls/second, sending 15 data points each time), I can go longer before timeouts occur, but they do still occur. It appears in my app that the 3D scatter plot is slower than 3D surface, but that makes no sense.

I must be doing something odd. Any suggestions on what to check?
Back to top
View user's profile Send private message
mikeb



Joined: 18 Aug 2004
Posts: 36

PostPosted: Mon Aug 07, 2017 8:56 am    Post subject: Reply with quote

I'm now using a simpler solution using the 3D surface plot for my application. The visual effect is better than Scatter plot anyway.

I am only updating once every few seconds. DPlot has plenty of time to re-triangulate before getting the next data set. I do not need the sub-second updating of the plot like I was attempting.

My data sets won't be large enough for triangulation time to be an issue.
And my update rate is proportional to overall plot size, so larger images will update less frequent with larger data sets each update.

Snappy performance now.
Thanks for the support.
mike
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Wed Aug 09, 2017 11:17 am    Post subject: Reply with quote

Thanks for letting me know. I'm glad it is working well now.
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Basic All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group