use of org.osate.aadl2.instance.SystemInstance in project osate2 by osate.
the class BoundResourceAnalysis method checkVirtualProcessorLoads.
private void checkVirtualProcessorLoads(SystemInstance si, final SystemOperationMode som) {
count = 0;
ForAllElement countme = new ForAllElement() {
@Override
protected void process(Element obj) {
count = count + 1;
}
};
countme.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
if (count > 0) {
errManager.infoSummaryReportOnly(si, null, "\nVirtual Processor Summary Report: " + Aadl2Util.getPrintableSOMName(som));
}
ForAllElement mal = new ForAllElement() {
@Override
protected void process(Element obj) {
checkProcessorLoad((ComponentInstance) obj, som);
}
};
mal.processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
}
use of org.osate.aadl2.instance.SystemInstance in project osate2 by osate.
the class BusLoadAnalysis method checkBusLoads.
private void checkBusLoads(SystemInstance si, final SystemOperationMode som) {
errManager.infoSummaryReportOnly(si, null, "\nBus Summary Report: " + Aadl2Util.getPrintableSOMName(som));
ForAllElement mal = new ForAllElement() {
@Override
protected void process(final Element obj) {
final ComponentInstance ci = (ComponentInstance) obj;
final ComponentCategory cat = ci.getCategory();
if (cat == ComponentCategory.BUS) {
checkBusBandWidthLoad(ci, som);
} else if (cat == ComponentCategory.VIRTUAL_BUS) {
checkVirtualBusBandWidthLoad(ci, som);
}
}
};
mal.processPreOrderComponentInstance(si);
}
use of org.osate.aadl2.instance.SystemInstance in project osate2 by osate.
the class NotBoundResourceAnalysis method analyzeResourceBudget.
public void analyzeResourceBudget(final SystemInstance si, final SystemOperationMode som) {
init();
@SuppressWarnings("unchecked") EList<ComponentInstance> proclist = (EList<ComponentInstance>) (EList<?>) new ForAllElement().processPreOrderComponentInstance(si, ComponentCategory.PROCESSOR);
logHeader("\n\nDetailed Processor MIPS Capacity Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Capacity");
capacity = sumCapacity(proclist, ResourceKind.MIPS, "processor", ProcessorSpeedUnits.MIPS);
detailedLogTotal1(null, capacity, ProcessorSpeedUnits.MIPS);
@SuppressWarnings("unchecked") EList<ComponentInstance> vproclist = (EList<ComponentInstance>) (EList<?>) new ForAllElement().processPreOrderComponentInstance(si, ComponentCategory.VIRTUAL_PROCESSOR);
if (!vproclist.isEmpty()) {
logHeader("\n\nDetailed Virtual Processor MIPS Capacity Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Capacity");
vcapacity = sumVPMIPSBudget(vproclist);
detailedLogTotal1(null, vcapacity, ProcessorSpeedUnits.MIPS);
}
logHeader("\n\nDetailed MIPS Budget Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Budget,Actual,Notes");
budgetTotal = sumBudgets(si, ResourceKind.MIPS, som, "");
if (budgetTotal >= 0) {
detailedLogTotal2(null, budgetTotal, ProcessorSpeedUnits.MIPS);
errManager.infoSummaryReportOnly(si, null, "Resource Summary: " + Aadl2Util.getPrintableSOMName(som));
report(si, "MIPS", ProcessorSpeedUnits.MIPS, som);
}
init();
@SuppressWarnings("unchecked") EList<ComponentInstance> memlist = (EList<ComponentInstance>) (EList<?>) new ForAllElement().processPreOrderComponentInstance(si, ComponentCategory.MEMORY);
capacity = capacityTotal(memlist, ResourceKind.Memory, "Memory");
if (capacity > 0) {
logHeader("\n\nDetailed Memory Capacity Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Capacity");
capacity = sumCapacity(memlist, ResourceKind.Memory, "Memory", SizeUnits.KBYTE);
detailedLogTotal1(null, capacity, SizeUnits.KBYTE);
logHeader("\n\nDetailed Memory Budget Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Budget,Actual,Notes");
budgetTotal = sumBudgets(si, ResourceKind.Memory, som, "");
if (budgetTotal >= 0) {
detailedLogTotal2(null, budgetTotal, SizeUnits.KBYTE);
report(si, "Memory", SizeUnits.KBYTE, som);
}
}
init();
capacity = capacityTotal(memlist, ResourceKind.RAM, "RAM");
if (capacity > 0) {
logHeader("\n\nDetailed RAM Capacity Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Capacity");
capacity = sumCapacity(memlist, ResourceKind.RAM, "RAM", SizeUnits.KBYTE);
detailedLogTotal1(null, capacity, SizeUnits.KBYTE);
logHeader("\n\nDetailed RAM Budget Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Budget,Actual,Notes");
budgetTotal = sumBudgets(si, ResourceKind.RAM, som, "");
if (budgetTotal >= 0) {
detailedLogTotal2(null, budgetTotal, SizeUnits.KBYTE);
report(si, "RAM", SizeUnits.KBYTE, som);
}
}
init();
capacity = capacityTotal(memlist, ResourceKind.ROM, "ROM");
if (capacity > 0) {
logHeader("\n\nDetailed ROM Capacity Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Capacity");
capacity = sumCapacity(memlist, ResourceKind.ROM, "ROM", SizeUnits.KBYTE);
detailedLogTotal1(null, capacity, SizeUnits.KBYTE);
logHeader("\n\nDetailed ROM Budget Report " + Aadl2Util.getPrintableSOMName(som) + "\n");
logHeader("Component,Budget,Actual,Notes");
budgetTotal = sumBudgets(si, ResourceKind.ROM, som, "");
if (budgetTotal >= 0) {
detailedLogTotal2(null, budgetTotal, SizeUnits.KBYTE);
report(si, "ROM", SizeUnits.KBYTE, som);
}
}
}
use of org.osate.aadl2.instance.SystemInstance in project osate2 by osate.
the class PowerAnalysis method analyzePowerBudget.
public void analyzePowerBudget(SystemInstance si, Report powerReport, SystemOperationMode som) {
final String somName = Aadl2Util.getPrintableSOMName(som);
String systemName = si.getComponentClassifier().getName();
final Section section = new Section(systemName + somName);
powerReport.addSection(section);
ForAllElement DoCapacity = new ForAllElement() {
@Override
protected void action(Element aobj) {
capacity = 0.0;
budgetTotal = 0.0;
supplyTotal = 0.0;
ComponentInstance ci = (ComponentInstance) aobj;
capacity = GetProperties.getPowerCapacity(ci, 0.0);
if (capacity == 0) {
return;
}
// components that represent a power system with capacity
powerComponentHeader(section, "Computing Electrical Power for " + ci.getName());
String supplyLine = "";
String budgetLine = "";
for (FeatureInstance fi : ci.getFeatureInstances()) {
double supply = GetProperties.getPowerBudget(fi, 0.0);
if (supply > 0) {
// there must be a connection on this feature
if (!fi.getDstConnectionInstances().isEmpty() || !fi.getSrcConnectionInstances().isEmpty()) {
supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(supply) + " from " + fi.getContainingComponentInstance().getName();
supplyTotal += supply;
} else {
// warning unconnected power requirement
}
}
for (ConnectionInstance inconni : fi.getDstConnectionInstances()) {
// incoming connections: does the other end provide power?
ConnectionInstanceEnd srcfi = inconni.getSource();
supply = GetProperties.getPowerSupply(srcfi, 0.0);
if (supply > 0) {
supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(supply) + " from " + srcfi.getContainingComponentInstance().getName();
supplyTotal += supply;
}
}
for (ConnectionInstance outconni : fi.getSrcConnectionInstances()) {
// outgoing connection. Does the other end have a power budget?
ConnectionInstanceEnd dstfi = outconni.getDestination();
double budget = GetProperties.getPowerBudget(dstfi, 0.0);
if (budget > 0) {
budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(budget) + " for " + dstfi.getContainingComponentInstance().getName();
budgetTotal += budget;
}
}
}
// this could be a bus, possibly an abstract component
for (ConnectionInstance ac : ci.getSrcConnectionInstances()) {
// Outgoing from Power system as bus
FeatureInstance dstfi = (FeatureInstance) ac.getDestination();
double budget = GetProperties.getPowerBudget(dstfi, 0.0);
if (budget > 0) {
budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(budget) + " for " + dstfi.getContainingComponentInstance().getName();
budgetTotal += budget;
}
double supply = GetProperties.getPowerSupply(dstfi, 0.0);
if (supply > 0) {
supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(supply) + " from " + dstfi.getContainingComponentInstance().getName();
supplyTotal += supply;
}
}
for (ConnectionInstance ac : ci.getDstConnectionInstances()) {
// Incoming to Power system as bus
FeatureInstance srcfi = (FeatureInstance) ac.getSource();
double budget = GetProperties.getPowerBudget(srcfi, 0.0);
if (budget > 0) {
budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(budget) + " for " + srcfi.getContainingComponentInstance().getName();
budgetTotal += budget;
}
double supply = GetProperties.getPowerSupply(srcfi, 0.0);
if (supply > 0) {
supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + PowerAnalysis.this.toString(supply) + " from " + srcfi.getContainingComponentInstance().getName();
supplyTotal += supply;
}
}
report(section, ci, somName, ci.getName() + " power", capacity, budgetTotal, supplyTotal, budgetLine, supplyLine);
}
};
DoCapacity.processPreOrderComponentInstance(si);
}
use of org.osate.aadl2.instance.SystemInstance in project osate2 by osate.
the class PriorityInversion method checkPriorityInversion.
/**
* check for priority inversion of threads bound to the given processor
* @param curProcessor Component Instance of processor
*/
public void checkPriorityInversion(ComponentInstance curProcessor) {
SystemInstance root = curProcessor.getSystemInstance();
final ComponentInstance currentProcessor = curProcessor;
EList<Element> boundThreads = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
if (!InstanceModelUtil.isPeriodicThread((ComponentInstance) obj)) {
return false;
}
List<ComponentInstance> boundProcessor;
try {
boundProcessor = GetProperties.getActualProcessorBinding((ComponentInstance) obj);
} catch (PropertyNotPresentException e) {
return false;
}
return boundProcessor.contains(currentProcessor);
}
}.processPreOrderComponentInstance(root, ComponentCategory.THREAD);
// we will sort the thread list by period and
// check to make sure the assigned priority is monotonically decreasing
ECollections.sort(boundThreads, (obj1, obj2) -> {
final double a = PropertyUtils.getScaled(TimingProperties::getPeriod, (ComponentInstance) obj1, TimeUnits.MS).orElse(0.0);
final double b = PropertyUtils.getScaled(TimingProperties::getPeriod, (ComponentInstance) obj2, TimeUnits.MS).orElse(0.0);
if (a > b) {
return 1;
}
if (a == b) {
return 0;
}
return -1;
});
checkDecreasingPriority(boundThreads);
}
Aggregations