diff --git a/alisa/org.osate.verify/META-INF/MANIFEST.MF b/alisa/org.osate.verify/META-INF/MANIFEST.MF
index 194f29b57bc..bd3fc883f09 100644
--- a/alisa/org.osate.verify/META-INF/MANIFEST.MF
+++ b/alisa/org.osate.verify/META-INF/MANIFEST.MF
@@ -25,7 +25,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re
org.junit;bundle-version="[4.11.0,5.0.0)",
org.osate.analysis.architecture;bundle-version="[2.0.0,3.0.0)",
org.osate.analysis.flows;bundle-version="[5.0.0,6.0.0)",
- org.osate.analysis.resource.budgets;bundle-version="[4.0.0,5.0.0)",
+ org.osate.analysis.resource.budgets;bundle-version="[4.1.0,5.0.0)",
org.osate.analysis.resource.management;bundle-version="[4.0.0,5.0.0)",
org.eclipse.core.runtime;bundle-version="[3.10.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.9.1,4.0.0)",
diff --git a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PortConnectionConsistency.java b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PortConnectionConsistency.java
index 2f10b4cbe32..2c8a87acb67 100644
--- a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PortConnectionConsistency.java
+++ b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PortConnectionConsistency.java
@@ -1,18 +1,18 @@
/**
- * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
+ * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
* All Rights Reserved.
- *
+ *
* NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
* OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
* MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
- *
+ *
* 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
- *
+ *
* Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
- *
+ *
* This program includes and/or can make use of certain third party source code, object code, documentation and other
* files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
* configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
@@ -28,8 +28,6 @@
import org.osate.aadl2.EnumerationLiteral;
import org.osate.aadl2.NamedElement;
import org.osate.aadl2.RecordValue;
-import org.osate.aadl2.contrib.aadlproject.SizeUnits;
-import org.osate.aadl2.contrib.util.AadlContribUtils;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.ConnectionInstanceEnd;
import org.osate.aadl2.instance.FeatureInstance;
@@ -82,8 +80,8 @@ public void doHeaders() {
}
public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, ConnectionInstance conni) {
- double srcDataSize = AadlContribUtils.getDataSize(srcFI, SizeUnits.BYTES);
- double dstDataSize = AadlContribUtils.getDataSize(dstFI, SizeUnits.BYTES);
+ double srcDataSize = GetProperties.getSourceDataSizeInBytes(srcFI);
+ double dstDataSize = GetProperties.getSourceDataSizeInBytes(dstFI);
RecordValue srcRate = GetProperties.getOutPutRate(srcFI);
RecordValue dstRate = GetProperties.getInPutRate(dstFI);
@@ -119,12 +117,10 @@ public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, C
+ " Bytes differ");
}
} else {
- if (srcDataSize == 0 && dstDataSize > 0) {
+ if (srcDataSize == 0 && dstDataSize > 0)
error(conni, "Source data size is missing or zero");
- }
- if (dstDataSize == 0 && srcDataSize > 0) {
+ if (dstDataSize == 0 && srcDataSize > 0)
error(conni, "Destination data size is missing or zero");
- }
}
if (srcRU != null && dstRU != null && srcRU != dstRU) {
@@ -153,12 +149,10 @@ public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, C
"Source data rate " + srcRateValue + " and destination data rate " + dstRateValue + " differ");
}
} else {
- if (srcRateValue == 0 && dstRateValue > 0) {
+ if (srcRateValue == 0 && dstRateValue > 0)
error(conni, "Source data rate is missing or zero");
- }
- if (dstRateValue == 0 && srcRateValue > 0) {
+ if (dstRateValue == 0 && srcRateValue > 0)
error(conni, "Destination data rate is missing or zero");
- }
}
if (srcC != null && dstC != null) {
@@ -167,12 +161,10 @@ public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, C
+ " differ");
}
} else {
- if (srcC == null && dstC != null) {
+ if (srcC == null && dstC != null)
error(conni, "Source base type is missing");
- }
- if (dstC == null && srcC != null) {
+ if (dstC == null && srcC != null)
error(conni, "Destination base type is missing");
- }
}
if (srcS.length() > 0 && dstS.length() > 0) {
@@ -181,12 +173,10 @@ public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, C
"Source measurement unit " + srcS + " and destination measurement unit " + dstS + " differ");
}
} else {
- if (srcS.length() == 0 && dstS.length() > 0) {
+ if (srcS.length() == 0 && dstS.length() > 0)
error(conni, "Source measurement unit is missing");
- }
- if (dstS.length() == 0 && srcS.length() > 0) {
+ if (dstS.length() == 0 && srcS.length() > 0)
error(conni, "Destination measurement unit is missing");
- }
}
}
@@ -195,9 +185,8 @@ public void checkPortConsistency(FeatureInstance srcFI, FeatureInstance dstFI, C
protected void error(NamedElement el, String s) {
super.error(el, s);
if (previousNE == null || previousNE != el) {
- if (previousNE != null) {
+ if (previousNE != null)
handler.logInfo("");
- }
handler.logInfo(el.getName() + "," + s);
} else {
handler.logInfo("," + s);
diff --git a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PropertyTotals.java b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PropertyTotals.java
index 50202f4ff67..080f137d4d6 100644
--- a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PropertyTotals.java
+++ b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/PropertyTotals.java
@@ -1,18 +1,18 @@
/**
- * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
+ * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
* All Rights Reserved.
- *
+ *
* NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
* OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
* MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
- *
+ *
* 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
- *
+ *
* Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
- *
+ *
* This program includes and/or can make use of certain third party source code, object code, documentation and other
* files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
* configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
@@ -23,8 +23,6 @@
*/
package org.osate.analysis.architecture;
-import java.util.EnumSet;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.EList;
@@ -32,13 +30,9 @@
import org.osate.aadl2.instance.ComponentInstance;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.ConnectionInstanceEnd;
-import org.osate.aadl2.instance.ConnectionKind;
import org.osate.aadl2.instance.FeatureCategory;
import org.osate.aadl2.instance.FeatureInstance;
import org.osate.aadl2.modelsupport.modeltraversal.AadlProcessingSwitchWithProgress;
-import org.osate.contribution.sei.sei.Sei;
-import org.osate.contribution.sei.sei.Weightunits;
-import org.osate.pluginsupport.properties.PropertyUtils;
import org.osate.result.AnalysisResult;
import org.osate.result.Diagnostic;
import org.osate.result.DiagnosticType;
@@ -47,6 +41,7 @@
import org.osate.result.ResultFactory;
import org.osate.result.util.ResultUtil;
import org.osate.ui.handlers.AbstractAaxlHandler;
+import org.osate.xtext.aadl2.properties.util.GetProperties;
/**
* @author phf
@@ -79,7 +74,7 @@ private double calcPrice(ComponentInstance ci) {
for (ComponentInstance subi : cil) {
price += calcPrice(subi);
}
- price += Sei.getPrice(ci).orElse(0.0);
+ price += GetProperties.getPrice(ci, 0.0);
return price;
}
@@ -143,19 +138,13 @@ public static AnalysisResult invoke(ComponentInstance ci) {
return result;
}
- private static final EnumSet hasWeight = EnumSet.of(ComponentCategory.SYSTEM,
- ComponentCategory.PROCESSOR, ComponentCategory.MEMORY, ComponentCategory.BUS, ComponentCategory.DEVICE,
- ComponentCategory.ABSTRACT);
-
private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
Result result = ResultFactory.eINSTANCE.createResult();
result.setModelElement(ci);
- final boolean getWeight = hasWeight.contains(ci.getCategory());
- final double net = getWeight ? PropertyUtils.getScaled(Sei::getNetweight, ci, Weightunits.KG).orElse(0.0) : 0.0;
+ final double net = GetProperties.getNetWeight(ci, 0.0);
double weight = 0.0;
- final double gross = getWeight ? PropertyUtils.getScaled(Sei::getGrossweight, ci, Weightunits.KG).orElse(0.0)
- : 0.0;
+ final double gross = GetProperties.getGrossWeight(ci, 0.0);
double sublimit = 0.0;
EList cil = ci.getComponentInstances();
for (ComponentInstance subi : cil) {
@@ -166,9 +155,7 @@ private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
result.getSubResults().add(subresult);
double subweight = ResultUtil.getReal(subresult, 0);
weight += subweight;
- sublimit += hasWeight.contains(subi.getCategory())
- ? PropertyUtils.getScaled(Sei::getWeightlimit, subi, Weightunits.KG).orElse(0.0)
- : 0.0;
+ sublimit += GetProperties.getWeightLimit(subi, 0.0);
}
}
EList connl = ci.getConnectionInstances();
@@ -179,10 +166,8 @@ private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
&& ((FeatureInstance) source).getCategory() == FeatureCategory.BUS_ACCESS)
|| (destination instanceof FeatureInstance
&& ((FeatureInstance) destination).getCategory() == FeatureCategory.BUS_ACCESS)) {
- double netconn = PropertyUtils.getScaled(Sei::getNetweight, connectionInstance, Weightunits.KG)
- .orElse(0.0);
- double grossconn = PropertyUtils.getScaled(Sei::getGrossweight, connectionInstance, Weightunits.KG)
- .orElse(0.0);
+ double netconn = GetProperties.getNetWeight(connectionInstance, 0.0);
+ double grossconn = GetProperties.getGrossWeight(connectionInstance, 0.0);
weight += netconn > 0 ? netconn : grossconn;
if (netconn > 0 || grossconn > 0) {
String ResultMsg = String.format(
@@ -190,9 +175,7 @@ private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
netconn > 0 ? netconn : grossconn);
result.getDiagnostics().add(ResultUtil.createInfoDiagnostic(ResultMsg, connectionInstance));
}
- sublimit += connectionInstance.getKind() == ConnectionKind.ACCESS_CONNECTION
- ? PropertyUtils.getScaled(Sei::getWeightlimit, connectionInstance, Weightunits.KG).orElse(0.0)
- : 0.0;
+ sublimit += GetProperties.getWeightLimit(connectionInstance, 0.0);
}
}
if (weight == 0.0 && cil.isEmpty()) {
@@ -223,8 +206,7 @@ private static Result calcWeight(ComponentInstance ci, boolean needWeight) {
weight = gross;
}
}
- final double limit = getWeight ? PropertyUtils.getScaled(Sei::getWeightlimit, ci, Weightunits.KG).orElse(0.0)
- : 0.0;
+ final double limit = GetProperties.getWeightLimit(ci, 0.0);
if (limit > 0.0) {
if (weight > limit) {
// problem
diff --git a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/CheckBindingConstraints.java b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/CheckBindingConstraints.java
index 9f2def24842..3abc0930955 100644
--- a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/CheckBindingConstraints.java
+++ b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/CheckBindingConstraints.java
@@ -52,7 +52,6 @@
import org.osate.aadl2.Element;
import org.osate.aadl2.EnumerationLiteral;
import org.osate.aadl2.NamedElement;
-import org.osate.aadl2.contrib.deployment.DeploymentProperties;
import org.osate.aadl2.instance.ComponentInstance;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.FeatureCategory;
@@ -264,10 +263,9 @@ private static List checkRequiredAndProvided(Stream b
return bindingElements.flatMap(element -> {
Set required = Collections.unmodifiableSet(new HashSet<>(getRequired.apply(element)));
if (!required.isEmpty()) {
- return DeploymentProperties.getActualConnectionBinding(element).orElse(Collections.emptyList()).stream()
- .flatMap(boundElement -> {
+ return GetProperties.getActualConnectionBinding(element).stream().flatMap(boundElement -> {
Set missingSet = new HashSet<>(required);
- missingSet.removeAll(getProvided.apply((ComponentInstance) boundElement));
+ missingSet.removeAll(getProvided.apply(boundElement));
return missingSet.stream().map(missing -> {
StringBuilder message = new StringBuilder(getTitle(element));
message.append(" '");
diff --git a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/MissRateProperties.java b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/MissRateProperties.java
index f67084e5abf..f4e97d8d54d 100644
--- a/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/MissRateProperties.java
+++ b/analyses/org.osate.analysis.architecture/src/org/osate/analysis/architecture/handlers/MissRateProperties.java
@@ -1,18 +1,18 @@
/**
- * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
+ * Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).
* All Rights Reserved.
- *
+ *
* NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
* OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
* MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
- *
+ *
* 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
- *
+ *
* Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
- *
+ *
* This program includes and/or can make use of certain third party source code, object code, documentation and other
* files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
* configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
@@ -34,10 +34,6 @@
import org.osate.contribution.sei.names.SEI;
import org.osate.xtext.aadl2.properties.util.GetProperties;
-/**
- * @deprecated Will be removed in 2.10.0. Dead code. If you are using this for some reason, replace it with {@link SEI#getStreammissrate}.
- */
-@Deprecated
public class MissRateProperties {
public static double getStreamMissRate(final NamedElement ph) throws InvalidModelException,
diff --git a/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/ReferenceProcessorScalingTest.xtend b/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/ReferenceProcessorScalingTest.xtend
index dd52f78b6dc..0b1ee69374a 100644
--- a/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/ReferenceProcessorScalingTest.xtend
+++ b/analyses/org.osate.analysis.flows.tests/src/org/osate/analysis/flows/tests/ReferenceProcessorScalingTest.xtend
@@ -68,8 +68,8 @@ class ReferenceProcessorScalingTest extends XtextTest {
var checker = new FlowLatencyAnalysisSwitch()
var latencyresult = checker.invoke(instance, som,true,true,false,true, false)
val resab = latencyresult.results.get(0)
- assertEquals(200.0, (resab.values.get(1) as RealValue).value, 0.0)
- assertEquals(400.0, (resab.values.get(2) as RealValue).value, 0.0)
+ assertTrue((resab.values.get(1) as RealValue).value == (200.0))
+ assertTrue((resab.values.get(2) as RealValue).value == (400.0))
// instantiate
val sysImplu = cls.findFirst[name == 'top.iu'] as SystemImplementation
@@ -80,8 +80,8 @@ class ReferenceProcessorScalingTest extends XtextTest {
checker = new FlowLatencyAnalysisSwitch()
latencyresult = checker.invoke(instanceu, som,true,true,false,true, false)
val rescd = latencyresult.results.get(0)
- assertEquals(50.0, (rescd.values.get(1) as RealValue).value, 0.0)
- assertEquals(100.0, (rescd.values.get(2) as RealValue).value, 0.0)
+ assertTrue((rescd.values.get(1) as RealValue).value == (50.0))
+ assertTrue((rescd.values.get(2) as RealValue).value == (100.0))
}
}
diff --git a/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF
index f767011f560..0ef48cce8d2 100644
--- a/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF
+++ b/analyses/org.osate.analysis.flows/META-INF/MANIFEST.MF
@@ -15,8 +15,8 @@ Export-Package: org.osate.analysis.flows,
org.osate.analysis.flows.reporting.model
Require-Bundle: org.osate.aadl2;bundle-version="[4.0.0,5.0.0)",
org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)",
- org.osate.ui;bundle-version="[6.2.0,7.0.0)",
- org.osate.xtext.aadl2.properties;bundle-version="[3.1.0,4.0.0)",
+ org.osate.ui;bundle-version="[6.1.0,7.0.0)",
+ org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.0.0)",
org.osate.contribution.sei;bundle-version="[1.2.0,3.0.0)",
org.osate.pluginsupport;bundle-version="[7.1.0,8.0.0)",
org.osate.aadl2.contrib;bundle-version="[1.1.0,2.0.0)",
diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java
index 0e1d5fc6781..b690d2e64a6 100644
--- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java
+++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/FlowLatencyAnalysisSwitch.java
@@ -24,21 +24,17 @@
package org.osate.analysis.flows;
import java.util.Collections;
-import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Function;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.EcoreUtil2;
-import org.osate.aadl2.Aadl2Package;
import org.osate.aadl2.Classifier;
import org.osate.aadl2.ComponentCategory;
import org.osate.aadl2.ComponentClassifier;
@@ -46,14 +42,7 @@
import org.osate.aadl2.FlowEnd;
import org.osate.aadl2.NamedElement;
import org.osate.aadl2.Property;
-import org.osate.aadl2.PropertyAssociation;
-import org.osate.aadl2.contrib.aadlproject.SizeUnits;
-import org.osate.aadl2.contrib.aadlproject.TimeUnits;
-import org.osate.aadl2.contrib.communication.CommunicationProperties;
-import org.osate.aadl2.contrib.communication.TransmissionTime;
-import org.osate.aadl2.contrib.deployment.DeploymentProperties;
-import org.osate.aadl2.contrib.timing.TimingProperties;
-import org.osate.aadl2.contrib.util.AadlContribUtils;
+import org.osate.aadl2.UnitLiteral;
import org.osate.aadl2.instance.ComponentInstance;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.EndToEndFlowInstance;
@@ -66,9 +55,6 @@
import org.osate.aadl2.instance.SystemOperationMode;
import org.osate.aadl2.instance.util.InstanceSwitch;
import org.osate.aadl2.modelsupport.modeltraversal.AadlProcessingSwitchWithProgress;
-import org.osate.aadl2.modelsupport.scoping.Aadl2GlobalScopeUtil;
-import org.osate.aadl2.properties.PropertyAcc;
-import org.osate.analysis.flows.internal.utils.AnalysisUtils;
import org.osate.analysis.flows.internal.utils.FlowLatencyUtil;
import org.osate.analysis.flows.model.LatencyCSVReport;
import org.osate.analysis.flows.model.LatencyContributor;
@@ -77,14 +63,15 @@
import org.osate.analysis.flows.model.LatencyContributorConnection;
import org.osate.analysis.flows.model.LatencyReport;
import org.osate.analysis.flows.model.LatencyReportEntry;
-import org.osate.contribution.sei.arinc653.ScheduleWindow;
-import org.osate.contribution.sei.sei.Sei;
-import org.osate.pluginsupport.properties.IntegerRangeWithUnits;
-import org.osate.pluginsupport.properties.PropertyUtils;
-import org.osate.pluginsupport.properties.RealRange;
+import org.osate.contribution.sei.names.SEI;
import org.osate.result.AnalysisResult;
import org.osate.result.Result;
+import org.osate.xtext.aadl2.properties.util.ARINC653ScheduleWindow;
+import org.osate.xtext.aadl2.properties.util.AadlProject;
+import org.osate.xtext.aadl2.properties.util.CommunicationProperties;
+import org.osate.xtext.aadl2.properties.util.GetProperties;
import org.osate.xtext.aadl2.properties.util.InstanceModelUtil;
+import org.osate.xtext.aadl2.properties.util.PropertyUtils;
/**
* @author phf
@@ -218,30 +205,11 @@ private void mapFlowElementInstance(final EndToEndFlowInstance etef, final FlowE
}
}
- private final Set latencyCats = EnumSet.of(ComponentCategory.BUS, ComponentCategory.VIRTUAL_BUS,
- ComponentCategory.DEVICE, ComponentCategory.PROCESSOR, ComponentCategory.VIRTUAL_PROCESSOR,
- ComponentCategory.SYSTEM, ComponentCategory.MEMORY, ComponentCategory.ABSTRACT);
-
- private final Set periodCats = EnumSet.of(ComponentCategory.THREAD,
- ComponentCategory.THREAD_GROUP, ComponentCategory.PROCESS, ComponentCategory.SYSTEM,
- ComponentCategory.DEVICE, ComponentCategory.VIRTUAL_PROCESSOR, ComponentCategory.VIRTUAL_BUS,
- ComponentCategory.ABSTRACT);
-
- private final Set deadlineCats = EnumSet.of(ComponentCategory.THREAD,
- ComponentCategory.THREAD_GROUP, ComponentCategory.PROCESS, ComponentCategory.SYSTEM,
- ComponentCategory.DEVICE, ComponentCategory.VIRTUAL_PROCESSOR,
- ComponentCategory.ABSTRACT);
-
private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowElementInstance flowElementInstance,
LatencyReportEntry entry) {
ComponentInstance componentInstance;
- final boolean hasLatency = flowElementInstance instanceof FlowSpecificationInstance
- || flowElementInstance instanceof ConnectionInstance
- || flowElementInstance instanceof EndToEndFlowInstance
- || latencyCats.contains(((ComponentInstance) flowElementInstance).getCategory());
- final RealRange expected = hasLatency ? PropertyUtils.getScaledRange(
- org.osate.aadl2.contrib.communication.CommunicationProperties::getLatency, flowElementInstance,
- TimeUnits.MS).orElse(RealRange.ZEROED) : RealRange.ZEROED;
+ double expectedMin = GetProperties.getMinimumLatencyinMilliSec(flowElementInstance);
+ double expectedMax = GetProperties.getMaximumLatencyinMilliSec(flowElementInstance);
if (flowElementInstance instanceof FlowSpecificationInstance) {
componentInstance = flowElementInstance.getComponentInstance();
@@ -255,23 +223,27 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
/**
* Get all the relevant properties.
*/
- double period = periodCats.contains(componentInstance.getCategory()) ? PropertyUtils.getScaled(TimingProperties::getPeriod, componentInstance, TimeUnits.MS)
- .orElse(0.0) : 0.0;
- double deadline = deadlineCats.contains(componentInstance.getCategory()) ? PropertyUtils.getScaled(TimingProperties::getDeadline, componentInstance, TimeUnits.MS)
- .orElse(0.0) : 0.0;
- boolean isAssignedDeadline = isAssignedDeadline(componentInstance);
-
- final boolean isThreadOrDevice = InstanceModelUtil.isThread(componentInstance)
- || InstanceModelUtil.isDevice(componentInstance) || InstanceModelUtil.isAbstract(componentInstance);
- final boolean isPeriodic = period > 0 && (isThreadOrDevice
+ double period = GetProperties.getPeriodinMS(componentInstance);
+ double deadline = GetProperties.getDeadlineinMilliSec(componentInstance);
+ boolean isAssignedDeadline = GetProperties.isAssignedDeadline(componentInstance);
+
+ final boolean isPeriodic = period > 0 && ((InstanceModelUtil.isThread(componentInstance)
+ || InstanceModelUtil.isDevice(componentInstance) || InstanceModelUtil.isAbstract(componentInstance))
? (!InstanceModelUtil.isSporadicComponent(componentInstance)
&& !InstanceModelUtil.isTimedComponent(componentInstance)
&& !InstanceModelUtil.isAperiodicComponent(componentInstance))
: true);
- final RealRange responseTime = getResponseTimeInMilliSec(flowElementInstance, componentInstance,
+// double executionTimeLower = GetProperties.getScaledMinComputeExecutionTimeinMilliSec(componentInstance);
+// double executionTimeHigher = GetProperties.getScaledMaxComputeExecutionTimeinMilliSec(componentInstance);
+ final double responseTimeLower = getMinResponseTimeInMilliSec(flowElementInstance, componentInstance,
+ isPeriodic);
+ final double responseTimeHigher = getMaxResponseTimeInMilliSec(flowElementInstance, componentInstance,
+ isPeriodic);
+
+ final double executionTimeLower = getMinExecutionTimeInMilliSec(flowElementInstance, componentInstance,
isPeriodic);
- final RealRange executionTime = getExecutionTimeInMilliSec(flowElementInstance, componentInstance,
+ final double executionTimeHigher = getMaxExecutionTimeInMilliSec(flowElementInstance, componentInstance,
isPeriodic);
/**
@@ -291,7 +263,7 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
componentInstance, flowElementInstance, report.isMajorFrameDelay());
samplingLatencyContributor.setSamplingPeriod(period);
if ((InstanceModelUtil.isThread(componentInstance) || InstanceModelUtil.isDevice(componentInstance))
- && !hasAssignedPropertyValue(componentInstance, "Dispatch_Protocol")) {
+ && !GetProperties.hasAssignedPropertyValue(componentInstance, "Dispatch_Protocol")) {
samplingLatencyContributor.reportInfo("Assume Periodic dispatch because period is set");
}
if (FlowLatencyUtil.isPreviousConnectionDelayed(etef, flowElementInstance)) {
@@ -306,8 +278,7 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
} else {
// sampled. We may under sample
ComponentInstance prevComp = FlowLatencyUtil.getPreviousComponent(etef, flowElementInstance);
- double prevPeriod = prevComp != null ? PropertyUtils.getScaled(TimingProperties::getPeriod, prevComp, TimeUnits.MS).orElse(0.0)
- : 0;
+ double prevPeriod = prevComp != null ? GetProperties.getPeriodinMS(prevComp) : 0;
if (period > 0 && prevPeriod > 0 && period % prevPeriod == 0.0) {
samplingLatencyContributor.setSamplingPeriod(prevPeriod);
} else {
@@ -337,7 +308,7 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
ComponentInstance firstPartition = FlowLatencyUtil.getPartition(componentInstance);
if (firstPartition != null) {
double partitionLatency = FlowLatencyUtil.getPartitionPeriod(firstPartition);
- List schedule = FlowLatencyUtil.getModuleSchedule(firstPartition);
+ List schedule = FlowLatencyUtil.getModuleSchedule(firstPartition);
double partitionDuration = FlowLatencyUtil.getPartitionDuration(firstPartition, schedule);
LatencyContributorComponent platencyContributor = new LatencyContributorComponent(firstPartition,
flowElementInstance,
@@ -378,16 +349,16 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
flowElementInstance,
report.isMajorFrameDelay());
- if (responseTime.getMaximum() != 0.0) {
- worstCaseValue = responseTime.getMaximum();
+ if (responseTimeHigher != 0.0) {
+ worstCaseValue = responseTimeHigher;
worstmethod = LatencyContributorMethod.RESPONSE_TIME;
- } else if (executionTime.getMaximum() != 0.0) {
+ } else if (executionTimeHigher != 0.0) {
if (!report.isWorstCaseDeadline()) {
// Use execution time for worst-case if preferences specify not deadline or no deadline is specified
- worstCaseValue = executionTime.getMaximum();
+ worstCaseValue = executionTimeHigher;
worstmethod = LatencyContributorMethod.PROCESSING_TIME;
} else if (!isAssignedDeadline) {
- worstCaseValue = executionTime.getMaximum();
+ worstCaseValue = executionTimeHigher;
worstmethod = LatencyContributorMethod.PROCESSING_TIME;
processingLatencyContributor.reportInfo("Using execution time as deadline was not set");
}
@@ -399,9 +370,9 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
worstmethod = LatencyContributorMethod.DEADLINE;
}
- if ((worstCaseValue == 0.0) && (expected.getMaximum() != 0.0)) {
+ if ((worstCaseValue == 0.0) && (expectedMax != 0.0)) {
// use flow latency if neither deadline nor execution time
- worstCaseValue = expected.getMaximum();
+ worstCaseValue = expectedMax;
worstmethod = LatencyContributorMethod.SPECIFIED;
} else if (worstCaseValue == 0.0 && deadline != 0.0) {
// if no flow spec value then use default deadline == period
@@ -414,35 +385,31 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
* Selection of the best case value, generic cases.
*/
bestmethod = LatencyContributorMethod.UNKNOWN;
- if (responseTime.getMinimum() != 0.0) {
- bestCaseValue = responseTime.getMinimum();
+ if (responseTimeLower != 0.0) {
+ bestCaseValue = responseTimeLower;
bestmethod = LatencyContributorMethod.RESPONSE_TIME;
- } else if (executionTime.getMinimum() != 0.0) {
- bestCaseValue = executionTime.getMinimum();
+ } else if (executionTimeLower != 0.0) {
+ bestCaseValue = executionTimeLower;
bestmethod = LatencyContributorMethod.PROCESSING_TIME;
}
// For best case it does not make sense to use deadline
- if ((bestCaseValue == 0.0) && (expected.getMinimum() != 0.0)) {
- bestCaseValue = expected.getMinimum();
+ if ((bestCaseValue == 0.0) && (expectedMin != 0.0)) {
+ bestCaseValue = expectedMin;
bestmethod = LatencyContributorMethod.SPECIFIED;
}
- // XXX: Fix all the use of the isSporadic/isTimed etc. Get the value once and check against it.
-
// deal with queuing latency
// take into account queuing delay
if (incomingConnectionFI != null) {
double qs = 0;
LatencyContributorComponent ql = new LatencyContributorComponent(componentInstance, flowElementInstance,
report.isMajorFrameDelay());
-
- if (hasAssignedPropertyValue(incomingConnectionFI,
- org.osate.xtext.aadl2.properties.util.CommunicationProperties.QUEUE_SIZE)) {
- qs = CommunicationProperties.getQueueSize(incomingConnectionFI).orElse(0);
+ if (GetProperties.hasAssignedPropertyValue(incomingConnectionFI, CommunicationProperties.QUEUE_SIZE)) {
+ qs = GetProperties.getQueueSize(incomingConnectionFI);
} else if (incomingConnectionFI.getCategory() == FeatureCategory.DATA_PORT
- && isThreadOrDevice && (InstanceModelUtil.isSporadicComponent(componentInstance)
+ && (InstanceModelUtil.isSporadicComponent(componentInstance)
|| InstanceModelUtil.isTimedComponent(componentInstance)
|| InstanceModelUtil.isAperiodicComponent(componentInstance))) {
// treat data port as a port of queue size 1 when not a sampling thread
@@ -480,8 +447,8 @@ private void mapComponentInstance(final EndToEndFlowInstance etef, final FlowEle
processingLatencyContributor.setBestCaseMethod(bestmethod);
processingLatencyContributor.setMaximum(worstCaseValue);
processingLatencyContributor.setMinimum(bestCaseValue);
- processingLatencyContributor.setExpectedMaximum(expected.getMaximum());
- processingLatencyContributor.setExpectedMinimum(expected.getMinimum());
+ processingLatencyContributor.setExpectedMaximum(expectedMax);
+ processingLatencyContributor.setExpectedMinimum(expectedMin);
if (checkLastImmediate && deadline > 0.0) {
processingLatencyContributor.setImmediateDeadline(deadline);
@@ -494,10 +461,8 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
LatencyReportEntry entry) {
ConnectionInstance connectionInstance = (ConnectionInstance) flowElementInstance;
- final RealRange expected = PropertyUtils
- .getScaledRange(org.osate.aadl2.contrib.communication.CommunicationProperties::getLatency,
- flowElementInstance, TimeUnits.MS)
- .orElse(RealRange.ZEROED);
+ double expectedMin = GetProperties.getMinimumLatencyinMilliSec(flowElementInstance);
+ double expectedMax = GetProperties.getMaximumLatencyinMilliSec(flowElementInstance);
ComponentInstance componentInstanceSource = InstanceModelUtil.getRelatedComponentSource(connectionInstance);
ComponentInstance componentInstanceDestination = InstanceModelUtil
@@ -511,7 +476,7 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
// if we exit a partition then we may have I/O Delay until the end of the partition window or the end of the major frame
if (srcPartition != null && srcPartition != dstPartition) {
double partitionLatency = FlowLatencyUtil.getPartitionPeriod(srcPartition);
- List schedule = FlowLatencyUtil.getModuleSchedule(srcPartition);
+ List schedule = FlowLatencyUtil.getModuleSchedule(srcPartition);
double partitionDuration = FlowLatencyUtil.getPartitionDuration(srcPartition, schedule);
if (partitionDuration > 0) {
LatencyContributor ioLatencyContributor = new LatencyContributorComponent(srcPartition,
@@ -541,11 +506,9 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
report.isMajorFrameDelay());
processActualConnectionBindingsSampling(connectionInstance, latencyContributor);
- ComponentClassifier relatedConnectionData = (ComponentClassifier) FlowLatencyUtil
- .getConnectionData(connectionInstance);
+ Classifier relatedConnectionData = FlowLatencyUtil.getConnectionData(connectionInstance);
processActualConnectionBindingsTransmission(connectionInstance,
- relatedConnectionData == null ? 0.0
- : AadlContribUtils.getDataSize(relatedConnectionData, SizeUnits.BYTES),
+ relatedConnectionData == null ? 0.0 : GetProperties.getDataSizeInBytes(relatedConnectionData),
latencyContributor);
/**
* handle the case when there is no binding to virtual bus or bus.
@@ -553,20 +516,20 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
*/
// XXX we can add a check whether the latencies coming from the bindings exceeds the connection latency
- if (expected.getMaximum() > 0) {
+ if (expectedMax > 0) {
latencyContributor.setWorstCaseMethod(LatencyContributorMethod.SPECIFIED);
- latencyContributor.setExpectedMaximum(expected.getMaximum());
+ latencyContributor.setExpectedMaximum(expectedMax);
}
- if (expected.getMinimum() > 0) {
+ if (expectedMin > 0) {
latencyContributor.setBestCaseMethod(LatencyContributorMethod.SPECIFIED);
- latencyContributor.setExpectedMinimum(expected.getMinimum());
+ latencyContributor.setExpectedMinimum(expectedMin);
}
if (latencyContributor.getSubContributors().isEmpty()) {
- if (expected.getMaximum() > 0) {
- latencyContributor.setMaximum(expected.getMaximum());
+ if (expectedMax > 0) {
+ latencyContributor.setMaximum(expectedMax);
}
- if (expected.getMinimum() > 0) {
- latencyContributor.setMinimum(expected.getMinimum());
+ if (expectedMin > 0) {
+ latencyContributor.setMinimum(expectedMin);
}
} else {
latencyContributor.reportInfo("Adding latency subtotal from protocols and hardware - shown with ()");
@@ -574,8 +537,8 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
// set synchronous if on same processor
if (srcHW != null && dstHW != null) {
// we have two hardware components. One or both could be a device
- ComponentInstance srcTime = (ComponentInstance) TimingProperties.getReferenceTime(srcHW).orElse(null);
- ComponentInstance dstTime = (ComponentInstance) TimingProperties.getReferenceTime(dstHW).orElse(null);
+ ComponentInstance srcTime = GetProperties.getReferenceTime(srcHW);
+ ComponentInstance dstTime = GetProperties.getReferenceTime(dstHW);
if (srcHW == dstHW) {
latencyContributor.setSynchronous();
} else if (srcTime != null && dstTime != null) {
@@ -607,7 +570,7 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
if (dstPartition != null && srcPartition != dstPartition) {
// add partition latency if the destination is a partition and it is different from the source partition (or null)
double partitionLatency = FlowLatencyUtil.getPartitionPeriod(dstPartition);
- List schedule = FlowLatencyUtil.getModuleSchedule(dstPartition);
+ List schedule = FlowLatencyUtil.getModuleSchedule(dstPartition);
double partitionDuration = FlowLatencyUtil.getPartitionDuration(dstPartition, schedule);
LatencyContributorComponent platencyContributor = new LatencyContributorComponent(dstPartition,
flowElementInstance,
@@ -638,22 +601,6 @@ private void mapConnectionInstance(final EndToEndFlowInstance etef, final FlowEl
}
}
- private static RealRange getTimeToTransferData(final NamedElement bus, double datasizeinbyte) {
- final Optional tt_o = org.osate.aadl2.contrib.communication.CommunicationProperties
- .getTransmissionTime(bus);
- if (tt_o.isPresent()) {
- final TransmissionTime tt = tt_o.get();
- final RealRange fixedRange = PropertyUtils.scaleRange(tt.getFixed(), TimeUnits.MS).orElse(RealRange.ZEROED);
- final RealRange perByteRange = PropertyUtils.scaleRange(tt.getPerbyte(), TimeUnits.MS)
- .orElse(RealRange.ZEROED);
- final double min = fixedRange.getMinimum() + (datasizeinbyte * perByteRange.getMinimum());
- final double max = fixedRange.getMaximum() + (datasizeinbyte * perByteRange.getMaximum());
- return new RealRange(min, max);
- } else {
- return new RealRange(0.0, 0.0);
- }
- }
-
/**
* add latency sub-contribution due to transmission by bus (or virtual bus)
* works for an instance object and for a classifier.
@@ -669,21 +616,21 @@ private void processTransmissionTime(NamedElement targetMedium, double datasizei
LatencyContributor latencyContributor, final ConnectionInstance onBehalfOfConnection) {
// XXX: [Code Coverage] targetMedium cannot be null.
if (targetMedium != null) {
- final RealRange busLatency = PropertyUtils
- .getScaledRange(org.osate.aadl2.contrib.communication.CommunicationProperties::getLatency,
- targetMedium, TimeUnits.MS)
- .orElse(RealRange.ZEROED);
- final RealRange busTransferTime = getTimeToTransferData(targetMedium, datasizeinbyte);
- if (busLatency.getMaximum() == 0 && busTransferTime.getMaximum() == 0) {
+
+ double maxBusLatency = GetProperties.getMaximumLatencyinMilliSec(targetMedium);
+ double minBusLatency = GetProperties.getMinimumLatencyinMilliSec(targetMedium);
+ double maxBusTransferTime = GetProperties.getMaximumTimeToTransferData(targetMedium, datasizeinbyte);
+ double minBusTransferTime = GetProperties.getMinimumTimeToTransferData(targetMedium, datasizeinbyte);
+ if (maxBusLatency == 0 && maxBusTransferTime == 0) {
// connection or protocol has nothing to contribute
return;
}
LatencyContributor subContributor = new LatencyContributorComponent(targetMedium,
report.isMajorFrameDelay());
- subContributor.setExpectedMaximum(busLatency.getMaximum());
- subContributor.setExpectedMinimum(busLatency.getMinimum());
- if (busTransferTime.getMaximum() > 0) {
- subContributor.setMaximum(busTransferTime.getMaximum());
+ subContributor.setExpectedMaximum(maxBusLatency);
+ subContributor.setExpectedMinimum(minBusLatency);
+ if (maxBusTransferTime > 0) {
+ subContributor.setMaximum(maxBusTransferTime);
subContributor.reportInfo("Using data transfer time");
if (datasizeinbyte == 0.0) {
subContributor.reportInfo("Data size = 0. Possibly data type on port missing");
@@ -694,10 +641,10 @@ private void processTransmissionTime(NamedElement targetMedium, double datasizei
if (targetMedium instanceof ComponentInstance) {
computedMaxTransmissionLatencies.put(
new Pair<>((ComponentInstance) targetMedium, onBehalfOfConnection),
- busTransferTime.getMaximum());
+ maxBusTransferTime);
}
- } else if (busLatency.getMaximum() > 0) {
- subContributor.setMaximum(busLatency.getMaximum());
+ } else if (maxBusLatency > 0) {
+ subContributor.setMaximum(maxBusLatency);
subContributor.setWorstCaseMethod(LatencyContributorMethod.SPECIFIED);
subContributor.reportInfo("Using specified bus latency");
@@ -705,19 +652,19 @@ private void processTransmissionTime(NamedElement targetMedium, double datasizei
if (targetMedium instanceof ComponentInstance) {
computedMaxTransmissionLatencies.put(
new Pair<>((ComponentInstance) targetMedium, onBehalfOfConnection),
- busTransferTime.getMaximum());
+ maxBusTransferTime);
}
} else {
// XXX: [Code Coverage] Only executable if maxBusTransferTime or maxBusLatency is negative.
subContributor.setWorstCaseMethod(LatencyContributorMethod.UNKNOWN);
}
- if (busTransferTime.getMinimum() > 0) {
- subContributor.setMinimum(busTransferTime.getMinimum());
+ if (minBusTransferTime > 0) {
+ subContributor.setMinimum(minBusTransferTime);
subContributor.setBestCaseMethod(LatencyContributorMethod.TRANSMISSION_TIME);
- } else if (busLatency.getMinimum() > 0) {
- subContributor.setMinimum(busLatency.getMinimum());
+ } else if (minBusLatency > 0) {
+ subContributor.setMinimum(minBusLatency);
subContributor.setBestCaseMethod(LatencyContributorMethod.SPECIFIED);
} else {
// XXX: [Code Coverage] Only executable if minBusTransferTime or minBusLatency is negative.
@@ -745,14 +692,12 @@ private void processActualConnectionBindingsTransmission(final InstanceObject co
boolean willDoVirtualBuses = false;
boolean willDoBuses = false;
// look for actual binding if we have a connection instance or virtual bus instance
- final List bindings = DeploymentProperties.getActualConnectionBinding(connOrVB)
- .orElse(Collections.emptyList());
-
+ List bindings = GetProperties.getActualConnectionBinding(connOrVB);
if (bindings.isEmpty()) {
return;
}
- for (InstanceObject componentInstance : bindings) {
- if (((ComponentInstance) componentInstance).getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
+ for (ComponentInstance componentInstance : bindings) {
+ if (componentInstance.getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
willDoVirtualBuses = true;
} else {
willDoBuses = true;
@@ -764,8 +709,7 @@ private void processActualConnectionBindingsTransmission(final InstanceObject co
* We also can have an actual connection binding to a virtual bus
* If we have that we want to use that virtual bus overhead
*/
- List protocols = DeploymentProperties.getRequiredVirtualBusClass(connOrVB)
- .orElse(Collections.emptyList());
+ List protocols = GetProperties.getRequiredVirtualBusClass(connOrVB);
// XXX: [Code Coverage] protocols cannot be null.
if ((protocols != null) && (protocols.size() > 0)) {
// XXX: [Code Coverage] willDoBuses is always true if willDoVirtualBuses is false.
@@ -778,11 +722,10 @@ private void processActualConnectionBindingsTransmission(final InstanceObject co
}
- for (InstanceObject componentInstance : bindings) {
- double wrappedDataSize = transmissionDataSize
- + AadlContribUtils.getDataSize((ComponentInstance) componentInstance, SizeUnits.BYTES);
+ for (ComponentInstance componentInstance : bindings) {
+ double wrappedDataSize = transmissionDataSize + GetProperties.getDataSizeInBytes(componentInstance);
processTransmissionTime(componentInstance, wrappedDataSize, latencyContributor, onBehalfOfConnection);
- if (((ComponentInstance) componentInstance).getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
+ if (componentInstance.getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
processActualConnectionBindingsTransmission(componentInstance, wrappedDataSize, latencyContributor,
onBehalfOfConnection);
}
@@ -795,17 +738,16 @@ private void processActualConnectionBindingsTransmission(final InstanceObject co
* @param protocols
* @return
*/
- private double computeTotalDataSize(List protocols,
+ private double computeTotalDataSize(List protocols,
double transmissionDataSize,
LatencyContributor latencyContributor, final ConnectionInstance onBehalfOfConnection) {
double total = transmissionDataSize;
- for (Classifier cc : protocols) {
- double contribution = AadlContribUtils.getDataSize((ComponentClassifier) cc, SizeUnits.BYTES);
+ for (ComponentClassifier cc : protocols) {
+ double contribution = GetProperties.getDataSizeInBytes(cc);
double wrapped = transmissionDataSize + contribution;
processTransmissionTime(cc, wrapped, latencyContributor, onBehalfOfConnection);
total = total + contribution;
- List reqprotocols = DeploymentProperties.getRequiredVirtualBusClass(cc)
- .orElse(Collections.emptyList());
+ List reqprotocols = GetProperties.getRequiredVirtualBusClass(cc);
if (!reqprotocols.isEmpty()) {
total = total + computeTotalDataSize(reqprotocols, wrapped, latencyContributor, onBehalfOfConnection);
}
@@ -832,10 +774,9 @@ private void processActualConnectionBindingsSampling(final NamedElement connOrVB
boolean willDoBuses = false;
if (connOrVB instanceof InstanceObject) {
// look for actual binding if we have a connection instance or virtual bus instance
- List bindings = DeploymentProperties.getActualConnectionBinding(connOrVB)
- .orElse(Collections.emptyList());
- for (InstanceObject componentInstance : bindings) {
- if (((ComponentInstance) componentInstance).getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
+ List bindings = GetProperties.getActualConnectionBinding((InstanceObject) connOrVB);
+ for (ComponentInstance componentInstance : bindings) {
+ if (componentInstance.getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
willDoVirtualBuses = true;
} else {
willDoBuses = true;
@@ -847,23 +788,22 @@ private void processActualConnectionBindingsSampling(final NamedElement connOrVB
* If we have that we want to use that virtual bus overhead
*/
if (!willDoVirtualBuses) {
- List protocols = DeploymentProperties.getRequiredVirtualBusClass(connOrVB)
- .orElse(Collections.emptyList());
+ List protocols = GetProperties.getRequiredVirtualBusClass(connOrVB);
// XXX: [Code Coverage] protocols cannot be null.
if ((protocols != null) && (protocols.size() > 0)) {
if (willDoBuses) {
latencyContributor.reportInfo("Adding required virtual bus contributions to bound bus");
}
- for (Classifier cc : protocols) {
+ for (ComponentClassifier cc : protocols) {
processSamplingAndQueuingTimes(cc, null, latencyContributor);
processActualConnectionBindingsSampling(cc, latencyContributor, onBehalfOfConnection);
}
}
}
- for (InstanceObject componentInstance : bindings) {
+ for (ComponentInstance componentInstance : bindings) {
processSamplingAndQueuingTimes(componentInstance, onBehalfOfConnection, latencyContributor);
- if (((ComponentInstance) componentInstance).getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
+ if (componentInstance.getCategory().equals(ComponentCategory.VIRTUAL_BUS)) {
processActualConnectionBindingsSampling(componentInstance, latencyContributor,
onBehalfOfConnection);
}
@@ -872,11 +812,6 @@ private void processActualConnectionBindingsSampling(final NamedElement connOrVB
}
- private final static Set hasPeriod = EnumSet.of(ComponentCategory.THREAD,
- ComponentCategory.THREAD_GROUP, ComponentCategory.PROCESS, ComponentCategory.SYSTEM,
- ComponentCategory.DEVICE, ComponentCategory.VIRTUAL_PROCESSOR, ComponentCategory.VIRTUAL_BUS,
- ComponentCategory.BUS, ComponentCategory.ABSTRACT);
-
/*
* boundBusOrRequiredClassifier is a ComponentInstance if it is a bus bound to connection instance, or a
* ComponentClassifier if it is a virtual bus required by a connection connnection or vb.
@@ -892,13 +827,7 @@ private void processSamplingAndQueuingTimes(final NamedElement boundBusOrRequire
// XXX: [Code Coverage] boundBus cannot be null.
if (boundBusOrRequiredClassifier != null) {
- final ComponentCategory cc = boundBusOrRequiredClassifier instanceof ComponentInstance
- ? ((ComponentInstance) boundBusOrRequiredClassifier).getCategory()
- : ((ComponentClassifier) boundBusOrRequiredClassifier).getCategory();
- double period = hasPeriod.contains(
- cc) ? PropertyUtils
- .getScaled(TimingProperties::getPeriod, boundBusOrRequiredClassifier, TimeUnits.MS).orElse(0.0)
- : 0.0;
+ double period = GetProperties.getPeriodinMS(boundBusOrRequiredClassifier);
if (period > 0) {
// add sampling latency due to the protocol or bus being periodic
LatencyContributor samplingLatencyContributor = new LatencyContributorComponent(
@@ -982,8 +911,7 @@ public AnalysisResult invoke(SystemInstance root, SystemOperationMode som, boole
if (root.getSystemOperationModes().isEmpty()
|| root.getSystemOperationModes().get(0).getCurrentModes().isEmpty()) {
// no SOM
- invokeOnSOM(root, root.getSystemOperationModes().get(0), asynchronousSystem, majorFrameDelay,
- worstCaseDeadline,
+ invokeOnSOM(root, som, asynchronousSystem, majorFrameDelay, worstCaseDeadline,
bestCaseEmptyQueue, disableQueuingLatency);
} else {
// we need to run it for every SOM
@@ -1275,61 +1203,63 @@ public AnalysisResult invokeAndSaveResult(SystemInstance root, SystemOperationMo
return ar;
}
- private RealRange getTimeInMilliSec2(final FlowElementInstance fei, final ComponentInstance ci,
- final boolean isPeriodic,
- final Function>> getExecTime) {
+ private double getTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
+ final boolean isPeriodic, final Function propertyTester,
+ final Function getExecTime) {
/*
* If the flow element is a component instance or if the thread is periodic, we use the thread's
* computation time. Otherwise we try to use the compute execution time from the flow's input feature.
*/
- if (!(isPeriodic || fei == ci)) { // the flow element is a FlowSpecificationInstance (It is not periodic or a component instance)
+ if (isPeriodic || fei == ci) { // the flow element is a component instance
+ return getExecTime.apply(ci);
+ } else { // the flow element is a FlowSpecificationInstance
final FlowSpecificationInstance fsi = (FlowSpecificationInstance) fei;
final FlowEnd allInEnd = fsi.getFlowSpecification().getAllInEnd();
if (allInEnd != null) { // we have an input feature
FeatureInstance fi = null;
if (allInEnd.getContext() instanceof FeatureGroup) {
- final FeatureInstance fgi = ci.findFeatureInstance((FeatureGroup) allInEnd.getContext());
+ FeatureInstance fgi = ci.findFeatureInstance((FeatureGroup) allInEnd.getContext());
fi = fgi.findFeatureInstance(allInEnd.getFeature());
} else {
fi = ci.findFeatureInstance(allInEnd.getFeature());
}
- final FeatureCategory featureCategory = fi.getCategory();
- if (featureCategory == FeatureCategory.EVENT_PORT
- || featureCategory == FeatureCategory.EVENT_DATA_PORT) {
- final Optional> fromFeature = getExecTime.apply(fi);
- if (fromFeature.isPresent()) {
- return AnalysisUtils.scaleTimeRange(PropertyUtils.scaleRange(fromFeature.get(), TimeUnits.MS), fi);
- } // otherwise fall through and get from component
- } // otherwise fall through and get from component
+ if (propertyTester.apply(fi)) {
+ return getExecTime.apply(fi);
+ }
}
- }
- final ComponentCategory componentCategory = ci.getCategory();
- if (componentCategory == ComponentCategory.THREAD || componentCategory == ComponentCategory.DEVICE
- || componentCategory == ComponentCategory.SUBPROGRAM
- || componentCategory == ComponentCategory.ABSTRACT) {
- return AnalysisUtils.scaleTimeRange(PropertyUtils.scaleRange(getExecTime.apply(ci), TimeUnits.MS).orElse(RealRange.ZEROED), ci);
- } else {
- return RealRange.ZEROED;
+ return getExecTime.apply(ci);
}
}
- private RealRange getResponseTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
+ private double getMinResponseTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
final boolean isPeriodic) {
- return getTimeInMilliSec2(fei, ci, isPeriodic, Sei::getResponseTime);
+ return getTimeInMilliSec(fei, ci, isPeriodic, FlowLatencyAnalysisSwitch::hasResponseTime,
+ FlowLatencyAnalysisSwitch::getScaledMinResponseTimeinMilliSec);
}
- private RealRange getExecutionTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
+ private double getMaxResponseTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
final boolean isPeriodic) {
- return getTimeInMilliSec2(fei, ci, isPeriodic, TimingProperties::getComputeExecutionTime);
+ return getTimeInMilliSec(fei, ci, isPeriodic, FlowLatencyAnalysisSwitch::hasResponseTime,
+ FlowLatencyAnalysisSwitch::getScaledMaxResponseTimeinMilliSec);
+ }
+
+ private double getMinExecutionTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
+ final boolean isPeriodic) {
+ return getTimeInMilliSec(fei, ci, isPeriodic, GetProperties::hasComputeExecutionTime,
+ GetProperties::getScaledMinComputeExecutionTimeinMilliSec);
+ }
+
+ private double getMaxExecutionTimeInMilliSec(final FlowElementInstance fei, final ComponentInstance ci,
+ final boolean isPeriodic) {
+ return getTimeInMilliSec(fei, ci, isPeriodic, GetProperties::hasComputeExecutionTime,
+ GetProperties::getScaledMaxComputeExecutionTimeinMilliSec);
}
private static final void sortBoundConnectionsHelper(final ComponentInstance compInstance,
final Map> map) {
for (final ConnectionInstance ci : compInstance.getConnectionInstances()) {
- final List bindings = DeploymentProperties.getActualConnectionBinding(ci)
- .orElse(Collections.emptyList());
- for (final InstanceObject io : bindings) {
- final ComponentInstance componentInstance = (ComponentInstance) io;
+ final List bindings = GetProperties.getActualConnectionBinding(ci);
+ for (final ComponentInstance componentInstance : bindings) {
addToHashedSet(map, componentInstance, ci);
processComponentBindings(map, ci, componentInstance);
}
@@ -1344,20 +1274,20 @@ private static final Map> sortBoundCo
final SystemInstance system) {
final Map> map = new HashMap<>();
sortBoundConnectionsHelper(system, map);
+// for (final ConnectionInstance ci : system.getConnectionInstances()) {
+// final List bindings = GetProperties.getActualConnectionBinding(ci);
+// for (final ComponentInstance componentInstance : bindings) {
+// addToHashedSet(map, componentInstance, ci);
+// processComponentBindings(map, ci, componentInstance);
+// }
+// }
return map;
}
- private static final Set hasConnBindings = EnumSet.of(ComponentCategory.THREAD,
- ComponentCategory.THREAD_GROUP, ComponentCategory.PROCESS, ComponentCategory.SYSTEM,
- ComponentCategory.VIRTUAL_BUS, ComponentCategory.ABSTRACT);
-
private static final void processComponentBindings(final Map> map,
final ConnectionInstance ci, final ComponentInstance componentInstance) {
- final List componentBindings = hasConnBindings.contains(componentInstance.getCategory())
- ? DeploymentProperties.getActualConnectionBinding(componentInstance).orElse(Collections.emptyList())
- : Collections.emptyList();
- for (final InstanceObject io : componentBindings) {
- final ComponentInstance componentBinding = (ComponentInstance) io;
+ final List componentBindings = GetProperties.getActualConnectionBinding(componentInstance);
+ for (final ComponentInstance componentBinding : componentBindings) {
addToHashedSet(map, componentBinding, ci);
processComponentBindings(map, ci, componentBinding);
}
@@ -1486,39 +1416,42 @@ private void fillInQueuingTimes(final SystemInstance system) {
}
}
- // *****************************
- // *** These horrible methods are left over from GetProperties, and check that a property has a value.
- // *** They are hard to emulate with the property methods.
- // *****************************
-
- private static boolean isAssignedDeadline(final NamedElement ne) {
- Property deadline = lookupPropertyDefinition(ne, org.osate.xtext.aadl2.properties.util.TimingProperties._NAME,
- org.osate.xtext.aadl2.properties.util.TimingProperties.DEADLINE);
- return isAssignedPropertyValue(ne, deadline);
- }
-
- private static Property lookupPropertyDefinition(EObject context, String ps, String name) {
- return Aadl2GlobalScopeUtil.get(context, Aadl2Package.eINSTANCE.getProperty(),
- ((ps != null && !ps.isEmpty()) ? (ps + "::" + name) : name));
- }
+ /*
+ * Ideally these methods would be GetProperties, but changing that class really causes havoc with the
+ * version numbers of the plug-ins.
+ */
- private static boolean isAssignedPropertyValue(NamedElement element, Property pn) {
- try {
- final PropertyAcc propertyAccumulator = element.getPropertyValue(pn);
- PropertyAssociation firstAssociation = propertyAccumulator.first();
- return firstAssociation != null;
- } catch (org.osate.aadl2.properties.PropertyDoesNotApplyToHolderException exception) {
- return false;
- }
+ private static boolean hasResponseTime(final NamedElement ne) {
+ final Property responseTime = GetProperties.lookupPropertyDefinition(ne, SEI._NAME, SEI.RESPONSE_TIME);
+ return PropertyUtils.hasPropertyValue(ne, responseTime);
}
- private static Property lookupPropertyDefinition(EObject context, String qpname) {
- return Aadl2GlobalScopeUtil.get(context, Aadl2Package.eINSTANCE.getProperty(), qpname);
+ /**
+ * get max response time scaled in terms of the processor the thread is
+ * bound to.
+ *
+ * @param ne
+ * thread component instance
+ * @return scaled time or 0.0
+ */
+ private static double getScaledMaxResponseTimeinMilliSec(final NamedElement ne) {
+ Property computeExecutionTime = GetProperties.lookupPropertyDefinition(ne, SEI._NAME, SEI.RESPONSE_TIME);
+ UnitLiteral milliSecond = GetProperties.findUnitLiteral(computeExecutionTime, AadlProject.MS_LITERAL);
+ return PropertyUtils.getScaledRangeMaximum(ne, computeExecutionTime, milliSecond, 0.0);
}
- private static boolean hasAssignedPropertyValue(NamedElement element, String pname) {
- Property pn = lookupPropertyDefinition(element, pname);
- return isAssignedPropertyValue(element, pn);
+ /**
+ * get min response time scaled in terms of the processor the thread is
+ * bound to.
+ *
+ * @param ne
+ * thread component instance
+ * @return scaled time or 0.0
+ */
+ private static double getScaledMinResponseTimeinMilliSec(final NamedElement ne) {
+ Property computeExecutionTime = GetProperties.lookupPropertyDefinition(ne, SEI._NAME, SEI.RESPONSE_TIME);
+ UnitLiteral milliSecond = GetProperties.findUnitLiteral(computeExecutionTime, AadlProject.MS_LITERAL);
+ return PropertyUtils.getScaledRangeMinimum(ne, computeExecutionTime, milliSecond, 0.0);
}
}
diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java
index 6238ad2ecb9..8fd6a55dfdd 100644
--- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java
+++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/internal/utils/FlowLatencyUtil.java
@@ -25,7 +25,6 @@
import java.io.IOException;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
@@ -39,31 +38,55 @@
import org.osate.aadl2.ComponentCategory;
import org.osate.aadl2.ComponentClassifier;
import org.osate.aadl2.ComponentType;
+import org.osate.aadl2.EnumerationLiteral;
+import org.osate.aadl2.NamedElement;
+import org.osate.aadl2.NumberValue;
+import org.osate.aadl2.Property;
+import org.osate.aadl2.PropertyExpression;
import org.osate.aadl2.VirtualBus;
-import org.osate.aadl2.contrib.aadlproject.TimeUnits;
-import org.osate.aadl2.contrib.communication.CommunicationProperties;
-import org.osate.aadl2.contrib.communication.Timing;
-import org.osate.aadl2.contrib.deployment.DeploymentProperties;
-import org.osate.aadl2.contrib.timing.TimingProperties;
import org.osate.aadl2.instance.ComponentInstance;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.ConnectionInstanceEnd;
-import org.osate.aadl2.instance.ConnectionKind;
import org.osate.aadl2.instance.EndToEndFlowInstance;
import org.osate.aadl2.instance.FeatureInstance;
import org.osate.aadl2.instance.FlowElementInstance;
import org.osate.aadl2.instance.FlowSpecificationInstance;
import org.osate.aadl2.instance.InstanceObject;
-import org.osate.aadl2.properties.PropertyLookupException;
-import org.osate.contribution.sei.arinc653.Arinc653;
-import org.osate.contribution.sei.arinc653.ScheduleWindow;
-import org.osate.pluginsupport.properties.PropertyUtils;
+import org.osate.analysis.flows.model.ConnectionType;
+import org.osate.contribution.sei.names.DataModel;
import org.osate.result.AnalysisResult;
import org.osate.result.Result;
import org.osate.result.util.ResultUtil;
+import org.osate.xtext.aadl2.properties.util.ARINC653ScheduleWindow;
+import org.osate.xtext.aadl2.properties.util.GetProperties;
import org.osate.xtext.aadl2.properties.util.InstanceModelUtil;
public class FlowLatencyUtil {
+ //XXX: [Code Coverage] Dead code.
+ public static String getEndToEndFlowString(EndToEndFlowInstance etef) {
+ StringBuilder ret;
+ boolean firstPassed = false;
+
+ ret = new StringBuilder();
+ ret.append(etef.getName() + " : ");
+
+ for (FlowElementInstance fei : etef.getFlowElements()) {
+ if (firstPassed) {
+ ret.append("->");
+ }
+ ret.append(fei.getName());
+ firstPassed = true;
+ }
+
+ return ret.toString();
+ }
+
+ //XXX: [Code Coverage] Dead code.
+ public static boolean hasPreviousConnection(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ return etef.getFlowElements().indexOf(flowElementInstance) > 0;
+ }
+
public static FeatureInstance getIncomingConnectionFeatureInstance(final EndToEndFlowInstance etef,
final FlowElementInstance flowElementInstance) {
ConnectionInstance previousElement = getPreviousConnection(etef, flowElementInstance);
@@ -79,37 +102,83 @@ public static FeatureInstance getIncomingConnectionFeatureInstance(final EndToEn
public static boolean isPreviousConnectionImmediate(final EndToEndFlowInstance etef,
final FlowElementInstance flowElementInstance) {
- final ConnectionInstance previousElement = getPreviousConnection(etef, flowElementInstance);
+ ConnectionInstance previousElement = getPreviousConnection(etef, flowElementInstance);
//XXX: [Code Coverage] Only called if there is a previous connection.
- if (previousElement != null && previousElement.getKind() == ConnectionKind.PORT_CONNECTION) {
- return PropertyUtils.propertyEquals(CommunicationProperties::getTiming, previousElement,
- Timing.IMMEDIATE);
+ if ((previousElement != null)) {
+ return (getConnectionType(previousElement) == ConnectionType.IMMEDIATE);
}
- // No previous element, or it's not a port connection (so no TIMING property); either way, it's not immediate
+
return false;
}
public static boolean isNextConnectionImmediate(final EndToEndFlowInstance etef,
final FlowElementInstance flowElementInstance) {
- final ConnectionInstance nextElement = getNextConnection(etef, flowElementInstance);
- if (nextElement != null && nextElement.getKind() == ConnectionKind.PORT_CONNECTION) {
- return PropertyUtils.propertyEquals(CommunicationProperties::getTiming, nextElement, Timing.IMMEDIATE);
+ ConnectionInstance nextElement = getNextConnection(etef, flowElementInstance);
+ if ((nextElement != null)) {
+ return (getConnectionType(nextElement) == ConnectionType.IMMEDIATE);
}
- // No next element, or it's not a port connection (so no TIMING property); either way, it's not immediate
+
return false;
}
public static boolean isPreviousConnectionDelayed(final EndToEndFlowInstance etef,
final FlowElementInstance flowElementInstance) {
- final ConnectionInstance previousElement = getPreviousConnection(etef, flowElementInstance);
+ ConnectionInstance nextElement = getPreviousConnection(etef, flowElementInstance);
//XXX: [Code Coverage] Only called if there is a previous connection.
- if (previousElement != null && previousElement.getKind() == ConnectionKind.PORT_CONNECTION) {
- return PropertyUtils.propertyEquals(CommunicationProperties::getTiming, previousElement, Timing.DELAYED);
+ if ((nextElement != null)) {
+ return (getConnectionType(nextElement) == ConnectionType.DELAYED);
+ }
+
+ return false;
+ }
+
+ //XXX: [Code Coverage] Dead code.
+ public static boolean isNextConnectionDelayed(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ ConnectionInstance nextElement = getNextConnection(etef, flowElementInstance);
+ if ((nextElement != null)) {
+ return (getConnectionType(nextElement) == ConnectionType.DELAYED);
}
- // No previous element, or it's not a port connection (so no TIMING property); either way, it's not delayed
+
+ return false;
+ }
+
+ //XXX: [Code Coverage] Dead code.
+ public static boolean isPreviousConnectionSampled(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ ConnectionInstance nextElement = getPreviousConnection(etef, flowElementInstance);
+ if ((nextElement != null)) {
+ return (getConnectionType(nextElement) == ConnectionType.SAMPLED);
+ }
+
+ return false;
+ }
+
+ //XXX: [Code Coverage] Dead code.
+ public static boolean isNextConnectionSampled(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ ConnectionInstance nextElement = getNextConnection(etef, flowElementInstance);
+ if ((nextElement != null)) {
+ return (getConnectionType(nextElement) == ConnectionType.SAMPLED);
+ }
+
return false;
}
+ public static ConnectionType getConnectionType(final ConnectionInstance conn) {
+ EnumerationLiteral el = GetProperties.getConnectionTiming(conn);
+
+ //XXX: [Code Coverage] el cannot be null.
+ if ((el != null) && (el.getName().equalsIgnoreCase("immediate"))) {
+ return ConnectionType.IMMEDIATE;
+ }
+ //XXX: [Code Coverage] el cannot be null.
+ if ((el != null) && (el.getName().equalsIgnoreCase("delayed"))) {
+ return ConnectionType.DELAYED;
+ }
+ return ConnectionType.SAMPLED;
+ }
+
/**
* get the next element in an end to end flow
* @param etef - the end to end flow that contains all the elements
@@ -166,6 +235,41 @@ public static ComponentInstance getPreviousComponent(final EndToEndFlowInstance
return null;
}
+ /**
+ * Get the next thread/device period within an end to end flow after the flow element
+ * given as attribute.
+ * @param etef - the end to end flow
+ * @param flowElementInstance - the element to search from
+ * @return - the flow element period that is a thread and is after flowElementInstance
+ */
+ //XXX: [Code Coverage] Dead code.
+ public static double getNextThreadOrDevicePeriod(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ ComponentInstance ci = getNextFlowElement(etef, flowElementInstance).getComponentInstance();
+ if ((ci != null)
+ && ((ci.getCategory() == ComponentCategory.THREAD) || (ci.getCategory() == ComponentCategory.DEVICE))) {
+ return GetProperties.getPeriodinMS(ci);
+ }
+ return 0;
+ }
+
+ /**
+ * Get the next task within an end to end flow after the flow element
+ * given as attribute.
+ * @param etef - the end to end flow
+ * @param flowElementInstance - the element to search from
+ * @return - the flow element that is a task and is after flowElementInstance
+ */
+ //XXX: [Code Coverage] Dead code.
+ public static double getNextSamplingComponentPeriod(final EndToEndFlowInstance etef,
+ final FlowElementInstance flowElementInstance) {
+ ComponentInstance ci = getNextFlowElement(etef, flowElementInstance).getComponentInstance();
+ if (ci != null) {
+ return GetProperties.getPeriodinMS(ci);
+ }
+ return 0;
+ }
+
/**
* find the next connection within an end to end flow
* @param etef - the end to end flow where to search
@@ -215,25 +319,37 @@ public static ComponentInstance getPartition(ComponentInstance componentInstance
* get the partition period, either from the virtual processor representing the partition, or from the major frame of the ARINC653 specification of a processor
* @return partition period as latency contributor
*/
- public static double getPartitionPeriod(final ComponentInstance part) {
+ public static double getPartitionPeriod(ComponentInstance part) {
// first look for major frame value on processor
- final ComponentInstance module = getModule(part);
- final ComponentCategory moduleCategory = module != null ? module.getCategory() : null;
- double result = 0.0;
- if (moduleCategory == ComponentCategory.PROCESSOR || moduleCategory == ComponentCategory.VIRTUAL_PROCESSOR
- || moduleCategory == ComponentCategory.ABSTRACT) {
- result = PropertyUtils.getScaled(Arinc653::getModuleMajorFrame, module, TimeUnits.MS).orElse(0.0);
+ ComponentInstance module = getModule(part);
+ double res = GetProperties.getARINC653ModuleMajorFrame(module);
+ if (res == 0.0) {
+ // look for period on partition
+ res = GetProperties.getPeriodinMS(part);
}
+ if (res == 0.0) {
+ // look for major frame value on virtual processor (partition)
+ res = GetProperties.getARINC653ModuleMajorFrame(part);
+ }
+ return res;
+ }
- if (result == 0.0) {
- // look for period on partition
- result = PropertyUtils.getScaled(TimingProperties::getPeriod, part, TimeUnits.MS).orElse(0.0);
- if (result == 0.0) {
- // look for major frame value on virtual processor (partition)
- result = PropertyUtils.getScaled(Arinc653::getModuleMajorFrame, part, TimeUnits.MS).orElse(0.0);
+ /**
+ * Get the major frame from the processor supporting ARINC653 partitions from its schedule
+ * @param componentInstance system, process, thread or other entity bound to a processor and running inside a partition.
+ * @return partition period supported by processor
+ */
+ //XXX: [Code Coverage] Dead code.
+ public static double getARINC653ProcessorMajorFrameFromSchedule(ComponentInstance processorInstance) {
+ double res = 0.0;
+ List schedule = GetProperties.getModuleSchedule(processorInstance);
+ if ((schedule != null) && (schedule.size() > 0)) {
+ for (ARINC653ScheduleWindow window : schedule) {
+ res = res + window.getTime();
}
+ return res;
}
- return result;
+ return res;
}
public static Classifier getConnectionData(ConnectionInstance connectionInstance) {
@@ -262,9 +378,7 @@ public static ComponentInstance getModule(ComponentInstance partition) {
/**
* Try to get the module from the virtual processor partition.
*/
-
- module = (ComponentInstance) DeploymentProperties.getActualProcessorBinding(partition)
- .map(list -> list.isEmpty() ? null : list.get(0)).orElse(null);
+ module = GetProperties.getBoundProcessor(partition);
if (module == null) {
module = partition.getContainingComponentInstance();
}
@@ -281,31 +395,29 @@ public static ComponentInstance getModule(ComponentInstance partition) {
* @param partition This can be a virtual processor representing a partition or a component instance tagged with SEI properties
* @return offset, no virtual processor as ARINC653 partition, or no processor.
*/
- public static double getPartitionFrameOffset(final ComponentInstance partition,
- final List schedule) {
+ public static double getPartitionFrameOffset(ComponentInstance partition, List schedule) {
+ double res = 0.0;
//XXX: [Code Coverage] schedule is never null.
if ((schedule == null) || (schedule.size() == 0)) {
- return 0.0;
- } else {
- double res = 0.0;
- for (final ScheduleWindow window : schedule) {
- if (PropertyUtils.equals(window.getPartition(), partition, false)) {
- return res;
- }
-
- res = res + PropertyUtils.scale(window.getDuration(), TimeUnits.MS).orElse(0.0);
+ return res;
+ }
+ for (ARINC653ScheduleWindow window : schedule) {
+ if (window.getPartition() == partition) {
+ return res;
}
- // XXX: [Code Coverage] partition is always in schedule.
- return 0.0;
+
+ res = res + window.getTime();
}
+ //XXX: [Code Coverage] partition is always in schedule.
+ return 0.0;
}
- public static boolean isInSchedule(ComponentInstance partition, List schedule) {
+ public static boolean isInSchedule(ComponentInstance partition, List schedule) {
if (schedule == null) {
return true;
}
- for (ScheduleWindow window : schedule) {
- if (PropertyUtils.equals(window.getPartition(), partition, false)) {
+ for (ARINC653ScheduleWindow window : schedule) {
+ if (window.getPartition() == partition) {
return true;
}
}
@@ -320,41 +432,32 @@ public static boolean isInSchedule(ComponentInstance partition, List schedule) {
+ public static double getPartitionDuration(ComponentInstance partition, List schedule) {
if ((schedule == null) || (schedule.size() == 0)) {
- double wcet = PropertyUtils.getScaled(TimingProperties::getExecutionTime, partition, TimeUnits.MS)
- .orElse(0.0);
+ double wcet = GetProperties.getExecutionTimeInMS(partition);
return wcet;
}
- for (ScheduleWindow window : schedule) {
- if (window.getPartition().orElse(null) == partition) {
- return PropertyUtils.scale(window.getDuration(), TimeUnits.MS).orElse(0.0);
+ for (ARINC653ScheduleWindow window : schedule) {
+ if (window.getPartition() == partition) {
+ return window.getTime();
}
}
return 0;
}
- public static List getModuleSchedule(final ComponentInstance partition) {
+ public static List getModuleSchedule(ComponentInstance partition) {
+ ComponentInstance module;
+ List schedule = null;
+ //XXX: [Code Coverage] partition cannot be null.
if (partition == null) {
- return null;
- } else {
- final ComponentInstance module = getModule(partition);
- if (module == null) {
- return null;
- } else {
- final ComponentCategory moduleCategory = module.getCategory();
- if (moduleCategory == ComponentCategory.PROCESSOR
- || moduleCategory == ComponentCategory.VIRTUAL_PROCESSOR
- || moduleCategory == ComponentCategory.ABSTRACT) {
- /* Only keep those windows that have a partition specified */
- final List windows = Arinc653.getModuleSchedule(module).orElse(Collections.emptyList());
- windows.removeIf(sw -> !sw.getPartition().isPresent());
- return windows;
- } else {
- return Collections.emptyList();
- }
- }
+ return schedule;
}
+ module = getModule(partition);
+ if (module != null) {
+ schedule = GetProperties.getModuleSchedule(module);
+
+ }
+ return schedule;
}
/**
@@ -423,6 +526,22 @@ public static String getMinMaxLabel(boolean doMax) {
}
}
+ //XXX: [Code Coverage] Dead code.
+ public static double getDimension(final NamedElement ne) {
+ Property dimension = GetProperties.lookupPropertyDefinition(ne, DataModel._NAME, DataModel.Dimension);
+ List extends PropertyExpression> propertyValues;
+ try {
+ propertyValues = ne.getPropertyValueList(dimension);
+ } catch (Exception e) {
+ return 1.0;
+ }
+ double res = 1.0;
+ for (PropertyExpression propertyExpression : propertyValues) {
+ res = res * ((NumberValue) propertyExpression).getScaledValue();
+ }
+ return res;
+ }
+
// -------------
// Results
// -------------
@@ -628,25 +747,13 @@ public static String getContributorType(EObject relatedElement) {
return relatedComponentType.getCategory().getName();
}
if (relatedElement instanceof ConnectionInstance) {
- final ConnectionKind connectionKind = ((ConnectionInstance) relatedElement)
- .getKind();
- Timing connectionType;
- try {
- connectionType = connectionKind == ConnectionKind.PORT_CONNECTION
- ? CommunicationProperties.getTiming((ConnectionInstance) relatedElement).orElse(Timing.SAMPLED)
- : Timing.SAMPLED;
- } catch (final PropertyLookupException e) {
- // Property association semantics for FEATURE connections are missing
- connectionType = Timing.SAMPLED;
- }
-
- if (connectionType == Timing.DELAYED) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) relatedElement) == ConnectionType.DELAYED) {
return "delayed connection";
}
- if (connectionType == Timing.IMMEDIATE) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) relatedElement) == ConnectionType.IMMEDIATE) {
return "immediate connection";
}
- if (connectionType == Timing.SAMPLED) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) relatedElement) == ConnectionType.SAMPLED) {
return "connection";
}
return "connection";
@@ -654,21 +761,6 @@ public static String getContributorType(EObject relatedElement) {
return "component";
}
-// public static ConnectionType getConnectionType(final ConnectionInstance conn) {
-// EnumerationLiteral el = GetProperties.getConnectionTiming(conn);
-//
-// //XXX: [Code Coverage] el cannot be null.
-// if ((el != null) && (el.getName().equalsIgnoreCase("immediate"))) {
-// return ConnectionType.IMMEDIATE;
-// }
-// //XXX: [Code Coverage] el cannot be null.
-// if ((el != null) && (el.getName().equalsIgnoreCase("delayed"))) {
-// return ConnectionType.DELAYED;
-// }
-// return ConnectionType.SAMPLED;
-// }
-//
-
public static String getFullComponentContributorName(EObject relatedElement) {
if (relatedElement instanceof ConnectionInstance) {
return ((ConnectionInstance) relatedElement).getName();
diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyCSVReport.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyCSVReport.java
index f11189ca821..1e9a72e3e1a 100644
--- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyCSVReport.java
+++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyCSVReport.java
@@ -23,17 +23,16 @@
*/
package org.osate.analysis.flows.model;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.URIConverter;
import org.osate.aadl2.instance.InstanceObject;
import org.osate.aadl2.instance.SystemInstance;
import org.osate.aadl2.modelsupport.resources.OsateResourceUtil;
+import org.osate.aadl2.modelsupport.util.AadlUtil;
import org.osate.analysis.flows.internal.utils.FlowLatencyUtil;
import org.osate.result.AnalysisResult;
import org.osate.result.Diagnostic;
@@ -102,21 +101,24 @@ private static void addContributor(StringBuffer report, Result contributor, bool
}
public static void generateCSVReport(AnalysisResult latres) {
- StringBuffer reportContent = getReportContent(latres);
- Resource res = latres.eResource();
- URI csvuri = res.getURI().trimFileExtension().appendFileExtension("csv");
- URIConverter converter = res.getResourceSet().getURIConverter();
- try (OutputStream output = converter.createOutputStream(csvuri);
- OutputStreamWriter writer = new OutputStreamWriter(output)) {
- writer.write(reportContent.toString());
- } catch (IOException ioe) {
+ IFile file;
+ InputStream input;
+ StringBuffer reportContent;
+
+ reportContent = getReportContent(latres);
+ file = getCSVFile(latres);
+ input = new ByteArrayInputStream(reportContent.toString().getBytes());
+ try {
+ if (file.exists()) {
+ file.setContents(input, true, true, null);
+ } else {
+ AadlUtil.makeSureFoldersExist(file.getFullPath());
+ file.create(input, true, null);
+ }
+ } catch (final CoreException e) {
}
}
- /**
- * @deprecated No longer used, should never have been API.
- */
- @Deprecated
public static IFile getCSVFile(AnalysisResult ar) {
URI arURI = ar.eResource().getURI();
URI csvURI = arURI.trimFileExtension().appendFileExtension("csv");
diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyContributorConnection.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyContributorConnection.java
index 0f20fa6e0b2..602558192fb 100644
--- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyContributorConnection.java
+++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyContributorConnection.java
@@ -23,10 +23,8 @@
*/
package org.osate.analysis.flows.model;
-import org.osate.aadl2.contrib.communication.CommunicationProperties;
-import org.osate.aadl2.contrib.communication.Timing;
import org.osate.aadl2.instance.ConnectionInstance;
-import org.osate.aadl2.instance.ConnectionKind;
+import org.osate.analysis.flows.internal.utils.FlowLatencyUtil;
/**
* A latency Result represents something in the flow
@@ -47,19 +45,15 @@ public LatencyContributorConnection(ConnectionInstance ci, boolean majorFrameDel
@Override
protected String getContributorType() {
- final ConnectionInstance connInstance = (ConnectionInstance) this.relatedElement;
- final Timing connectionType = connInstance.getKind() == ConnectionKind.PORT_CONNECTION
- ? CommunicationProperties.getTiming(connInstance).orElse(Timing.SAMPLED)
- : null;
- if (connectionType == Timing.DELAYED) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) this.relatedElement) == ConnectionType.DELAYED) {
return "delayed connection";
}
- if (connectionType == Timing.IMMEDIATE) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) this.relatedElement) == ConnectionType.IMMEDIATE) {
return "immediate connection";
}
- if (connectionType == Timing.SAMPLED) {
+ if (FlowLatencyUtil.getConnectionType((ConnectionInstance) this.relatedElement) == ConnectionType.SAMPLED) {
return "connection";
}
diff --git a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyReportEntry.java b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyReportEntry.java
index ab60986db56..d82e2befa3a 100644
--- a/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyReportEntry.java
+++ b/analyses/org.osate.analysis.flows/src/org/osate/analysis/flows/model/LatencyReportEntry.java
@@ -30,8 +30,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.osate.aadl2.contrib.aadlproject.TimeUnits;
-import org.osate.aadl2.contrib.communication.CommunicationProperties;
import org.osate.aadl2.instance.ConnectionInstance;
import org.osate.aadl2.instance.EndToEndFlowInstance;
import org.osate.aadl2.instance.SystemInstance;
@@ -43,13 +41,12 @@
import org.osate.analysis.flows.reporting.model.ReportSeverity;
import org.osate.analysis.flows.reporting.model.ReportedCell;
import org.osate.analysis.flows.reporting.model.Section;
-import org.osate.pluginsupport.properties.PropertyUtils;
-import org.osate.pluginsupport.properties.RealRange;
import org.osate.result.Diagnostic;
import org.osate.result.Result;
import org.osate.result.ResultFactory;
import org.osate.result.ResultType;
import org.osate.result.util.ResultUtil;
+import org.osate.xtext.aadl2.properties.util.GetProperties;
/*
* A report entry corresponds to the entry within the report.
@@ -82,12 +79,9 @@ public LatencyReportEntry(EndToEndFlowInstance etef, SystemOperationMode som, bo
this.asynchronousSystem = asynchronousSystem;
this.majorFrameDelay = majorFrameDelay;
- final RealRange expectedLatency = PropertyUtils
- .getScaledRange(CommunicationProperties::getLatency, relatedEndToEndFlow, TimeUnits.MS)
- .orElse(RealRange.ZEROED);
+ expectedMaxLatency = GetProperties.getMaximumLatencyinMilliSec(this.relatedEndToEndFlow);
+ expectedMinLatency = GetProperties.getMinimumLatencyinMilliSec(this.relatedEndToEndFlow);
- expectedMaxLatency = expectedLatency.getMaximum();
- expectedMinLatency = expectedLatency.getMinimum();
}
public void finalizeReportEntry() {
diff --git a/analyses/org.osate.analysis.resource.budgets.tests/src/org/osate/analysis/resource/budgets/tests/Issue1383Test.xtend b/analyses/org.osate.analysis.resource.budgets.tests/src/org/osate/analysis/resource/budgets/tests/Issue1383Test.xtend
new file mode 100644
index 00000000000..49398f7e515
--- /dev/null
+++ b/analyses/org.osate.analysis.resource.budgets.tests/src/org/osate/analysis/resource/budgets/tests/Issue1383Test.xtend
@@ -0,0 +1,215 @@
+/**
+ * Copyright (c) 2004-2020 Carnegie Mellon University and others. (see Contributors file).
+ * All Rights Reserved.
+ *
+ * NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
+ * KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
+ * OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
+ * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
+ *
+ * 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
+ *
+ * Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
+ *
+ * This program includes and/or can make use of certain third party source code, object code, documentation and other
+ * files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
+ * configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
+ * conditions contained in any such Third Party Software or separate license file distributed with such Third Party
+ * Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici-
+ * aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li-
+ * censes only apply to the Third Party Software and not any other portion of this program or this program as a whole.
+ */
+package org.osate.analysis.resource.budgets.tests
+
+import com.google.inject.Inject
+import com.itemis.xtext.testing.XtextTest
+import org.eclipse.xtext.testing.InjectWith
+import org.eclipse.xtext.testing.XtextRunner
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.osate.aadl2.AadlPackage
+import org.osate.aadl2.SystemImplementation
+import org.osate.aadl2.instantiation.InstantiateModel
+import org.osate.testsupport.Aadl2InjectorProvider
+import org.osate.testsupport.TestHelper
+
+import static org.junit.Assert.*
+
+import static extension org.junit.Assert.assertEquals
+import org.osate.result.Result
+import java.util.List
+import org.osate.result.util.ResultUtil
+import org.osate.analysis.resource.budgets.power.PowerRequirementAnalysis
+import org.osate.result.Diagnostic
+import org.osate.result.DiagnosticType
+
+@RunWith(typeof(XtextRunner))
+@InjectWith(typeof(Aadl2InjectorProvider))
+class Issue1383Test extends XtextTest {
+
+ @Inject
+ TestHelper testHelper
+
+ val static PROJECT_LOCATION = "org.osate.analysis.resource.budgets.tests/models/Issue1383/"
+
+ @Test
+ def void testBasicResourceBudgetExample() {
+ val pkg = testHelper.parseFile(PROJECT_LOCATION + "Example.aadl")
+
+ // instantiate
+ val cls = pkg.ownedPublicSection.ownedClassifiers
+ val sysImpl = cls.findFirst[name == "MySystem.Tier0"] as SystemImplementation
+ val instance = InstantiateModel.instantiate(sysImpl)
+
+ // check power requirements
+ val checker = new PowerRequirementAnalysis()
+ val analysisResult = checker.invoke(null, instance)
+ val somResult = analysisResult.results.get(0)
+ val powerResult = somResult.subResults.get(0)
+ checkRBValues(powerResult);
+
+ val powerResult2 = somResult.subResults.get(1)
+ checkRBValues(powerResult2);
+
+ val powerResult3 = somResult.subResults.get(2)
+ checkRBValues(powerResult3);
+
+ val powerResult4 = somResult.subResults.get(3)
+ checkRBValues(powerResult4);
+
+ val powerResult5 = somResult.subResults.get(4)
+ checkRBValues(powerResult5);
+ }
+
+ @Test
+ def void testOverloadedCapacity() {
+ val pkg = testHelper.parseFile(PROJECT_LOCATION + "TestOverCapacity.aadl")
+
+ // instantiate
+ val cls = pkg.ownedPublicSection.ownedClassifiers
+ val sysImpl = cls.findFirst[name == "MySystem.Tier0"] as SystemImplementation
+ val instance = InstantiateModel.instantiate(sysImpl)
+
+ // check power requirements
+ val checker = new PowerRequirementAnalysis()
+ val analysisResult = checker.invoke(null, instance)
+ val somResult = analysisResult.results.get(0)
+ val powerResult = somResult.subResults.get(0)
+ checkOverValues(powerResult);
+
+ val powerResult2 = somResult.subResults.get(1)
+ checkOverValues(powerResult2);
+
+ val powerResult3 = somResult.subResults.get(2)
+ checkOverValues(powerResult3);
+
+ val powerResult4 = somResult.subResults.get(3)
+ checkOverValues(powerResult4);
+
+ val powerResult5 = somResult.subResults.get(4)
+ checkOverValues(powerResult5);
+ }
+
+ @Test
+ def void testNoSupply() {
+ val pkg = testHelper.parseFile(PROJECT_LOCATION + "TestNoSupply.aadl")
+
+ // instantiate
+ val cls = pkg.ownedPublicSection.ownedClassifiers
+ val sysImpl = cls.findFirst[name == "MySystem.Tier0"] as SystemImplementation
+ val instance = InstantiateModel.instantiate(sysImpl)
+
+ // check power requirements
+ val checker = new PowerRequirementAnalysis()
+ val analysisResult = checker.invoke(null, instance)
+ val somResult = analysisResult.results.get(0)
+ val powerResult = somResult.subResults.get(0)
+ checkNoSupplyValues(powerResult);
+
+ val powerResult2 = somResult.subResults.get(1)
+ checkNoSupplyValues(powerResult2);
+
+ val powerResult3 = somResult.subResults.get(2)
+ checkNoSupplyValues(powerResult3);
+
+ val powerResult4 = somResult.subResults.get(3)
+ checkNoSupplyValues(powerResult4);
+ }
+
+ private static def void checkNoSupplyValues(Result result){
+ val compName = ResultUtil.getString(result, 7)
+
+ if (compName == "hw")
+ checkValues(result, #[800.0, 0.0, 40000.0, 92500.0, 0.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds capacity 40.0 W")])
+ else if (compName == "sensor1")
+ checkValues(result, #[450.0, 0.0, 40000.0, 92500.0, 0.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds capacity 40.0 W")])
+ else if (compName == "sensor2")
+ checkValues(result, #[450.0, 0.0, 40000.0, 92500.0, 0.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds capacity 40.0 W")])
+ else if (compName == "actuator")
+ checkValues(result, #[90800.0, 0.0, 40000.0, 92500.0, 0.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds capacity 40.0 W")])
+ }
+
+ private static def void checkOverValues(Result result){
+ val compName = ResultUtil.getString(result, 7)
+
+ if (compName == "EPSU")
+ checkValues(result, #[0.0, 80000.0, 40000.0, 92500.0, 80000.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds supply 80.0 W")])
+ else if (compName == "hw")
+ checkValues(result, #[800.0, 0.0, 40000.0, 92500.0, 80000.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds supply 80.0 W")])
+ else if (compName == "sensor1")
+ checkValues(result, #[450.0, 0.0, 40000.0, 92500.0, 80000.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds supply 80.0 W")])
+ else if (compName == "sensor2")
+ checkValues(result, #[450.0, 0.0, 40000.0, 92500.0, 80000.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds supply 80.0 W")])
+ else if (compName == "actuator")
+ checkValues(result, #[90800.0, 0.0, 40000.0, 92500.0, 80000.0], #[error("Grid budget total 92.5 W exceeds capacity 40.0 W"), error("budget total 92.5 W exceeds supply 80.0 W")])
+ }
+
+ private static def void checkRBValues(Result result){
+ val compName = ResultUtil.getString(result, 7)
+
+ if (compName == "EPSU")
+ checkValues(result, #[0.0, 40000.0, 40000.0, 2500.0, 40000.0], #[])
+ else if (compName == "hw")
+ checkValues(result, #[800.0, 0.0, 40000.0, 2500.0, 40000.0], #[])
+ else if (compName == "sensor1")
+ checkValues(result, #[450.0, 0.0, 40000.0, 2500.0, 40000.0], #[])
+ else if (compName == "sensor2")
+ checkValues(result, #[450.0, 0.0, 40000.0, 2500.0, 40000.0], #[])
+ else if (compName == "actuator")
+ checkValues(result, #[800.0, 0.0, 40000.0, 2500.0, 40000.0], #[])
+ }
+
+ private static def List
-
Analyze Electrical Power Consumption
-
-The Weight Analysis sums up the weight of different components in terms of net and gross weight and compares the results against
-specified weight limits. For details see here.
-
-
MIPS, RAM, ROM, and Network Bandwidth Budget Analysis
The Budget Analysis sums up the budgets of components with resource demand and compares the total against the resource capacity - in case of bindings the budgets of those components bound to the resource. For details see here.