NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
October 21, 2017, 10:22:27 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Give me a standpoint and I will move the earth. ...Archimedes (287-212BC)
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Runtime error in Magnetic Bar Field Model  (Read 5272 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
on: April 18, 2010, 05:30:12 pm »

http://www.compadre.org/OSP/items/detail.cfm?ID=9414
when i move the compass very quickly, sometimes it is possible to get a runtime error.
any idea how the error can be solved?
I tried to fix it but can't figure out the cause, i increase the array to nx and ny to [21] but that didn't solve the runtime error.
i have been puzzled by this runtime error. i can't understand what is causing it. chance to look at it ? thanks!

"Where is "Thread-3"? this error position happen at this point, i did a screen capture

Error is:
Exception in thread "Thread-3" java.lang.ArrayIndexOutOfBoundsException: 20
   at org.opensourcephysics.drawing2d.VectorField.prepareField(Unknown Source)
   at org.opensourcephysics.drawing2d.VectorField.draw(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.paintDrawableList(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.paintEverything(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
   at org.colos.ejs.library.control.swing.ControlDrawablesParent.finalUpdate(Unknown Source)
   at org.colos.ejs.library.control.EjsControl.finalUpdate(Unknown Source)
   at org.colos.ejs.library.Animation.update(Unknown Source)
   at org.colos.ejs.library.Animation.updateWhenIdle(Unknown Source)
   at org.colos.ejs.library.control.EjsControl.updateSimulationWhenIdle(Unknown Source)
   at org.colos.ejs.library.control.ControlElement.variablesChanged(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.propagatePosition(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.reportMouseMotion(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.interactionPerformed(Unknown Source)
   at org.opensourcephysics.drawing2d.Element.invokeActions(Unknown Source)
   at org.colos.ejs.library.control.swing.UpdateHotSpot2DDelayedAction.performAction(Unknown Source)
   at org.colos.ejs.library.Animation.checkMethodsInvokedByView(Unknown Source)
   at org.colos.ejs.library.Animation.update(Unknown Source)
   at org.colos.ejs.library.Animation.step(Unknown Source)
   at org.colos.ejs.library.Animation.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


* errorposition.png (81.83 KB, 743x537 - viewed 297 times.)

* errorposition2.png (77.58 KB, 744x528 - viewed 322 times.)
« Last Edit: April 18, 2010, 05:55:02 pm by lookang » Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: April 18, 2010, 09:54:34 pm » posted from:Taipei,T\'ai-pei,Taiwan

I did not find any error when I run it.
Is it possible it is your modified version(not the original verison) which intriduce error?
Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #2 on: April 18, 2010, 11:03:21 pm »

i move the compass non-stop up and down across the picture of the magnet.

it is not exactly a reproducible error and i can't pin point where it happens, but it has happened to me on different machines Mac and PC.

and yes you are right, the error is also found in my modified version, that is why i went back to the http://www.compadre.org/OSP/items/detail.cfm?ID=9414 version and drag the compass like mad, and true enough, it happens too.

i also checked with wolfgang he said "The model does not change the array size and appears to be an EJS drawing problem."
i also checking with paco Smiley

i just tried again on a Mac
the error is:
Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException: 20
   at org.opensourcephysics.drawing2d.VectorField.processMagnitude(Unknown Source)
   at org.opensourcephysics.drawing2d.VectorField.prepareField(Unknown Source)
   at org.opensourcephysics.drawing2d.VectorField.draw(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.paintDrawableList(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.paintEverything(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
   at org.opensourcephysics.display.DrawingPanel.render(Unknown Source)
   at org.colos.ejs.library.control.swing.ControlDrawablesParent.finalUpdate(Unknown Source)
   at org.colos.ejs.library.control.EjsControl.finalUpdate(Unknown Source)
   at org.colos.ejs.library.Animation.update(Unknown Source)
   at org.colos.ejs.library.Animation.updateWhenIdle(Unknown Source)
   at org.colos.ejs.library.control.EjsControl.updateSimulationWhenIdle(Unknown Source)
   at org.colos.ejs.library.control.ControlElement.variablesChanged(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.propagatePosition(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.reportMouseMotion(Unknown Source)
   at org.colos.ejs.library.control.drawing2d.ControlElement2D.interactionPerformed(Unknown Source)
   at org.opensourcephysics.drawing2d.Element.invokeActions(Unknown Source)
   at org.colos.ejs.library.control.swing.UpdateHotSpot2DDelayedAction.performAction(Unknown Source)
   at org.colos.ejs.library.Animation.checkMethodsInvokedByView(Unknown Source)
   at org.colos.ejs.library.Animation.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:637)

seems slightly different error message from the windows 7

i attached the picture of the line 637 of the file MagneticBarFieldView.java and the file itself.

never mind if it cannot be solved, i think the applet is more stable after the reset button is clicked once, i try to add the reset code to it and see how.


* Screen shot 2010-04-19 at AM 12.08.25.png (68.5 KB, 735x523 - viewed 306 times.)

* Screen shot 2010-04-19 at AM 12.14.24.png (95.55 KB, 818x907 - viewed 653 times.)

*** There are 1 more attached files. You need to login to acces it!
« Last Edit: April 18, 2010, 11:31:32 pm by lookang » Logged
lookang
Hero Member
*****
Offline Offline

Posts: 1784


http://weelookang.blogspot.com


WWW
«
Embed this message
Reply #3 on: April 18, 2010, 11:34:56 pm »

i think i have solved it!

i added
_reset(); to the beginning of the initialization page and i drag the compass like mad like 30 seconds! and nothing!! no bug!!! LOL

maybe i did it!


will test again Grin
Logged
Pages: [1]   Go Up
  Print  
Give me a standpoint and I will move the earth. ...Archimedes (287-212BC)
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Ejs Open Source Bar Magnet & Compass Model with Earth visualization java applet
Collaborative Community of EJS
lookang 9 17312 Last post April 26, 2010, 01:04:01 pm
by lookang
Individual and Resultant Force Magnetic Field of a wire and external mag. field
Request for physics Simulations
lookang 8 16179 Last post December 10, 2009, 10:42:37 pm
by Fu-Kwun Hwang
Magnetic Force Three Wires Model
Simulations from other web sites
ahmedelshfie 0 4902 Last post April 19, 2010, 08:11:59 pm
by ahmedelshfie
Magnetic levitation model
Request for physics Simulations
pavwell 15 13753 Last post May 25, 2010, 07:57:39 am
by Fu-Kwun Hwang
Magnetic levitation model
electromagnetism
ahmedelshfie 3 7008 Last post May 24, 2010, 07:21:19 pm
by ahmedelshfie
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.059 seconds with 23 queries.since 2011/06/15