Commit af0ea603 authored by Johannes Eder's avatar Johannes Eder

- created dummy ecore models for start and duration of tasks/signals -> to be...

- created dummy ecore models for start and duration of tasks/signals -> to be removed when task architecture exists
- changed transformation of deployment from scheduling model into schedule model
refs 2923
parent edc13d5c
......@@ -17,4 +17,14 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="dimension" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="category"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StartTimeDummy" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DurationDummy" eSuperTypes="platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IAnnotatedSpecification platform:/resource/org.fortiss.tooling.base/model/base.ecore#//element/IHiddenSpecification">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="TODO: write documentation (in the model!)"/>
</eAnnotations>
</eClassifiers>
</ecore:EPackage>
......@@ -13,5 +13,7 @@
<genClasses ecoreClass="model.ecore#//CustomDimension">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute model.ecore#//CustomDimension/dimension"/>
</genClasses>
<genClasses ecoreClass="model.ecore#//StartTimeDummy"/>
<genClasses ecoreClass="model.ecore#//DurationDummy"/>
</genPackages>
</genmodel:GenModel>
......@@ -17,13 +17,14 @@ $Id: ComponentToSchedule.java 19365 2017-02-27 08:33:57Z eder $
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.smt.util;
import static org.fortiss.af3.deployment.utils.DeploymentUtils.existsHardwareConnection;
import static org.fortiss.af3.deployment.utils.DeploymentUtils.getTransmissionUnitConnection;
import static org.fortiss.af3.schedule.utils.AF3ScheduleModelElementFactory.createResourceAllocation;
import static org.fortiss.af3.schedule.utils.AF3ScheduleModelElementFactory.createSchedulableEntity;
import static org.fortiss.tooling.kernel.utils.UniqueIDUtils.generateAllIDs;
import java.math.BigDecimal;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.deployment.model.ComponentAllocation;
......@@ -68,8 +69,16 @@ public class DeploymentToSchedule {
public SystemSchedule generateSchedule() {
schedule = AF3ScheduleModelElementFactory.createSystemSchedule("SystemSchedule_");
schedule.setDeployment(deployment);
if(deployment.getComponentAllocations().isEmpty())
return null;
// cannot be null
// Workaround for getting platform architecture as the reference is not set in the
// deployment.
PlatformArchitecture pa =
(PlatformArchitecture)deployment.getPlatformArchitectureReference().getReference();
deployment.getComponentAllocations().get(0).getExecutionUnit()
.getPlatformArchitecture();
// PlatformArchitecture pa =
// (PlatformArchitecture)deployment.getPlatformArchitectureReference().getReference();
// ComponentArchitecture ca =
// (ComponentArchitecture)deployment.getComponentArchitectureReference()
// .getReference();
......@@ -87,10 +96,13 @@ public class DeploymentToSchedule {
/** Creates Nodes out of the {@link PlatformArchitecture}. */
private void createResourceSchedules(PlatformArchitecture pa) {
for(IHierarchicElement e : pa.getContainedElements()) {
if(e instanceof ExecutionUnit || e instanceof TransmissionUnit) {
ResourceSchedule resourceSchedule = createResourceSchedule((ExecutionUnit)e);
schedule.getContainedElements().add(resourceSchedule);
ResourceSchedule resourceSchedule = null;
if(e instanceof ExecutionUnit) {
resourceSchedule = createResourceSchedule((ExecutionUnit)e);
} else if(e instanceof TransmissionUnit) {
resourceSchedule = createResourceSchedule((TransmissionUnit)e);
}
schedule.getContainedElements().add(resourceSchedule);
}
}
......@@ -111,6 +123,9 @@ public class DeploymentToSchedule {
ResourceAllocation ra = createResourceAlloc(component);
resourceSchedule.getContainedElements().add(ra);
ra.setDuration(new BigDecimal(10));
SchedulableEntity compEntity = createSchedulableEntity("Task_" + component.getName());
compEntity.setModelElement(component);
ra.setSchedulableEntity(compEntity);
}
/** creates the signals. */
......@@ -120,13 +135,29 @@ public class DeploymentToSchedule {
for(OutputPort outputPort : component.getOutputPorts()) {
// only in case the sender and receiver are deployed on different execution units and a
// transmission unit is existing create a signal
if(outputPort.getOutgoingChannels().isEmpty() ||
!existsHardwareConnection(deployment, component, outputPort
.getOutgoingChannels().get(0).getTarget().getComponent())) {
TransmissionUnit bus = null;
for(Channel oc : outputPort.getOutgoingChannels()) {
bus =
getTransmissionUnitConnection(deployment, component, oc.getTarget()
.getComponent());
// takes the first found connection -> no routing
if(bus != null) {
continue;
}
}
if(bus == null) {
continue;
}
ResourceSchedule resourceSchedule = ScheduleUtils.getResourceSchedule(schedule, ecu);
// if(outputPort.getOutgoingChannels().isEmpty() ||
// !existsHardwareConnection(deployment, component, outputPort
// .getOutgoingChannels().get(0).getTarget().getComponent())) {
// continue;
// }
ResourceSchedule resourceSchedule = ScheduleUtils.getResourceSchedule(schedule, bus);
ResourceAllocation ra = createResourceAlloc(outputPort);
SchedulableEntity signal = createSchedulableEntity("Signal_" + outputPort.getName());
signal.setModelElement(outputPort);
ra.setSchedulableEntity(signal);
ra.setName(component.getName() + "_" + ra.getName());
resourceSchedule.getContainedElements().add(ra);
ra.setDuration(new BigDecimal(5));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment