hhu-stups / prob-issues

ProB issues (for probcli, ProB Tcl/Tk, ProB2, ProB2UI)
6 stars 0 forks source link

Improve communication between Python and SimB #342

Open cobizobi opened 5 months ago

cobizobi commented 5 months ago

Ideas for improving the communication between the running program/AI (Python) and SimB:

cobizobi commented 1 month ago

e.g. I get the following very incomprehensible exception when I try to run an invalid external Python simulation (e.g. syntax error in the Python code), with SimB. I replaced the path by <absolute_path.

de.prob.animator.domainobjects.EvaluationException: Invalid combination of symbols: 'File' and '"<absolute_path>/main.py"'. Missing operator or separator between identifier and literal.
    at de.prob.animator.domainobjects.ClassicalB.parse(ClassicalB.java:116)
    at de.prob.animator.domainobjects.ClassicalB.<init>(ClassicalB.java:52)
    at de.prob.animator.domainobjects.ClassicalB.<init>(ClassicalB.java:78)
    at de.prob2.ui.simulation.simulators.SimulatorCache.lambda$readValueWithCaching$0(SimulatorCache.java:35)
    at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1228)
    at de.prob2.ui.simulation.simulators.SimulatorCache.readValueWithCaching(SimulatorCache.java:32)
    at de.prob2.ui.simulation.simulators.SimulationEventHandler.evaluateWithParameters(SimulationEventHandler.java:133)
    at de.prob2.ui.simulation.simulators.SimulationEventHandler.activateOperation(SimulationEventHandler.java:273)
    at de.prob2.ui.simulation.simulators.Simulator.executeActivatedOperation(Simulator.java:305)
    at de.prob2.ui.simulation.simulators.Simulator.executeActivatedOperations(Simulator.java:256)
    at de.prob2.ui.simulation.simulators.Simulator.simulationStep(Simulator.java:220)
    at de.prob2.ui.simulation.simulators.RealTimeSimulator.simulate(RealTimeSimulator.java:52)
    at de.prob2.ui.simulation.simulators.Scheduler$1.run(Scheduler.java:75)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
    at java.base/java.util.TimerThread.run(Timer.java:516)
Caused by: de.be4.classicalb.core.parser.exceptions.BCompoundException: Invalid combination of symbols: 'File' and '"<absolute_path>/main.py"'. Missing operator or separator between identifier and literal.
    at de.be4.classicalb.core.parser.BParser.parseInternal(BParser.java:418)
    at de.be4.classicalb.core.parser.BParser.parseWithoutPreParsing(BParser.java:447)
    at de.be4.classicalb.core.parser.BParser.parseWithKindPrefix(BParser.java:238)
    at de.be4.classicalb.core.parser.BParser.parseFormula(BParser.java:245)
    at de.prob.animator.domainobjects.ClassicalB.parse(ClassicalB.java:106)
    ... 14 more
Caused by: de.be4.classicalb.core.parser.exceptions.BLexerException: Invalid combination of symbols: 'File' and '"<absolute_path>/main.py"'. Missing operator or separator between identifier and literal.
    at de.be4.classicalb.core.parser.BLexer.ThrowDefaultLexerException(BLexer.java:407)
    at de.be4.classicalb.core.parser.BLexer.checkForInvalidCombinations(BLexer.java:398)
    at de.be4.classicalb.core.parser.BLexer.findSyntaxError(BLexer.java:377)
    at de.be4.classicalb.core.parser.BLexer.filter(BLexer.java:439)
    at de.be4.classicalb.core.parser.lexer.Lexer.peek(Lexer.java:38)
    at de.be4.classicalb.core.parser.parser.Parser.parse(Parser.java:146)
    at de.be4.classicalb.core.parser.BParser.parseInternal(BParser.java:379)
    ... 18 more
favu100 commented 1 month ago

Messages are not sent as JSON format. The communication is established with a client/socket architecture