added transformers for channel, channel accesses, ticks, ModeLabelAccess
Signed-off-by: Sebastian Reiser <Sebastian.Reiser@de.bosch.com>
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CallGraphTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CallGraphTransformer.xtend
index c190de4..f9aa9a1 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CallGraphTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CallGraphTransformer.xtend
@@ -16,11 +16,15 @@
package templates.m2m.sw
import com.google.inject.Inject
+import com.google.inject.Singleton
+import com.inchron.realtime.root.model.GraphEntryBase
+import com.inchron.realtime.root.model.ModeSwitch
+import com.inchron.realtime.root.model.util.ModelSwitch
+import java.util.ArrayList
import java.util.Map
import org.eclipse.app4mc.amalthea.model.CallGraph
import org.eclipse.app4mc.amalthea.model.Process
import templates.AbstractAmaltheaInchronTransformer
-import com.google.inject.Singleton
@Singleton
class CallGraphTransformer extends AbstractAmaltheaInchronTransformer{
@@ -40,9 +44,41 @@
var inchronGraphEntryBase= graphEntryBaseTransformer.transformGraphEntryBase(amltGraphEntry, amltTask,
amltProcess_inchronProcessMap)
+
+ /*
+ * Based on the requirement from Inchron to use the latest Mode values:
+ * -- it is required to create a "Dummy CallSequence" and associate ModeConditionEvaluation of each ModeSwitchEntry object
+ */
+ if(inchronGraphEntryBase instanceof ModeSwitch){
+ createDummyCallSequenceWitchModeSwitchEvaluation(inchronGraphEntryBase, inchronCallGraph)
+ }
+ //Adding ModeSwitch
inchronCallGraph.graphEntries.add(inchronGraphEntryBase)
]
}
+
+ public def void createDummyCallSequenceWitchModeSwitchEvaluation(ModeSwitch inchronModeSwitch, com.inchron.realtime.root.model.CallGraph inchronCallGraph) {
+
+ var dummyCallSequence=inchronModelFactory.createCallSequence
+ dummyCallSequence.name = "CallSequence_For_ModeConditionEvaluation"
+
+ val dummyCallSequenceItems=new ArrayList
+
+ inchronModeSwitch.entries.forEach[inchronModeSwitchEntry|
+ val inchronModeCondition=inchronModeSwitchEntry.condition
+
+ var inchronModeConditionEvaluation=inchronModelFactory.createModeConditionEvaluation
+ inchronModeConditionEvaluation.condition=inchronModeCondition
+ dummyCallSequenceItems.add(inchronModeConditionEvaluation)
+ ]
+
+ if(dummyCallSequenceItems.size>0){
+ dummyCallSequence.calls.addAll(dummyCallSequenceItems)
+ //Adding DummyCallSequence containing ModeConditionEvaluation
+ inchronCallGraph.graphEntries.add(dummyCallSequence);
+ }
+
+ }
}
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ChannelTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ChannelTransformer.xtend
new file mode 100644
index 0000000..489ed21
--- /dev/null
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ChannelTransformer.xtend
@@ -0,0 +1,34 @@
+/**
+ ********************************************************************************
+ * Copyright (c) 2018-2019 Robert Bosch GmbH.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Robert Bosch GmbH - initial API and implementation
+ ********************************************************************************
+ */
+
+package templates.m2m.sw
+
+import com.google.inject.Singleton
+import com.inchron.realtime.root.model.DataFlowCommunicationType
+import org.eclipse.app4mc.amalthea.model.Channel
+import templates.AbstractAmaltheaInchronTransformer
+
+@Singleton
+class ChannelTransformer extends AbstractAmaltheaInchronTransformer {
+
+ public def create inchronModelFactory.createDataFlowConnection createDataFlowConnection(Channel amltChannel){
+ it.communicationType = DataFlowCommunicationType.QUEUING
+ it.defaultElements = amltChannel.defaultElements
+ it.name = amltChannel.displayName
+ it.size = amltChannel.maxElements
+ //hook this DataFlowConnection into Inchron root model
+ getInchronRoot.connections.add(it);
+ }
+}
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CustomEventTriggerTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CustomEventTriggerTransformer.xtend
index 72c9e06..08e51c9 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CustomEventTriggerTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/CustomEventTriggerTransformer.xtend
@@ -34,6 +34,7 @@
var AmltCacheModel cacheModel
@Inject ModeValueDisjunctionTransformer modeValueDisjunctionTransformer
+ @Inject CallGraphTransformer callGraphTransformer
public def FunctionCall transformCustomEventTrigger(Component inchronComponent, Process amltTask,
CustomEventTrigger amltCustomEventTrigger){
@@ -72,8 +73,7 @@
val inchronModeSwitch=inchronModelFactory.createModeSwitch
- //Adding ModeSwitch
- inchronCallGraph.graphEntries.add(inchronModeSwitch)
+
//Transforming mode entries with condition
@@ -112,8 +112,15 @@
inchronModeSwitchEntry.graphEntries.add(inchronCallSequence)
]
-
-
+ /*
+ * Based on the requirement from Inchron to use the latest Mode values:
+ * -- it is required to create a "Dummy CallSequence" and associate ModeConditionEvaluation of each ModeSwitchEntry object
+ */
+ callGraphTransformer.createDummyCallSequenceWitchModeSwitchEvaluation(inchronModeSwitch, inchronCallGraph);
+
+ //Adding ModeSwitch
+ inchronCallGraph.graphEntries.add(inchronModeSwitch)
+
var FunctionCall inchronFunctionCall=inchronModelFactory.createFunctionCall
inchronFunctionCall.function=inchronDummyFunction
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ModeSwitchTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ModeSwitchTransformer.xtend
index 80a8c02..99b3565 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ModeSwitchTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/ModeSwitchTransformer.xtend
@@ -24,12 +24,14 @@
import templates.utils.AmltCacheModel
import com.inchron.realtime.root.model.FunctionCall
import com.google.inject.Singleton
+import java.util.ArrayList
@Singleton
class ModeSwitchTransformer extends GraphEntryBaseTransformer {
@Inject RunnableItemTransformer runnableItemTransformer
@Inject ModeValueDisjunctionTransformer modeValueDisjunctionTransformer
+ @Inject CallGraphTransformer callGraphTransformer
var AmltCacheModel cacheModel
@@ -50,9 +52,6 @@
val inchronModeSwitch=inchronModelFactory.createModeSwitch
- //Adding ModeSwitch
- inchronCallGraph.graphEntries.add(inchronModeSwitch)
-
if(amltRunnableModeSwitch.defaultEntry !==null){
val inchronModeSwitchDefault=inchronModelFactory.createModeSwitchDefault
@@ -102,6 +101,17 @@
]
}]
+
+ /*
+ * Based on the requirement from Inchron to use the latest Mode values:
+ * -- it is required to create a "Dummy CallSequence" and associate ModeConditionEvaluation of each ModeSwitchEntry object
+ */
+ callGraphTransformer.createDummyCallSequenceWitchModeSwitchEvaluation(inchronModeSwitch, inchronCallGraph);
+
+ //Adding ModeSwitch
+ inchronCallGraph.graphEntries.add(inchronModeSwitch)
+
+
var FunctionCall inchronFunctionCall=inchronModelFactory.createFunctionCall
inchronFunctionCall.function=inchronDummyFunction
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/RunnableItemTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/RunnableItemTransformer.xtend
index 7c9f76b..b088280 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/RunnableItemTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/RunnableItemTransformer.xtend
@@ -16,56 +16,67 @@
package templates.m2m.sw
import com.google.inject.Inject
+import com.google.inject.Singleton
+import com.inchron.realtime.root.model.CallSequenceItem
import com.inchron.realtime.root.model.Component
+import java.util.List
+import org.eclipse.app4mc.amalthea.model.ChannelReceive
+import org.eclipse.app4mc.amalthea.model.ChannelSend
+import org.eclipse.app4mc.amalthea.model.CustomEventTrigger
+import org.eclipse.app4mc.amalthea.model.LabelAccessEnum
+import org.eclipse.app4mc.amalthea.model.ModeLabelAccess
+import org.eclipse.app4mc.amalthea.model.Process
import org.eclipse.app4mc.amalthea.model.RunnableCall
+import org.eclipse.app4mc.amalthea.model.RunnableItem
+import org.eclipse.app4mc.amalthea.model.RunnableModeSwitch
import org.eclipse.app4mc.amalthea.model.Ticks
import templates.AbstractAmaltheaInchronTransformer
+import templates.m2m.sw.runnableItem.ChannelReceiveTransformer
+import templates.m2m.sw.runnableItem.ChannelSendTransformer
import templates.m2m.sw.runnableItem.RunnableCallTransformer
import templates.m2m.sw.runnableItem.TicksTransformer
-import org.eclipse.app4mc.amalthea.model.RunnableItem
-import com.inchron.realtime.root.model.CallSequenceItem
-import org.eclipse.app4mc.amalthea.model.RunnableModeSwitch
-import java.util.List
-import org.eclipse.app4mc.amalthea.model.CustomEventTrigger
-import com.google.inject.Singleton
@Singleton
class RunnableItemTransformer extends AbstractAmaltheaInchronTransformer{
@Inject RunnableCallTransformer runnableCallTransformer
-
- @Inject TicksTransformer ticksTransformer
-
+ @Inject TicksTransformer ticksTransformer
@Inject ModeSwitchTransformer modeSwitchTransformer
-
- @Inject CustomEventTriggerTransformer customEventTriggerTransformer
+ @Inject CustomEventTriggerTransformer customEventTriggerTransformer
+ @Inject ModeLabelTransformer modeLabelTransformer
+ @Inject ChannelReceiveTransformer channelReceiveTransformer
+ @Inject ChannelSendTransformer channelSendTransformer
- def List<CallSequenceItem> transformRunnableItem(Component inchronComponent, org.eclipse.app4mc.amalthea.model.Process amltTask,
- RunnableItem amltRunnableItem) {
-
+ def List<CallSequenceItem> transformRunnableItem(Component inchronComponent, Process amltTask,
+ RunnableItem amltRunnableItem) {
val List<CallSequenceItem> list=newArrayList
-
+
if (amltRunnableItem instanceof RunnableCall) {
-
var inchronFunctionCall = runnableCallTransformer.createFunctionCall(inchronComponent, amltTask,
amltRunnableItem)
-
- list.add(inchronFunctionCall)
-
-
+ list.add(inchronFunctionCall)
} else if (amltRunnableItem instanceof Ticks) {
var inchronResourceConsumption = ticksTransformer.createResourceConsumption(amltTask, amltRunnableItem)
list.add(inchronResourceConsumption)
-
- }else if(amltRunnableItem instanceof RunnableModeSwitch){
-
- var inchronFunctionCall = modeSwitchTransformer.transformRunnableModeSwitch(inchronComponent, amltTask,amltRunnableItem)
-
+ }else if(amltRunnableItem instanceof RunnableModeSwitch){
+ var inchronFunctionCall = modeSwitchTransformer.transformRunnableModeSwitch(inchronComponent, amltTask,amltRunnableItem)
list.add(inchronFunctionCall)
} else if(amltRunnableItem instanceof CustomEventTrigger){
- var inchronFunctionCall = customEventTriggerTransformer.transformCustomEventTrigger(inchronComponent, amltTask,amltRunnableItem)
-
+ var inchronFunctionCall = customEventTriggerTransformer.transformCustomEventTrigger(inchronComponent, amltTask,amltRunnableItem)
list.add(inchronFunctionCall)
+ } else if(amltRunnableItem instanceof ModeLabelAccess){
+ if(amltRunnableItem.access.equals(LabelAccessEnum.WRITE)){
+ var inchronModeSwitchPoint=inchronModelFactory.createModeSwitchPoint
+ val amltModeLabel=amltRunnableItem.data
+ val amltModeLiteral=amltRunnableItem.modeValue
+ val inchronMode=modeLabelTransformer.getInchronMode(amltModeLabel, amltModeLiteral)
+ inchronModeSwitchPoint.mode = inchronMode
+ list.add(inchronModeSwitchPoint)
+ }
+ } else if (amltRunnableItem instanceof ChannelReceive) {
+ list.add(channelReceiveTransformer.createVariableReadAccess(amltRunnableItem as ChannelReceive))
+ } else if (amltRunnableItem instanceof ChannelSend) {
+ list.add(channelSendTransformer.createVariableWriteAccess(amltRunnableItem as ChannelSend))
}
return list
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelAccessTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelAccessTransformer.xtend
deleted file mode 100644
index 1b9f880..0000000
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelAccessTransformer.xtend
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * *******************************************************************************
- * Copyright (c) 2019 Robert Bosch GmbH and others.
- *
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Robert Bosch GmbH - initial API and implementation
- * *******************************************************************************
- */
-
-package templates.m2m.sw.runnableItem
-
-import templates.AbstractAmaltheaInchronTransformer
-import com.google.inject.Singleton
-
-@Singleton
-class ChannelAccessTransformer extends AbstractAmaltheaInchronTransformer {
-}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelReceiveTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelReceiveTransformer.xtend
index 56349ee..b69ced7 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelReceiveTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelReceiveTransformer.xtend
@@ -15,9 +15,64 @@
package templates.m2m.sw.runnableItem
-import templates.AbstractAmaltheaInchronTransformer
+import com.google.inject.Inject
import com.google.inject.Singleton
+import com.inchron.realtime.root.model.VariableReadAccessPolicy
+import com.inchron.realtime.root.model.VariableReadAccessType
+import com.inchron.realtime.root.model.memory.DataAccessType
+import org.eclipse.app4mc.amalthea.model.ChannelReceive
+import org.eclipse.app4mc.amalthea.model.ReceiveOperation
+import templates.AbstractAmaltheaInchronTransformer
+import templates.m2m.sw.ChannelTransformer
@Singleton
class ChannelReceiveTransformer extends AbstractAmaltheaInchronTransformer {
+
+ @Inject ChannelTransformer channelTransformer
+ @Inject TransmissionPolicyTransformer transmissionPolicyTransformer
+
+ def create inchronModelFactory.createVariableReadAccess createVariableReadAccess(ChannelReceive amltChannelReceive) {
+ it.connection = channelTransformer.createDataFlowConnection(amltChannelReceive.data)
+ it.dataMustBeNew = amltChannelReceive.dataMustBeNew
+ it.index = amltChannelReceive.elementIndex
+ it.isBuffered = true
+ it.label = "read access"
+ it.lowerBound = amltChannelReceive.lowerBound
+ it.number = amltChannelReceive.elements
+
+ //set data access policy
+ if (amltChannelReceive.transmissionPolicy !== null){
+ it.dataAccess = transmissionPolicyTransformer.createExplicitDataAccess(amltChannelReceive.transmissionPolicy)
+ } else {
+ it.dataAccess = inchronMemoryFactory.createExplicitDataAccess
+ }
+ it.dataAccess.accessType = DataAccessType.READ;
+
+
+ //assign operation type: FIFO, LIFO, TAKE, READ
+ if (amltChannelReceive.receiveOperation === ReceiveOperation.FIFO_READ) {
+ it.isTake = false;
+ it.policy = VariableReadAccessPolicy.FIFO
+ }
+ else if (amltChannelReceive.receiveOperation === ReceiveOperation.FIFO_TAKE) {
+ it.isTake = true;
+ it.policy = VariableReadAccessPolicy.LIFO
+ }
+ else if (amltChannelReceive.receiveOperation === ReceiveOperation.LIFO_READ) {
+ it.isTake = false;
+ it.policy = VariableReadAccessPolicy.FIFO
+ }
+ else if (amltChannelReceive.receiveOperation === ReceiveOperation.LIFO_TAKE) {
+ it.isTake = true;
+ it.policy = VariableReadAccessPolicy.LIFO
+ }
+
+ //assign type
+ it.type = VariableReadAccessType.GENERIC
+
+ //add read access to dataflow connection's receiver list
+ it.connection.requesters.add(it)
+ }
+
+
}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelSendTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelSendTransformer.xtend
index 8fbd1bc..4c0fd97 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelSendTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/ChannelSendTransformer.xtend
@@ -15,9 +15,42 @@
package templates.m2m.sw.runnableItem
-import templates.AbstractAmaltheaInchronTransformer
+import com.google.inject.Inject
import com.google.inject.Singleton
+import com.inchron.realtime.root.model.VariableWriteAccessType
+import com.inchron.realtime.root.model.memory.DataAccessType
+import org.eclipse.app4mc.amalthea.model.ChannelSend
+import templates.AbstractAmaltheaInchronTransformer
+import templates.m2m.sw.ChannelTransformer
@Singleton
class ChannelSendTransformer extends AbstractAmaltheaInchronTransformer {
+
+ @Inject ChannelTransformer channelTransformer
+ @Inject TransmissionPolicyTransformer transmissionPolicyTransformer
+
+ def create inchronModelFactory.createVariableWriteAccess createVariableWriteAccess(ChannelSend amltChannelSend) {
+ it.connection = channelTransformer.createDataFlowConnection(amltChannelSend.data)
+ it.isBuffered = true
+ it.label = "write access"
+ it.number = amltChannelSend.elements
+
+ //set data access policy
+ if (amltChannelSend.transmissionPolicy !== null){
+ it.dataAccess = transmissionPolicyTransformer.createExplicitDataAccess(amltChannelSend.transmissionPolicy)
+ } else {
+ it.dataAccess = inchronMemoryFactory.createExplicitDataAccess
+ }
+ it.dataAccess.accessType = DataAccessType.WRITE;
+
+ //assign type
+ it.type = VariableWriteAccessType.GENERIC
+
+ //add read access to dataflow connection's receiver list
+ if (it.connection.provider !== null){
+ logger.error("Transformation for Channel to Inchron DataFlowConnection supports only one writer per channel")
+ } else {
+ it.connection.provider = it
+ }
+ }
}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
index 30c1f05..05dfb27 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TicksTransformer.xtend
@@ -36,11 +36,71 @@
def create inchronModelFactory.createResourceConsumption createResourceConsumption(Process amltTask,
Ticks amltTicks) {
-
it.name = "RC"
- it.timeDistribution = createTimeDistribution(amltTask, amltTicks)
+ //it.timeDistribution = createTimeDistribution(amltTask, amltTicks)
+ it.timeDistribution = createTicksDistribution(amltTask, amltTicks)
}
+ def create inchronModelFactory.createTimeDistribution createTicksDistribution(Process amltTask, Ticks amltTicks) {
+
+ var amltCores = DeploymentUtil.getAssignedCoreForProcess(amltTask,
+ EcoreUtil.getRootContainer(amltTask) as Amalthea);
+
+ if (amltCores.size > 0) {
+ val amltCore = amltCores?.get(0)
+ it.min = createTimeTicks( amltTicks?.^default.lowerBound)
+ it.mean = createTimeTicks(amltTicks?.^default.average)
+ it.max = createTimeTicks(amltTicks?.^default.upperBound)
+ it.sigma = inchronModelFactory.createTime
+ it.type = TimeDistributionType.MAX
+ it.alpha = 0
+ it.beta = 0
+ var amltDistribution = amltTicks?.extended?.get(amltCore)
+
+ if (amltDistribution === null) {
+ amltDistribution = amltTicks.^default
+ }
+
+ if (amltDistribution instanceof DiscreteValueGaussDistribution) {
+ it.type = TimeDistributionType.NORMAL
+ it.sigma = createTimeTicks(amltDistribution.sd)
+ } else if (amltDistribution instanceof DiscreteValueUniformDistribution) {
+ it.type = TimeDistributionType.UNIFORM
+ } else if (amltDistribution instanceof DiscreteValueBetaDistribution) {
+ } else if (amltDistribution instanceof DiscreteValueHistogram) {
+ it.type = TimeDistributionType.DISCRETE
+ amltDistribution.entries.forEach [ amltEntry |
+ val amltAvg = (amltEntry.upperBound + amltEntry.lowerBound) / 2;
+ val amltOccurrences = amltEntry.occurrences
+ var inchronDiscreteDistributionEntry = inchronModelFactory.createDiscreteDistributionEntry
+ inchronDiscreteDistributionEntry.count = amltOccurrences
+ inchronDiscreteDistributionEntry.execTime = createTimeTicks(amltAvg)
+ it.discreteDistribution.add(inchronDiscreteDistributionEntry)
+ ]
+ }
+ }
+
+ }
+
+
+ def create inchronModelFactory.createTime createTimeTicks(Double value) {
+ it.value = Math.round(value)
+ it.unit = com.inchron.realtime.root.model.TimeUnit.T
+ }
+
+
+ def create inchronModelFactory.createTime createTimeTicks(Long value) {
+ it.value = value
+ it.unit = com.inchron.realtime.root.model.TimeUnit.T
+ }
+
+
+ def create inchronModelFactory.createTime createTimeTicks(Integer value) {
+ it.value = value
+ it.unit = com.inchron.realtime.root.model.TimeUnit.T
+ }
+
+
def create inchronModelFactory.createTimeDistribution createTimeDistribution(Process amltTask, Ticks amltTicks) {
val timeUtils = new TimeTransformer
@@ -63,37 +123,37 @@
if (amltDistribution === null) {
amltDistribution = amltTicks.^default
+ }
- if (amltDistribution instanceof DiscreteValueGaussDistribution) {
- it.type = TimeDistributionType.NORMAL
+ if (amltDistribution instanceof DiscreteValueGaussDistribution) {
+ it.type = TimeDistributionType.NORMAL
- val sdCycles = amltDistribution.sd
+ val sdCycles = amltDistribution.sd
- it.sigma = timeUtils.createTime(
- RuntimeUtil.getExecutionTimeForCycles(sdCycles, amltCore?.frequencyDomain?.defaultValue))
+ it.sigma = timeUtils.createTime(
+ RuntimeUtil.getExecutionTimeForCycles(sdCycles, amltCore?.frequencyDomain?.defaultValue))
- } else if (amltDistribution instanceof DiscreteValueUniformDistribution) {
- it.type = TimeDistributionType.UNIFORM
- } else if (amltDistribution instanceof DiscreteValueBetaDistribution) {
- } else if (amltDistribution instanceof DiscreteValueHistogram) {
- it.type = TimeDistributionType.DISCRETE
+ } else if (amltDistribution instanceof DiscreteValueUniformDistribution) {
+ it.type = TimeDistributionType.UNIFORM
+ } else if (amltDistribution instanceof DiscreteValueBetaDistribution) {
+ } else if (amltDistribution instanceof DiscreteValueHistogram) {
+ it.type = TimeDistributionType.DISCRETE
- amltDistribution.entries.forEach [ amltEntry |
+ amltDistribution.entries.forEach [ amltEntry |
- val amltAvg = (amltEntry.upperBound + amltEntry.lowerBound) / 2;
+ val amltAvg = (amltEntry.upperBound + amltEntry.lowerBound) / 2;
- val amltOccurrences = amltEntry.occurrences
+ val amltOccurrences = amltEntry.occurrences
- var inchronDiscreteDistributionEntry = inchronModelFactory.createDiscreteDistributionEntry
+ var inchronDiscreteDistributionEntry = inchronModelFactory.createDiscreteDistributionEntry
- inchronDiscreteDistributionEntry.count = amltOccurrences
+ inchronDiscreteDistributionEntry.count = amltOccurrences
- inchronDiscreteDistributionEntry.execTime = timeUtils.createTime(
- RuntimeUtil.getExecutionTimeForCycles(amltAvg, amltCore?.frequencyDomain?.defaultValue))
+ inchronDiscreteDistributionEntry.execTime = timeUtils.createTime(
+ RuntimeUtil.getExecutionTimeForCycles(amltAvg, amltCore?.frequencyDomain?.defaultValue))
- it.discreteDistribution.add(inchronDiscreteDistributionEntry)
- ]
- }
+ it.discreteDistribution.add(inchronDiscreteDistributionEntry)
+ ]
}
}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TransmissionPolicyTransformer.xtend b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TransmissionPolicyTransformer.xtend
new file mode 100644
index 0000000..f23950e
--- /dev/null
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.m2m/src/templates/m2m/sw/runnableItem/TransmissionPolicyTransformer.xtend
@@ -0,0 +1,35 @@
+/**
+ * *******************************************************************************
+ * Copyright (c) 2019 Robert Bosch GmbH and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Robert Bosch GmbH - initial API and implementation
+ * *******************************************************************************
+ */
+
+package templates.m2m.sw.runnableItem
+
+import com.google.inject.Singleton
+import org.eclipse.app4mc.amalthea.model.TransmissionPolicy
+import templates.AbstractAmaltheaInchronTransformer
+import com.google.inject.Inject
+
+@Singleton
+class TransmissionPolicyTransformer extends AbstractAmaltheaInchronTransformer {
+
+ @Inject TicksTransformer ticksTransformer
+
+ //TODO: this must be clarified when memory simulation details are set up by Inchron
+ def create inchronMemoryFactory.createExplicitDataAccess createExplicitDataAccess(TransmissionPolicy amltTransmissionPolicy) {
+ it.chunkSize = amltTransmissionPolicy.chunkSize.getValue.intValue
+ it.chunkPeriod = ticksTransformer.createTimeTicks(amltTransmissionPolicy.chunkProcessingTicks)
+ }
+
+
+}
diff --git a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.product/.gitignore b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.product/.gitignore
index e180425..c1445c1 100644
--- a/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.product/.gitignore
+++ b/eclipse-tools/model-transformation/examples/amlt2inchron/org.eclipse.app4mc.transform.to.inchron.product/.gitignore
@@ -2,4 +2,5 @@
/target/
/xtend-gen/
/output
-/input/*/Obfuscated_Model.amxmi
\ No newline at end of file
+/input/*/Obfuscated_Model.amxmi
+/input/*/*.*
\ No newline at end of file
diff --git a/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.application/src/org/eclipse/app4mc/transformation/application/base/ExecuteTransformation.xtend b/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.application/src/org/eclipse/app4mc/transformation/application/base/ExecuteTransformation.xtend
index e6ab5d7..545ca6b 100644
--- a/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.application/src/org/eclipse/app4mc/transformation/application/base/ExecuteTransformation.xtend
+++ b/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.application/src/org/eclipse/app4mc/transformation/application/base/ExecuteTransformation.xtend
@@ -64,8 +64,6 @@
m2mConfig.logger = logger
- Model2ModelRootTransformer.logger=logger
-
Model2ModelRootTransformer.properties=properties
Model2ModelRootTransformer.injector=injector
@@ -84,8 +82,6 @@
m2tConfig.logger = logger
- Model2TextRootTransformer.logger=logger
-
Model2TextRootTransformer.properties=properties
Model2TextRootTransformer.injector=injector
diff --git a/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.extensions/src/org/eclipse/app4mc/transformation/extensions/base/templates/AbstractTransformer.xtend b/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.extensions/src/org/eclipse/app4mc/transformation/extensions/base/templates/AbstractTransformer.xtend
index e414204..4e3c3a1 100644
--- a/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.extensions/src/org/eclipse/app4mc/transformation/extensions/base/templates/AbstractTransformer.xtend
+++ b/eclipse-tools/model-transformation/plugins/org.eclipse.app4mc.transformation.extensions/src/org/eclipse/app4mc/transformation/extensions/base/templates/AbstractTransformer.xtend
@@ -27,7 +27,7 @@
static public CustomObjectsStore customObjsStore = new CustomObjectsStore
- static public Logger logger
+ static private Logger logger
static public Properties properties