[Scilab-Dev] Debugging Scilab's Xcos module on eclipse get crash with error :Minidumps

jm.gauthier jm.gauthier at samares-engineering.com
Fri May 27 11:28:34 CEST 2016


Hi Diptig, 

I tried to reproduce it and I faced the same problem: "/it shows a message
saying "Simulation in progress" and nothing happens after that and it
remains in this state only/". 

However I do not face the same problem when I launch the code inside a JUnit
test instead of the main method. I've got three JUnit tests for the moment: 

//Here I want to test that creating and opening a Scilab instance and
launching a simple command works well. 
@Test
public void testExecuteSumCommand() {
		
		XCosEngine.getInstance().sciOpen();
		assertEquals("[4.0]", XCosEngine.getInstance().executeCommand("result = 3
+ 1;", "result").toString());
		XCosEngine.getInstance().sciClose();
	}

//Here I want to test that an Xcos model can be loaded and simulated using
scilab commands. 
	@Test
	public void testLoadAndSimulateXcosDiagram() {
		String diagram_path = "pathTo/mymodel.zcos";
		
		XCosEngine.getInstance().sciOpen();
		XCosEngine.getInstance().execute("loadXcosLibs();");
		
		XCosEngine.getInstance().execute( "status = importXcosDiagram(\"" +
diagram_path + "\");");

		XCosEngine.getInstance().execute("xcos_simulate(scs_m, 4);");
		XCosEngine.getInstance().sciClose();
	}

//Here I want to test your code: 
@Test
public void textExecuteXcos(){
	XCosEngine.getInstance().sciOpen();
	XCosEngine.getInstance().executeXcos("pathto/mymodel.zcos");
	XCosEngine.getInstance().sciClose();
		
	}

XCosEngine is a singleton: 

private XCosEngine(){
	try {
		if (this.sci == null){
			this.sci = new Scilab(true);
		}
	} catch (InitializationException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}

public static XCosEngine getInstance() {
	if(instance == null){
		instance = new XCosEngine();
	}
	return instance;
}

That's why there is XCosEngine.getInstance() everywhere. But anyway it
should not change the behaviour of the Scilab libraries. The following is
the method used in my last JUnit test: 

public void executeXcos(String pathfile){
	Xcos.xcos(pathfile, null);
}

So, basically, we have the same set of instructions: new Scilab(true),
open() and xcos(string, string).
When I execute the last unit test only, nothing happend (no diagram is
opened), but no errors appear. When I execute the second unit test only, the
simulation graphic appears (from the scope inside the model). 
Finally, when I execute the second and the last unit test together, the
simulation appears and the diagram opens in a new Xcos window. 

I can't really explain why the last unit test do nothing...


diptig wrote
> Let me know If I'm missing something more on this and is there any
> documentation available for scilab code and code's flow diagram. 

The javasci documentation is here:
https://help.scilab.org/docs/5.5.2/en_US/javasci/javadoc/index.html.
Concerning the Xcos module javadoc, I didn't find it yet. 

Hope it can helps. 




--
View this message in context: http://mailinglists.scilab.org/Debugging-Scilab-s-Xcos-module-on-eclipse-get-crash-with-error-Minidumps-tp4033957p4034127.html
Sent from the Scilab developers - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the dev mailing list