소스 검색

Merge pull request #414 from Yakindu/issue_406

Resolves #406
Thomas Kutz 9 년 전
부모
커밋
06e91c0fcf

+ 21 - 1
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/DefaultExecutionFlowInterpreter.xtend

@@ -84,9 +84,29 @@ class DefaultExecutionFlowInterpreter implements IExecutionFlowInterpreter {
 			flow.enterSequences?.defaultSequence?.scheduleAndRun
 		else {
 			executionContext.activeStates.forEach[state|
-				activeStateConfiguration.set(state.toExecutionState.stateVector.offset, state.toExecutionState)]
+				activeStateConfiguration.set(state.toExecutionState.stateVector.offset, state.toExecutionState)
+				// schedule all time events
+				state.toExecutionState.enterSequences?.forEach[executeAfterRestore]
+			]
+			flow.enterSequences?.forEach[executeAfterRestore]
 		}
 	}
+	
+	def dispatch protected void executeAfterRestore(Step it) {
+		// fall back
+	}
+	
+	def dispatch protected void executeAfterRestore(Sequence it) {
+		steps.forEach[executeAfterRestore]
+	}
+	
+	def dispatch protected void executeAfterRestore(Call it) {
+		step.executeAfterRestore
+	}
+
+	def dispatch protected void executeAfterRestore(ScheduleTimeEvent it) {
+		scheduleAndRun
+	}
 
 	def ExecutionState toExecutionState(RegularState state) {
 		return flow.eAllContents.filter[

+ 1 - 1
plugins/org.yakindu.sct.simulation.core.sexec/src/org/yakindu/sct/simulation/core/sexec/interpreter/StextStatementInterpreter.xtend

@@ -94,7 +94,7 @@ class StextStatementInterpreter extends AbstractStatementInterpreter {
 	def dispatch Object typeCast(Long value, Type type) {
 		if(ts.isSuperType(type, ts.getType(GenericTypeSystem.INTEGER))) return value
 		if(ts.isSuperType(type, ts.getType(GenericTypeSystem.REAL))) return Double.valueOf(value)
-		throw new IllegalArgumentException
+		throw new IllegalArgumentException("unknown type "+type.name)
 	}
 
 	def dispatch Object typeCast(Float value, Type type) {