Skip to content
Snippets Groups Projects
Commit 76c2dbde authored by Alexander Diewald's avatar Alexander Diewald
Browse files

Exploration(.alg): Remove unused classes.

* The DSEInputParameter container is no longer used --> Remove.
* Remove several porting classes of the MOEA-based DSE.
refs 3200
parent 24359ea6
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 651 deletions
......@@ -141,7 +141,7 @@ Export-Package: com.google.common.annotations,
org.fortiss.af3.exploration.model",
org.fortiss.af3.exploration.alg.exception,
org.fortiss.af3.exploration.alg.guava,
org.fortiss.af3.exploration.alg.port,
org.fortiss.af3.exploration.alg.plot,
org.fortiss.af3.exploration.alg.service,
org.fortiss.af3.exploration.alg.util,
org.fortiss.af3.exploration.dsl.model,
......
......@@ -34,9 +34,8 @@ import org.fortiss.af3.exploration.alg.dse.Explorer;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.StrictTTSchedule;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemModelAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.af3.AF3SystemModelAdapter;
import org.fortiss.af3.exploration.alg.port.plot.XYPlotter;
import org.fortiss.af3.exploration.alg.plot.XYPlotter;
import org.fortiss.af3.exploration.alg.service.IExplorationEncoding;
import org.fortiss.af3.exploration.backend.DseInputContainer;
import org.fortiss.af3.exploration.backend.IDseBackend;
import org.fortiss.af3.exploration.backend.RuleSetContainer;
import org.fortiss.af3.exploration.backend.SuperSetMap;
......@@ -191,11 +190,6 @@ public class Opt4JDseBackend implements IDseBackend {
}
}
/** Defines the required input parameters of this DSE backend. */
protected class Opt4JDSEInputParameters extends DseInputContainer {
// Parameter container wrapping a standard java map.
}
/** {@inheritDoc} */
@Override
public String getName() {
......
......@@ -23,10 +23,10 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.partitionmappi
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.TaskMappingEncoding;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.encoding.taskmapping.TaskMappingEntry;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.extensions.compositegene.phenotype.ComposablePhenotype;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ISignalAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.comm.Message;
import org.fortiss.af3.exploration.alg.service.IExplorationEncoding;
import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
/**
* {@link IExplorationEncoding} that defines the {@link Message}s which are transmitted on a target
......@@ -53,7 +53,7 @@ public class MessageEncoding<S extends TaskMappingEntry<ITaskAdapter<?>, Partiti
/** Returns all messages that are sent periodically. */
public Collection<Message> getPeriodicMessages() {
return filterSet(messages,
m -> m.getSignalAdapter().getSignalType() == SignalType.PERIODIC);
m -> m.getSignalAdapter().getSignalType() == ISignalAdapter.SignalType.PERIODIC);
}
/** {@inheritDoc} */
......
......@@ -10,9 +10,8 @@ IRequestAdapter.java bb7b3c05c4f52215cd79b27207bad8ce66a28506 RED
IResourceAdapter.java 634866895c9d1aa427f3c8d47e69acd807d0b582 RED
IResourceConnectionAdapter.java 7e20a8c3e60a9892597301556c891ba2dd43387f RED
ISafetyFunctionAdapter.java f20249e7c37f54774a9e8eaa0566a85492c80654 RED
ISignalAdapter.java d4e3f25bce705ad35e0ba633cf00b8a51db4cda7 RED
ISignalAdapter.java 4f04154c5802a4f1a5469df90652852e16727421 RED
ITaskAdapter.java 97ad40c0ca14be2fb4fd070214a3d6ebe5be914a RED
ITransmissionUnitAdapter.java 8965b73bfe9ef232a2a6d5427f7001761716d583 RED
InternalComponentParameters.java 2b19f4eeddee84e4c6e558ed9a1613cba33b7665 RED
SystemModelAdapter.java 393b4017059b41dc296d881a0fe39cfc83ccaa39 RED
SystemParameterContainer.java eddfc430acd8661dfe8ffbf191ef71a83157eff5 RED
......@@ -17,8 +17,6 @@ package org.fortiss.af3.exploration.alg.dse.sysmodel.arch;
import java.util.Collection;
import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
/**
* Adapter between logical channels of the system meta-model used in the modeling
* tool, and the DSE.
......@@ -26,6 +24,15 @@ import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
* @author barner
*/
public interface ISignalAdapter<S, T> extends IRequestAdapter<S> {
/** Temporal activation of the signal. */
public enum SignalType {
/** Purely event-based activation. */
APERIODIC,
/** Strictly periodic activation. */
PERIODIC,
/** Temporally upper-bounded, event-based activation. */
SPORADIC
}
/** Returns the source component of this {@link ISignalAdapter}. */
ITaskAdapter<?> getSource();
......
/*-------------------------------------------------------------------------+
| Copyright 2016 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.dse.sysmodel.arch;
import java.util.Collection;
import java.util.Map;
import org.conqat.lib.commons.collections.Pair;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.ComponentArchitecture;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType;
import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.IPlatformResource;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.annotation.ResourceLink;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IModelElement;
import com.google.common.collect.Multimap;
/**
*
* @author diewald
*/
public class SystemParameterContainer {
/** Collection of deployable {@link Component}s for the target platform. */
private Collection<Component> deployableComponents;
/**
* Maps the {@link Port}s of the deployable {@link Component}s to their temporal
* {@link SignalType} (aperiodic, sporadic, etc.).
*/
private Map<Port, SignalType> portSignalTypes;
/** {@link ExecutionUnit}s to which {@link Component}s are mapped. */
private Collection<ExecutionUnit> deploymentTargets;
/** Map relating deployable {@link Component}s with their respective periods. */
private Map<Component, Double> componentPeriodMap;
/**
* Relates {@link Component}s from the input {@link ComponentArchitecture} to their diverse
* implementations, i.e. concrete instances (if any).
*/
private Multimap<Component, Component> replacementComponents;
/**
* Associates deployable {@link Component}s with the number of minimally and maximally allowed
* replication (1 == no replication).
*/
private Map<Component, Pair<Integer, Integer>> componentReplicationBounds;
/**
* Associates the OutputPorts of the deployable {@link Component}s with the size of the messages
* they emit.
*/
private Map<OutputPort, Long> portMessageSizes;
/**
* Assotiates elements of the {@link PlatformArchitecture} with their respective mean failure
* rate.
*/
private Map<IPlatformArchitectureElement, Double> resourceFailureProbabilities;
/**
* Associates {@link IPlatformResource}s with their respective active power consumption (in
* watts).
*/
private Map<IPlatformResource, Double> resourcePowerConsumption;
/**
* Look up table to determine the input/output directions of {@link IConnector} types of the
* target {@link PlatformArchitecture}.
*/
private Map<Class<? extends IConnector>, ConnectionType> connectionTypeLUT;
/**
* Identifies the {@link IModelElement} types which establish a connection between two
* {@link PlatformArchitecture}s via an {@link ResourceLink}.
*/
private Pair<Class<? extends IModelElement>, Class<? extends IModelElement>> platfromInterconnectTypes;
/** Defines the fault containment region defined for the target {@link PlatformArchitecture}. */
private Class<? extends IPlatformResource> faultContainmentRegion;
/** Constructor. */
public SystemParameterContainer(Collection<Component> deployableComponents,
Map<Port, SignalType> portSignalTypes, Collection<ExecutionUnit> deploymentTargets,
Map<Component, Double> componentPeriodMap,
Multimap<Component, Component> replacementComponents,
Map<Component, Pair<Integer, Integer>> componentReplicationBounds,
Map<OutputPort, Long> portMessageSizes,
Map<IPlatformArchitectureElement, Double> resourceFailureMap,
Map<IPlatformResource, Double> resourcePowerConsumption,
Map<Class<? extends IConnector>, ConnectionType> connectionTypeLUT,
Pair<Class<? extends IModelElement>, Class<? extends IModelElement>> platfromInterconnectTypes,
Class<? extends IPlatformResource> faultContainmentRegion) {
this.deployableComponents = deployableComponents;
this.portSignalTypes = portSignalTypes;
this.deploymentTargets = deploymentTargets;
this.componentPeriodMap = componentPeriodMap;
this.replacementComponents = replacementComponents;
this.componentReplicationBounds = componentReplicationBounds;
this.portMessageSizes = portMessageSizes;
this.resourceFailureProbabilities = resourceFailureMap;
this.resourcePowerConsumption = resourcePowerConsumption;
this.connectionTypeLUT = connectionTypeLUT;
this.platfromInterconnectTypes = platfromInterconnectTypes;
this.faultContainmentRegion = faultContainmentRegion;
}
/** Returns the deployable {@link Component}s. */
public Collection<Component> getDeployableComponents() {
return deployableComponents;
}
/** Returns the {@link Port} to signal type associations. */
public Map<Port, SignalType> getPortSignalTypes() {
return portSignalTypes;
}
/** Returns the set of deployment targets (to where {@link Component}s may be mapped). */
public Collection<ExecutionUnit> getDeploymentTargets() {
return deploymentTargets;
}
/** Returns the associations of deployable {@link Component}s and their defined periods. */
public Map<Component, Double> getComponentPeriodMap() {
return componentPeriodMap;
}
/**
* Returns the associations between deployable {@link Component}s and their diverse
* implementations (if any).
*/
public Multimap<Component, Component> getReplacementComponents() {
return replacementComponents;
}
/**
* Returns the association between deployable {@link Component}s and their minimum and maximum
* replication bound.
*/
public Map<Component, Pair<Integer, Integer>> getComponentReplicationBounds() {
return componentReplicationBounds;
}
/**
* Returns the associations between the {@link OutputPort}s of deployable {@link Component}s and
* the size of the data they are sending.
*/
public Map<OutputPort, Long> getPortMessageSizes() {
return portMessageSizes;
}
/** Returns the associations between platform elements and their mean failur probability. */
public Map<IPlatformArchitectureElement, Double> getResourceFailureProbabilities() {
return resourceFailureProbabilities;
}
/**
* Returns the associations between platform elements and their mean active power consumption.
*/
public Map<IPlatformResource, Double> getResourcePowerConsumption() {
return resourcePowerConsumption;
}
/**
* Returns the lookup table mapping platform connectors their respective input output direction
* type.
*/
public Map<Class<? extends IConnector>, ConnectionType> getConnectionTypeLUT() {
return connectionTypeLUT;
}
/**
* Returns the {@link IModelElement} types connecting entities from different
* {@link PlatformArchitecture}s, e.g. a System Software and a Hardware Architecture.
*/
public Pair<Class<? extends IModelElement>, Class<? extends IModelElement>>
getPlatfromInterconnectTypes() {
return platfromInterconnectTypes;
}
/**
* Returns the {@link IPlatformResource} that is assumed to be the fault containment region of
* the target platform.
*/
public Class<? extends IPlatformResource> getFaultContainmentRegion() {
return faultContainmentRegion;
}
}
......@@ -7,7 +7,7 @@ AF3PlatformArchitectureAdapter.java fb657d182999dc73eed16c0adc57c5876c8104b9 RED
AF3RequestAdapter.java 7cfea424beeacaac81b48efd4e1c24270dcb3929 RED
AF3ResourceAdapter.java 00070d4e3ec7f19a672b6295c546fa1d30d7fc50 RED
AF3ResourceConnectionAdapter.java 0e791fd7d9602f4cf00f54c6254d31f1c9cc72b0 RED
AF3SignalAdapter.java 9ef141f12e93b851192d1e8cb0c2f68102afec8c RED
AF3SignalAdapter.java bc102b65b929393808eb747572f9ae05b04a8856 RED
AF3SystemModelAdapter.java 6ecf47e813341aa68f049a8cdec77782b98c2a96 RED
AF3TaskAdapter.java a3cfe04d7b235cc61031c5477de2cb54ac810aac RED
AF3TransmissionUnitAdapter.java 0ce1a08c29d75a05fb49668d02abddd852487a4c RED
......@@ -25,7 +25,6 @@ import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ISignalAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITaskAdapter;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.ITransmissionUnitAdapter;
import org.fortiss.af3.exploration.alg.exception.InvalidModelException;
import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
import org.fortiss.af3.platform.model.annotation.MessageSize;
import org.fortiss.af3.task.model.TaskInputPort;
import org.fortiss.af3.task.model.TaskOutputPort;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import java.awt.BasicStroke;
import java.awt.Color;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import java.awt.Color;
import java.awt.Graphics2D;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.StrictTTSchedule;
import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.StrictTTSchedule.ResourceSchedule;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import javax.swing.JFrame;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import java.util.HashMap;
import java.util.Map;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import java.util.ArrayList;
import java.util.HashMap;
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port.plot;
package org.fortiss.af3.exploration.alg.plot;
import static javax.swing.JOptionPane.YES_OPTION;
import static org.fortiss.af3.exploration.alg.ExplorationAlgActivator.PLUGIN_ID;
......
DSEPortingUtils.java 1cff814a5f34ff225087df1c807c0257a3d36b15 RED
/*-------------------------------------------------------------------------+
| Copyright 2017 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.exploration.alg.port;
import static org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType.BIDIRECTIONAL;
import static org.fortiss.af3.platform.utils.PlatformArchitectureUtils.getReferencedElementsWithType;
import static org.fortiss.tooling.common.util.LambdaUtils.filterStream;
import static org.fortiss.tooling.kernel.utils.EcoreUtils.getChildrenWithType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.conqat.lib.commons.collections.Pair;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.IResourceConnectionAdapter.ConnectionType;
import org.fortiss.af3.exploration.alg.dse.sysmodel.arch.SystemParameterContainer;
import org.fortiss.af3.exploration.backend.IDseInputContainer.DeployableComponents;
import org.fortiss.af3.exploration.backend.IDseInputContainer.SignalType;
import org.fortiss.af3.exploration.backend.IDseInputContainer.TemporalTriggers;
import org.fortiss.af3.exploration.dsl_v2.model.booleanp.allocation.Allocation;
import org.fortiss.af3.exploration.model.ExplorationSpecification;
import org.fortiss.af3.exploration.moea.model.annotation.ComponentDiverseImplRef;
import org.fortiss.af3.expression.model.types.TBool;
import org.fortiss.af3.expression.model.types.TDouble;
import org.fortiss.af3.expression.model.types.TInt;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.IPhysicalPlatformArchitectureElement;
import org.fortiss.af3.platform.model.IPlatformArchitectureElement;
import org.fortiss.af3.platform.model.IPlatformResource;
import org.fortiss.af3.platform.model.IVirtualizationPlatformArchitectureElement;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.TransmissionUnit;
import org.fortiss.af3.platform.utils.PlatformArchitectureUtils;
import org.fortiss.af3.project.model.typesystem.IType;
import org.fortiss.af3.task.model.TaskAllocation;
import org.fortiss.af3.task.model.TaskArchitecture;
import org.fortiss.tooling.base.model.element.IConnector;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
/**
*
* @author diewald
*/
public class DSEPortingUtils {
/**
* Lookup table for to determine the direction of a connection by the type of the target
* {@link IConnector}.
*/
// TODO: UsePlatformPort?
@Deprecated
public static Map<Class<? extends IConnector>, ConnectionType> connectionTypeLUT =
Collections.unmodifiableMap(new HashMap<Class<? extends IConnector>, ConnectionType>() {
{
}
});
/**
* Returns the type of communication the given port can handle: incoming, outgoing, or
* bidirectional traffic.
*
* @param sourceConnector
* {@link IConnector} to be examined.
* @return The port type (default = bidirectional).
*/
@Deprecated
public static ConnectionType getPortDirection(IConnector sourceConnector) {
ConnectionType connectionTypeSource = connectionTypeLUT.get(sourceConnector.getClass());
return connectionTypeSource != null ? connectionTypeSource : BIDIRECTIONAL;
}
/**
* Creates a collection of deployment targets (that are {@link ExecutionUnit}s) from the given
* collection of {@code platformArchitecture}s.
*/
// TODO: Outdated Comment, the identification
@Deprecated
public static Collection<ExecutionUnit>
createDeploymentTargets(ExplorationSpecification expSpec) throws Exception {
Collection<ExecutionUnit> rval = new HashSet<>();
Collection<Allocation> allocConstrSet =
EcoreUtils.getChildrenWithType(expSpec, Allocation.class);
for(Allocation alloc : allocConstrSet) {
Collection<IModelElement> targetElementSet =
(Collection<IModelElement>)alloc.getRight().getSetReference().getEntries();
filterStream(targetElementSet, e -> e instanceof ExecutionUnit)
.map(ExecutionUnit.class::cast).forEach(e -> rval.add(e));
}
// for(PlatformArchitecture curPA : platformArchitectures) {
// for(DeploymentGranularity deplAnn : getChildrenWithType(curPA,
// DeploymentGranularity.class)) {
// IModelElement execUnit = deplAnn.getSpecificationOf();
//
// // If the current deployment target is a virtual ExecutionUnit, e.g. a partition,
// // ensure that none its referenced physical ExecutionUnits (or any of theri parents)
// // are also selected as deployment targets.
// if(execUnit instanceof IVirtualizationPlatformArchitectureElement &&
// execUnit instanceof ExecutionUnit) {
// for(IHierarchicElement currentHardwareResource : getReferencedElementsWithType(
// execUnit, IHierarchicElement.class)) {
// if(isAnyParentDeploymentTarget(currentHardwareResource)) {
// String refHwResourceName = currentHardwareResource.toString();
// if(currentHardwareResource instanceof INamedElement) {
// refHwResourceName =
// ((INamedElement)currentHardwareResource).getName() +
// "(id: " +
// ((INamedElement)currentHardwareResource).getId() +
// ")";
// }
// throw new Exception("The referenced hardware resource " +
// refHwResourceName +
// " or one of its containers of the virtual element " +
// ((ExecutionUnit)execUnit).getName() + "(id: " +
// ((ExecutionUnit)execUnit).getId() +
// ") has been chosen as a deployment target.\n" +
// "This is not allowed for elements with a virtualization layer.");
// }
// }
// }
//
// if(execUnit instanceof ExecutionUnit && deplAnn.isIsDeploymentTarget()) {
// rval.add((ExecutionUnit)execUnit);
// }
// }
// }
if(rval.isEmpty()) {
throw new Exception(
"No deployment targets have been specified in the target platform architecture(s)." +
" Please check whether the correct platform architecture was selected and whether" +
" the desired Execution Units were selected as deployment targets" +
" (Platform Model --> Annotation View --> Deployment Target)");
}
return rval;
}
// TODO: Why is the FailureRate annotation bound to IPhysicalPlatformElement instead of
// IPlatformResource?
/**
* Creates a Map that relates all annotated {@link IPlatformArchitectureElement}s with their
* specified failure rate.
*/
@Deprecated
public static Map<IPlatformArchitectureElement, Double> createFailureRateMap(
Collection<PlatformArchitecture> platformArchitectures) throws Exception {
Map<IPlatformArchitectureElement, Double> failureRateMap = new HashMap<>();
for(PlatformArchitecture pa : platformArchitectures) {
for(IPlatformArchitectureElement platformElement : getChildrenWithType(pa,
IPlatformArchitectureElement.class)) {
failureRateMap.put(platformElement, getResourceFailureRate(platformElement));
}
}
return failureRateMap;
}
/**
* Extracts the failure probability of a given {@link IPlatformResource}. If the
* {@code resourceElement} is a {@link IVirtualizationPlatformArchitectureElement}, the average
* value of the referenced {@link IPhysicalPlatformArchitectureElement}s is used.
*
* @param resourceElement
* resource for which to determine the failure probability.
* @return failure probability of the given {@code resourceElement}.
* @throws Exception
* if the failure probability is not correctly defined in the model.
*/
// TODO: check, whether it make sense to move the failure rate annotation to the AF3 platform
// since it would allow a simple analysis of hierarchical platforms.
@Deprecated
public static Double getResourceFailureRate(IPlatformArchitectureElement resourceElement)
throws Exception {
// If the annotated element is a part of the system software, the resource links are used to
// determine the speed of the associated resources.
if(resourceElement instanceof IVirtualizationPlatformArchitectureElement) {
Collection<IPhysicalPlatformArchitectureElement> associatedResources =
getReferencedElementsWithType(resourceElement,
IPhysicalPlatformArchitectureElement.class);
if(!(associatedResources.isEmpty())) {
Double avgFailureRate = Double.valueOf(0);
for(IPhysicalPlatformArchitectureElement currentAssociatedResource : associatedResources) {
if(currentAssociatedResource instanceof IModelElement) {
// TODO: For now, just use a default value.
return 10E-6;
// FailureRate failureRateAnnotation =
// getAnnotation((IModelElement)currentAssociatedResource,
// FailureRate.class);
//
// if(failureRateAnnotation != null) {
// avgFailureRate += failureRateAnnotation.getFailureRate_FIT();
// } else {
// throw new Exception("The platform resource " +
// currentAssociatedResource +
// " does not have a failure rate annotation.");
// }
}
}
return avgFailureRate / associatedResources.size();
} else if(resourceElement instanceof ExecutionUnit) {
// For now the failure rates are only evaluated for ExecutionUnits, so the failure
// rate annotation is only required for these resources.
throw new Exception("The virtual resource " + resourceElement.toString() +
" does not reference a physical resource");
}
} else {
// TODO: For now, just use a default value.
return 10E-6;
// FailureRate failureRateAnnotation =
// pickFirstInstanceOf(FailureRate.class,
// ((IModelElement)resourceElement).getSpecifications());
//
// if(failureRateAnnotation != null) {
// return failureRateAnnotation.getFailureRate_FIT();
// }
// throw new Exception("The platform resource " + resourceElement +
// " does not have a failure rate annotation.");
}
return null;
// throw new Exception("The failure rate for the platform resource " + resourceElement +
// " coult not be determined.");
}
/**
* Creates a map of all {@link IPlatformResource} which have an annotated power consumption
* value and their specified value.
*/
@Deprecated
public static Map<IPlatformResource, Double> createPowerConsumptionMap(
Collection<PlatformArchitecture> platformArchitectures) throws Exception {
Map<IPlatformResource, Double> powerConsumptionMap = new HashMap<>();
powerConsumptionMap.putAll(getTransmissionUnitPowerConsumption(platformArchitectures));
return powerConsumptionMap;
}
/** Maps all {@link TransmissionUnit}s to their annotated power consumption value. */
// TODO: We need a way to define the energy consumed by transmission units like busses: stand-by
// + active. Currently, we hard-code the consumed energy while a transmission Unit is active
// while we assue that it does not consume energy in the idle state.
@Deprecated
public static Map<IPlatformResource, Double> getTransmissionUnitPowerConsumption(
Collection<PlatformArchitecture> platformArchitectures) {
Map<IPlatformResource, Double> powerConsumptionMap = new HashMap<>();
for(PlatformArchitecture pa : platformArchitectures) {
for(TransmissionUnit tu : getChildrenWithType(pa, TransmissionUnit.class)) {
powerConsumptionMap.put(tu, 1.0);
}
}
return powerConsumptionMap;
}
/**
* Maps all deployable {@link Component}s to their specified periodicities. Non-periodic
* {@link Component} are not supported.
*/
// TODO: The period is hard-coded here. It must be taken from the yet-to-come timing model.
@Deprecated
public static Map<Component, Double>
createComponentPeriodMap(Collection<Component> deployableComponents) {
Map<Component, Double> componentPeriodMap = new HashMap<>();
for(Component deployableComponent : deployableComponents) {
componentPeriodMap.put(deployableComponent, 10.0);
}
return componentPeriodMap;
}
/**
* Maps all "abstract" and deployable {@link Component}s the set of {@link Component}s which are
* selected as their diverse implementations by means of the {@link ComponentDiverseImplRef}
* annotation.
*/
@Deprecated
public static Multimap<Component, Component>
createComponentReplacementMap(Collection<Component> deployableComponent) {
Multimap<Component, Component> replacementComponentMap = HashMultimap.create();
for(Component component : deployableComponent) {
// ComponentDiverseImplRef componentReplacementRef =
// AnnotationUtils.getAnnotation(component, ComponentDiverseImplRef.class);
// replacementComponentMap.putAll(component, componentReplacementRef.getComponentRef());
replacementComponentMap.putAll(component, Collections.emptyList());
}
return replacementComponentMap;
}
/**
* Maps all deployable {@link Component}s to their amount of minimal required and maximally
* allowed replicas. A value of 1 implies that the component is present only once (without
* actual replica in the resulting solution calculated by the DSE).
*/
// TODO: How to handle replication? Will be done on the Task level. Annotation can be registered
// in THIS exploration plugin.
@Deprecated
public static Map<Component, Pair<Integer, Integer>> createComponentReplicationMap(
Collection<Component> deployableComponents) throws Exception {
Map<Component, Pair<Integer, Integer>> replicationBoundMap = new HashMap<>();
for(Component component : deployableComponents) {
// ReplicationBounds replicationBounds = getAnnotation(component,
// ReplicationBounds.class);
// if(replicationBounds == null) {
// throw new Exception("The replication bounds of the component " +
// component.getName() + " is not defined.");
// }
Pair<Integer, Integer> minMaxBounds = new Pair<>(1, 1);
replicationBoundMap.put(component, minMaxBounds);
}
return replicationBoundMap;
}
/**
* Returns the temporal triggers of the deployable {@link Component}s' {@link Port}s.
*
* @param deployableComponents
* Collection of {@link Component}s tthat shall be deployed.
* @return Map of the ports with a temporal trigger.
*/
@Deprecated
public static TemporalTriggers
getPortTimingProperties(DeployableComponents deployableComponents) {
TemporalTriggers portSignalTypes = new TemporalTriggers();
Collection<Port> allPorts = new ArrayList<>();
for(Component currComp : deployableComponents) {
allPorts.addAll(getChildrenWithType(currComp, Port.class));
}
allPorts.parallelStream().forEach(p -> portSignalTypes.put(p, SignalType.PERIODIC));
return portSignalTypes;
}
/** Maps the {@link OutputPort}s of {@link Component}s to their respective bit size. */
@Deprecated
public static Map<OutputPort, Long>
createMessageSizeMap(Collection<Component> deployableComponents) throws Exception {
Map<OutputPort, Long> messageSizes = new HashMap<>();
for(Component component : deployableComponents) {
for(OutputPort port : component.getOutputPorts()) {
IType outType = port.getVariableType();
// TODO: Primitive fixed bit length assignments for the types. Should be done based
// on the platform.
if(outType instanceof TBool) {
messageSizes.put(port, (long)1);
} else if(outType instanceof TInt) {
messageSizes.put(port, (long)32);
} else if(outType instanceof TDouble) {
messageSizes.put(port, (long)64);
} else {
throw new Exception("No type has been defined for the output port" + port +
" that is compatible with the MOEA-based DSE exploration.");
}
}
}
return messageSizes;
}
/**
* Creates a container that contains all required and optional information to execute the
* MOEA-based DSE which are not AF3 standard parameters.
*/
@Deprecated
public static SystemParameterContainer createSystemParameterContainer(
PlatformArchitecture platformArchitecture, TaskArchitecture taskArchitecture,
ExplorationSpecification expSpec) throws Exception {
DeployableComponents deployableComponents = new DeployableComponents();
// TODO: We select the atomic components from the ComponentArchitecture to be deployed at
// the moment. Instead, the TaskArchitecture should be used here.
for(TaskAllocation taskAlloc : taskArchitecture.getTaskAllocations()) {
deployableComponents.addAll(taskAlloc.getComponents());
}
// Set: if we have only a hardware platform, then it will be returned by getHardwarePlatform
// --> no duplicates.
Set<PlatformArchitecture> targetPlatforms = new HashSet<>();
targetPlatforms.add(platformArchitecture);
targetPlatforms.add(
PlatformArchitectureUtils.getPhysicalPlatformArchitecture(platformArchitecture));
Collection<ExecutionUnit> deploymentTargets = createDeploymentTargets(expSpec);
return new SystemParameterContainer(deployableComponents,
getPortTimingProperties(deployableComponents), deploymentTargets,
createComponentPeriodMap(deployableComponents),
createComponentReplacementMap(deployableComponents),
createComponentReplicationMap(deployableComponents),
createMessageSizeMap(deployableComponents), createFailureRateMap(targetPlatforms),
createPowerConsumptionMap(targetPlatforms), connectionTypeLUT, null, null);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment