Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » [C++ Gen] Issue with TimeEvent in statemachines
[C++ Gen] Issue with TimeEvent in statemachines [message #1810556] Tue, 13 August 2019 13:11 Go to next message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Hello,

I would use TimeEvent as trigger for state machine transition.

- I created a TimeEvent
- Set Is relative to true
- Fill when field with a TimeExpression
-Fill time expression with a name (t) and an OpaqueExpression (10.0 for example)

But I can't generate C++ code from this example. I obtain an Exception during the transformation:

java.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
at java.lang.Float.valueOf(Unknown Source)
at org.eclipse.papyrus.designer.transformation.vsl.ParseVSL.getDurationFromVSL(ParseVSL.java:109)
at org.eclipse.papyrus.designer.transformation.vsl.ParseVSL.getMsDurationFromVSL(ParseVSL.java:121)
at org.eclipse.papyrus.designer.transformation.languages.cpp.library.statemachine.SM2ClassesTransformationCore.transform(SM2ClassesTransformationCore.java:653)
at org.eclipse.papyrus.designer.transformation.languages.cpp.library.statemachine.CompleteStatemachine.transformElement(CompleteStatemachine.java:59)
at org.eclipse.papyrus.designer.transformation.library.transformations.CompleteStatemachine.transformElement(CompleteStatemachine.java:44)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:75)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursiveSub(ApplyRecursive.java:92)
at org.eclipse.papyrus.designer.transformation.core.transformations.ApplyRecursive.applyRecursive(ApplyRecursive.java:51)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:53)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:54)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformation.apply(ExecuteTransformation.java:58)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteChainUtil.apply(ExecuteChainUtil.java:68)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:211)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:134)
at org.eclipse.papyrus.designer.transformation.core.transformations.ExecuteTransformationChain.executeTransformation(ExecuteTransformationChain.java:116)
at org.eclipse.papyrus.cil4sys.useraction.handlers.CodeGenerationHandler$1.runInUIThread(CodeGenerationHandler.java:62)
at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:98)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3919)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3550)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:566)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:661)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
at org.eclipse.equinox.launcher.Main.run(Main.java:1476)
at org.eclipse.equinox.launcher.Main.main(Main.java:1449)


This is the relevant code :

	public static long getDurationFromVSL(String nfpDuration) {
		if (nfpDuration != null) {
			String unit = MarteUtils.getValueFromTuple(nfpDuration, UNIT);
			String value = MarteUtils.getValueFromTuple(nfpDuration, VALUE);
			return Float.valueOf(value).intValue() * getMultiplicatorFromTimeUnit(unit);
		}
		return 0;
	}



Should I use a special string format? And if yes which one? Is this feature available in C++ code generation, if yes is there somthing to set in addition?

Regards.

Yoann.
Re: [C++ Gen] Issue with TimeEvent in statemachines [message #1810818 is a reply to message #1810556] Tue, 20 August 2019 08:16 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi Yoann,

the format for the time is supposed to be in MARTE VSL (value specification language). I agree that the code should be more robust, i.e. it should never fail with an NPE.
You can find an example of a VSL expression in the simple state-machine example, i.e. "{value=250, unit=ms}" would indicate a delay of 250ms.
Ansgar
Re: [C++ Gen] Issue with TimeEvent in statemachines [message #1810873 is a reply to message #1810818] Wed, 21 August 2019 07:17 Go to previous message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Thanks! it works fine with the correct format.

Yoann.
Previous Topic:DB State Machine to Papyrus
Next Topic:Papyrus SysML Tutorial (version 0.1.3)
Goto Forum:
  


Current Time: Mon Dec 16 02:23:12 GMT 2019

Powered by FUDForum. Page generated in 0.01915 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top