Commit 04492a7f authored by Alexander Diewald's avatar Alexander Diewald
Browse files

YELLOW

Issue-Ref: 4068
Issue-Url: https://af3-developer.fortiss.org/issues/4068

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent e3d5e1e5
AnnotationGenerationUtils.java 7bea1d5b363bc5649e6e3c5057a00f87d3224e6f RED
AnnotationGenerationUtils.java a4f1635f783e4764f963107fcbcb96bc070366ca YELLOW
CompArchGeneratonUtil.java 0f1e3c048884fa4df6a35b6a110c46da58f59857 GREEN
DseUtils.java 7a93f643bcc25adc9df3c53a1c8e74f89eda4608 GREEN
FileWriterUtil.java 4a95559f571d41fa44e6236fc055ab5baac7c384 GREEN
......
......@@ -37,7 +37,6 @@ import org.fortiss.af3.exploration.AF3ExplorationActivator;
import org.fortiss.af3.platform.model.ExecutionUnit;
import org.fortiss.af3.platform.model.PlatformArchitecture;
import org.fortiss.af3.platform.model.annotation.FlashSize;
import org.fortiss.af3.platform.model.annotation.RamSize;
import org.fortiss.af3.project.model.FileProject;
import org.fortiss.af3.safety.model.SIL;
import org.fortiss.af3.safety.model.annotation.SafetyIntegrityLevel;
......@@ -48,6 +47,7 @@ import org.fortiss.af3.task.model.timing.TaskStartEvent;
import org.fortiss.af3.timing.model.PeriodicConstraint;
import org.fortiss.af3.timing.model.TimingSpecification;
import org.fortiss.af3.timing.model.annotation.Wcet;
import org.fortiss.tooling.base.model.element.IAnnotatedSpecification;
import org.fortiss.tooling.kernel.utils.EcoreUtils;
/**
......@@ -67,17 +67,19 @@ public class AnnotationGenerationUtils {
/**
* Creates an expanded set of the given {@link ComponentArchitecture}s where each element is
* based on a copy of the given architectures The returned set is larger than the initial one.
* based on a copy of the given architectures. The returned set is larger than the initial one.
* The added annotation values are generated randomly.
*
* @param fileProjects
* Set of {@link FileProject}s to whose architectures
* {@link IAnnotatedSpecification}s are added.
* @return Set of {@link FileProject}s with {@link IAnnotatedSpecification}s.
*/
// TODO (SB): IMO the method should act according to its name actually expand the provided
// fileProjects. I.e., there is no need for a return value. However, the fileProjects parameter
// should be documented accordingly.
public static Collection<FileProject> expandArchitecturesByAnnotations(
Collection<FileProject> fileProjects) throws Exception {
// Add the expansion code for other
fileProjects = definePlatformArchitectureAnnotations(fileProjects);
fileProjects = expandPlatformArchitectureAnnotations(fileProjects);
fileProjects = expandTaskArchitecturesByAnnotations(fileProjects);
return fileProjects;
......@@ -87,54 +89,26 @@ public class AnnotationGenerationUtils {
* PlatformArchitecture Annotations.
**********************************************************************************************/
/** Amount of available RAM per ECU. */
// RAM is currently not used in constraints --> no need to generate them.
// TODO (SB): No dead code: Either remove, or provide a ticket (preferred solution)
// private final static Integer[] RAM_AMOUNT = {10, 100, 1000};
/** Amount of available Flash memory per ECU. */
private final static Integer[] FLASH_AMOUNT = {10, 100, 1000};
// TODO (SB): IMO the method should just expand the provided fileProjects. -> rename to
// expand... I.e., there is no need for a return value. However, the fileProjects parameter
// should be documented accordingly.
/** Sets the annotation values for the {@link PlatformArchitecture}s. */
/**
* Sets the annotation values for the {@link PlatformArchitecture}s.
*
* @param fileProjects
* Set of {@link FileProject}s to whose architectures
* {@link IAnnotatedSpecification}s are added.
* @return Set of {@link FileProject}s with {@link IAnnotatedSpecification}s.
*/
private static Collection<FileProject>
definePlatformArchitectureAnnotations(Collection<FileProject> fileProjects) {
fileProjects = defineRAM(fileProjects);
fileProjects = defineFlash(fileProjects);
fileProjects = defineSIL(fileProjects);
expandPlatformArchitectureAnnotations(Collection<FileProject> fileProjects) {
fileProjects = expandByFlash(fileProjects);
fileProjects = expandBySIL(fileProjects);
return fileProjects;
}
/** Sets the values of {@link RamSize} annotations. */
private static Collection<FileProject> defineRAM(Collection<FileProject> fileProjects) {
// TODO (SB): Do not comment out here, but rather at the caller site (with a TODO
// referencing the issue). See defineFlash() for further comments
// RAM is currently not used in constraints --> no need to generate them.
return fileProjects;
// Collection<FileProject> expandedProjects = new ArrayList<>();
// for(FileProject origProject : fileProjects) {
// for(int amount : RAM_AMOUNT) {
// FileProject project = copy(origProject);
// PlatformArchitecture platArch =
// pickFirstInstanceOf(PlatformArchitecture.class, project.getRootElements());
// List<RamSize> rams = getChildrenWithType(platArch, RamSize.class);
// rams.forEach(ram -> ram.setBytes(amount));
// expandedProjects.add(project);
// }
// }
// return expandedProjects;
}
// TODO (SB): IMO the method should just expand the provided fileProjects. -> rename to
// expand... (handle consistently in this class)?
// I.e., there is no need for a return value. However, the fileProjects parameter
// should be documented accordingly.
/** Sets the values of {@link FlashSize} annotations. */
private static Collection<FileProject> defineFlash(Collection<FileProject> fileProjects) {
private static Collection<FileProject> expandByFlash(Collection<FileProject> fileProjects) {
Collection<FileProject> expandedProjects = new ArrayList<>();
for(FileProject origProject : fileProjects) {
for(int amount : FLASH_AMOUNT) {
......@@ -150,12 +124,8 @@ public class AnnotationGenerationUtils {
return expandedProjects;
}
// TODO (SB): IMO the method should just expand the provided fileProjects. -> rename to
// expand... (handle consistently in this class)?
// I.e., there is no need for a return value. However, the fileProjects parameter
// should be documented accordingly.
/** Sets the values of {@link SafetyIntegrityLevel} annotations. */
private static Collection<FileProject> defineSIL(Collection<FileProject> fileProjects) {
private static Collection<FileProject> expandBySIL(Collection<FileProject> fileProjects) {
Random rand = new Random(System.currentTimeMillis());
Collection<FileProject> expandedProjects = new ArrayList<>();
......@@ -185,8 +155,13 @@ public class AnnotationGenerationUtils {
* TaskArchitecture Annotations.
**********************************************************************************************/
// TODO (SB): Document that fileProjects parameter is updated
/** Adds annotations to the {@link TaskArchitecture}s of the given {@link FileProject}s */
/**
* Adds annotations to the {@link TaskArchitecture}s of the given {@link FileProject}s.
*
* @param fileProjects
* {@link FileProject}s to be updated.
* @return Set of {@link FileProject}s with {@link IAnnotatedSpecification}s.
*/
private static Collection<FileProject> expandTaskArchitecturesByAnnotations(
Collection<FileProject> fileProjects) throws Exception {
Collection<FileProject> expandedFileProjects = new ArrayList<>();
......@@ -213,8 +188,18 @@ public class AnnotationGenerationUtils {
return expandedFileProjects;
}
// TODO (SB): Rename to expand and/or document that taskArch parameter is updated
/** Defines flash memory requirements of tasks based on an upper limit and random assignment. */
/**
* Defines flash memory requirements of tasks based on an upper limit and random assignment.
*
* @param taskArch
* modified.
* @param availableMemory
* available system memory
* @param memoryUsageRatio
* how much available memory may be defined as required by {@link Task}s.
* @param numExecUnits
* number of {@link ExecutionUnit}s of the platform.
*/
private static void defineTaskMemoryRequirements(TaskArchitecture taskArch,
long availableMemory, double memoryUsageRatio, int numExecUnits) throws Exception {
List<Task> tasks = taskArch.getTasks();
......@@ -228,8 +213,12 @@ public class AnnotationGenerationUtils {
}
}
// TODO (SB): Rename to expand and/or document that taskArch parameter is updated
/** Defines the WCETs of tasks. */
/**
* Defines the WCETs of tasks.
*
* @param taskArch
* modified.
*/
private static void defineWCETs(TaskArchitecture taskArch) {
Random rand = new Random(currentTimeMillis());
......
Supports Markdown
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