From 1574820141c43a81a8502b38d285296b8354e5cb Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Tue, 8 Dec 2020 16:27:25 -0500 Subject: [PATCH 01/23] initial attempt to restructure power requirement analysis --- .../handlers/NewAbstractAaxlHandler.java | 219 +++++++++++++++++ .../handlers/NewBusLoadAnalysisHandler.java | 224 +----------------- .../handlers/NewPowerAnalysisHandler.java | 79 ++++++ .../power/PowerRequirementAnalysis.java | 54 +++++ 4 files changed, 354 insertions(+), 222 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java index c28ba924040..53d60ceb5e6 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java @@ -23,8 +23,11 @@ */ package org.osate.analysis.resource.budgets.handlers; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -54,12 +57,20 @@ import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; +import org.osate.aadl2.Element; import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.instance.SystemOperationMode; import org.osate.aadl2.modelsupport.Activator; import org.osate.aadl2.modelsupport.FileNameConstants; +import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; import org.osate.aadl2.modelsupport.resources.OsateResourceUtil; +import org.osate.aadl2.util.Aadl2Util; import org.osate.analysis.resource.budgets.ResourceBudgetPlugin; import org.osate.core.AadlNature; +import org.osate.result.AnalysisResult; +import org.osate.result.Diagnostic; +import org.osate.result.Result; +import org.osate.result.util.ResultUtil; import org.osate.ui.internal.instantiate.InstantiationEngine; /** @@ -347,4 +358,212 @@ private static void makeSureFoldersExist(IFolder folder) { } } + public static void generateMarkers(final AnalysisResult analysisResult, + final AnalysisErrorReporterManager errManager) { + // Handle each SOM + analysisResult.getResults().forEach(r -> { + final String somName = r.getMessage(); + final String somPostfix = somName.isEmpty() ? "" : (" in modes " + somName); + generateMarkersForSOM(r, errManager, somPostfix); + }); + } + + private static void generateMarkersForSOM(final Result result, final AnalysisErrorReporterManager errManager, + final String somPostfix) { + generateMarkersFromDiagnostics(result.getDiagnostics(), errManager, somPostfix); + result.getSubResults().forEach(r -> generateMarkersForSOM(r, errManager, somPostfix)); + } + + private static void generateMarkersFromDiagnostics(final List diagnostics, + final AnalysisErrorReporterManager errManager, final String somPostfix) { + diagnostics.forEach(issue -> { + switch (issue.getDiagnosticType()) { + case ERROR: + errManager.error((Element) issue.getModelElement(), issue.getMessage() + somPostfix); + break; + case INFO: + errManager.info((Element) issue.getModelElement(), issue.getMessage() + somPostfix); + break; + case WARNING: + errManager.warning((Element) issue.getModelElement(), issue.getMessage() + somPostfix); + break; + default: + // Do nothing. + } + }); + } + + // === CSV Output methods === + + public static void writeCSVFile(final AnalysisResult analysisResult, final IFile outputFile, + final IProgressMonitor monitor) { + final String csvContent = getCSVasString(analysisResult); + final InputStream inputStream = new ByteArrayInputStream(csvContent.getBytes()); + + try { + if (outputFile.exists()) { + outputFile.setContents(inputStream, true, true, monitor); + } else { + outputFile.create(inputStream, true, monitor); + } + } catch (final CoreException e) { + Activator.logThrowable(e); + } + } + + private static String getCSVasString(final AnalysisResult analysisResult) { + final StringWriter writer = new StringWriter(); + final PrintWriter pw = new PrintWriter(writer); + generateCSVforAnalysis(pw, analysisResult); + pw.close(); + return writer.toString(); + } + + private static void generateCSVforAnalysis(final PrintWriter pw, final AnalysisResult analysisResult) { + pw.println(analysisResult.getMessage()); + pw.println(); + pw.println(); + analysisResult.getResults().forEach(somResult -> generateCSVforSOM(pw, somResult)); + } + + private static void generateCSVforSOM(final PrintWriter pw, final Result somResult) { + if (Aadl2Util.isPrintableSOMName((SystemOperationMode) somResult.getModelElement())) { + printItem(pw, "Analysis results in modes " + somResult.getMessage()); + pw.println(); + } + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Physical Bus", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", "Actual (KB/s)"); + + for (final Result subResult : somResult.getSubResults()) { + // Label, Capacity, Budget, Required Capacity, Actual + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1)), + Double.toString(ResultUtil.getReal(subResult, 2)), + Double.toString(ResultUtil.getReal(subResult, 3))); + } + pw.println(); + + // NO DIAGNOSTICS AT THE SOM LEVEL + + somResult.getSubResults().forEach(busResult -> generateCSVforBus(pw, busResult, null)); + pw.println(); // add a second newline, the first is from the end of generateCSVforBus() + } + + private static void generateCSVforBus(final PrintWriter pw, final Result busResult, final Result boundTo) { + final long dataOverhead = ResultUtil.getInteger(busResult, 7); + if (boundTo == null) { + printItem(pw, "Bus " + busResult.getMessage() + " has data overhead of " + dataOverhead + " bytes"); + } else { + printItem(pw, "Virtual bus " + busResult.getMessage() + " bound to " + boundTo.getMessage() + + " has data overhead of " + dataOverhead + " bytes"); + } + pw.println(); + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Bound Virtual Bus/Connection", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", + "Actual (KB/s)"); + + final int numBus = (int) ResultUtil.getInteger(busResult, 4); + final int numConnections = (int) ResultUtil.getInteger(busResult, 5); + final List subResults = busResult.getSubResults(); + for (final Result subResult : subResults.subList(0, numBus)) { + // Label, Capacity, Budget, Required Capacity, Actual + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1)), + Double.toString(ResultUtil.getReal(subResult, 2)), + Double.toString(ResultUtil.getReal(subResult, 3))); + } + for (final Result subResult : subResults.subList(numBus, subResults.size())) { + // Label, NO CAPACITY, Budget, NO REQUIRED CAPACITY, Actual + // Capacity, NO BUDGET, Required + printItems(pw, subResult.getMessage(), "", Double.toString(ResultUtil.getReal(subResult, 0)), "", + Double.toString(ResultUtil.getReal(subResult, 1))); + } + pw.println(); + + if (!busResult.getDiagnostics().isEmpty()) { + generateCSVforDiagnostics(pw, busResult.getDiagnostics()); + pw.println(); + } + + subResults.subList(0, numBus).forEach(br -> generateCSVforBus(pw, br, busResult)); + subResults.subList(numBus, numBus + numConnections).forEach(br -> generateCSVforConnection(pw, br, busResult)); + subResults.subList(numBus + numConnections, subResults.size()) + .forEach(br -> generateCSVforBroadcast(pw, br, busResult)); + } + + private static void generateCSVforBroadcast(final PrintWriter pw, final Result broadcastResult, + final Result boundTo) { + printItem(pw, broadcastResult.getMessage() + " over bus " + boundTo.getMessage()); + pw.println(); + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Included Connection", "Budget (KB/s)", "Actual (KB/s)"); + + final List subResults = broadcastResult.getSubResults(); + for (final Result subResult : subResults) { + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1))); + } + pw.println(); + + if (!broadcastResult.getDiagnostics().isEmpty()) { + generateCSVforDiagnostics(pw, broadcastResult.getDiagnostics()); + pw.println(); + } + + subResults.forEach(br -> generateCSVforConnection(pw, br, broadcastResult)); + } + + private static void generateCSVforConnection(final PrintWriter pw, final Result connectionResult, + final Result boundTo) { + // only do something if there are diagnostics + if (!connectionResult.getDiagnostics().isEmpty()) { + printItem(pw, "Connection " + connectionResult.getMessage() + " bound to " + boundTo.getMessage()); + generateCSVforDiagnostics(pw, connectionResult.getDiagnostics()); + pw.println(); + } + } + + private static void generateCSVforDiagnostics(final PrintWriter pw, final List diagnostics) { + for (final Diagnostic issue : diagnostics) { + printItem(pw, issue.getDiagnosticType().getName() + ": " + issue.getMessage()); + pw.println(); + } + } + + // ==== Low-level CSV format, this should be abstracted somewhere + + private static void printItems(final PrintWriter pw, final String item1, final String... items) { + printItem(pw, item1); + for (final String nextItem : items) { + printSeparator(pw); + printItem(pw, nextItem); + } + pw.println(); + } + + private static void printItem(final PrintWriter pw, final String item) { + // TODO: Doesn't handle quotes in the item! + pw.print('"'); + pw.print(item); + pw.print('"'); + } + + private static void printSeparator(final PrintWriter pw) { + pw.print(","); + } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java index d3260ef442a..6d6d19d51cf 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java @@ -23,12 +23,6 @@ */ package org.osate.analysis.resource.budgets.handlers; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.List; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.WorkspaceJob; import org.eclipse.core.runtime.CoreException; @@ -38,19 +32,12 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.Job; -import org.osate.aadl2.Element; import org.osate.aadl2.instance.SystemInstance; -import org.osate.aadl2.instance.SystemOperationMode; -import org.osate.aadl2.modelsupport.Activator; import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; import org.osate.aadl2.modelsupport.errorreporting.MarkerAnalysisErrorReporter; import org.osate.aadl2.modelsupport.util.AadlUtil; -import org.osate.aadl2.util.Aadl2Util; import org.osate.analysis.resource.budgets.busload.NewBusLoadAnalysis; import org.osate.result.AnalysisResult; -import org.osate.result.Diagnostic; -import org.osate.result.Result; -import org.osate.result.util.ResultUtil; /** * @since 3.0 @@ -121,214 +108,7 @@ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreExcepti * have the system operation modes as the first level of results under the AnalysisResult * object. If we can standardize the handling of SOMs then we can standardize these methods * somewhere; + * + * this is moved to NewAbstractAaxlHandler.java */ - - private static void generateMarkers(final AnalysisResult analysisResult, - final AnalysisErrorReporterManager errManager) { - // Handle each SOM - analysisResult.getResults().forEach(r -> { - final String somName = r.getMessage(); - final String somPostfix = somName.isEmpty() ? "" : (" in modes " + somName); - generateMarkersForSOM(r, errManager, somPostfix); - }); - } - - private static void generateMarkersForSOM(final Result result, final AnalysisErrorReporterManager errManager, - final String somPostfix) { - generateMarkersFromDiagnostics(result.getDiagnostics(), errManager, somPostfix); - result.getSubResults().forEach(r -> generateMarkersForSOM(r, errManager, somPostfix)); - } - - private static void generateMarkersFromDiagnostics(final List diagnostics, - final AnalysisErrorReporterManager errManager, final String somPostfix) { - diagnostics.forEach(issue -> { - switch (issue.getDiagnosticType()) { - case ERROR: - errManager.error((Element) issue.getModelElement(), issue.getMessage() + somPostfix); - break; - case INFO: - errManager.info((Element) issue.getModelElement(), issue.getMessage() + somPostfix); - break; - case WARNING: - errManager.warning((Element) issue.getModelElement(), issue.getMessage() + somPostfix); - break; - default: - // Do nothing. - } - }); - } - - // === CSV Output methods === - - private static void writeCSVFile(final AnalysisResult analysisResult, final IFile outputFile, - final IProgressMonitor monitor) { - final String csvContent = getCSVasString(analysisResult); - final InputStream inputStream = new ByteArrayInputStream(csvContent.getBytes()); - - try { - if (outputFile.exists()) { - outputFile.setContents(inputStream, true, true, monitor); - } else { - outputFile.create(inputStream, true, monitor); - } - } catch (final CoreException e) { - Activator.logThrowable(e); - } - } - - private static String getCSVasString(final AnalysisResult analysisResult) { - final StringWriter writer = new StringWriter(); - final PrintWriter pw = new PrintWriter(writer); - generateCSVforAnalysis(pw, analysisResult); - pw.close(); - return writer.toString(); - } - - private static void generateCSVforAnalysis(final PrintWriter pw, final AnalysisResult analysisResult) { - pw.println(analysisResult.getMessage()); - pw.println(); - pw.println(); - analysisResult.getResults().forEach(somResult -> generateCSVforSOM(pw, somResult)); - } - - private static void generateCSVforSOM(final PrintWriter pw, final Result somResult) { - if (Aadl2Util.isPrintableSOMName((SystemOperationMode) somResult.getModelElement())) { - printItem(pw, "Analysis results in modes " + somResult.getMessage()); - pw.println(); - } - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Physical Bus", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", "Actual (KB/s)"); - - for (final Result subResult : somResult.getSubResults()) { - // Label, Capacity, Budget, Required Capacity, Actual - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1)), - Double.toString(ResultUtil.getReal(subResult, 2)), - Double.toString(ResultUtil.getReal(subResult, 3))); - } - pw.println(); - - // NO DIAGNOSTICS AT THE SOM LEVEL - - somResult.getSubResults().forEach(busResult -> generateCSVforBus(pw, busResult, null)); - pw.println(); // add a second newline, the first is from the end of generateCSVforBus() - } - - private static void generateCSVforBus(final PrintWriter pw, final Result busResult, final Result boundTo) { - final long dataOverhead = ResultUtil.getInteger(busResult, 7); - if (boundTo == null) { - printItem(pw, "Bus " + busResult.getMessage() + " has data overhead of " + dataOverhead + " bytes"); - } else { - printItem(pw, "Virtual bus " + busResult.getMessage() + " bound to " + boundTo.getMessage() - + " has data overhead of " + dataOverhead + " bytes"); - } - pw.println(); - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Bound Virtual Bus/Connection", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", - "Actual (KB/s)"); - - final int numBus = (int) ResultUtil.getInteger(busResult, 4); - final int numConnections = (int) ResultUtil.getInteger(busResult, 5); - final List subResults = busResult.getSubResults(); - for (final Result subResult : subResults.subList(0, numBus)) { - // Label, Capacity, Budget, Required Capacity, Actual - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1)), - Double.toString(ResultUtil.getReal(subResult, 2)), - Double.toString(ResultUtil.getReal(subResult, 3))); - } - for (final Result subResult : subResults.subList(numBus, subResults.size())) { - // Label, NO CAPACITY, Budget, NO REQUIRED CAPACITY, Actual - // Capacity, NO BUDGET, Required - printItems(pw, subResult.getMessage(), "", Double.toString(ResultUtil.getReal(subResult, 0)), "", - Double.toString(ResultUtil.getReal(subResult, 1))); - } - pw.println(); - - if (!busResult.getDiagnostics().isEmpty()) { - generateCSVforDiagnostics(pw, busResult.getDiagnostics()); - pw.println(); - } - - subResults.subList(0, numBus).forEach(br -> generateCSVforBus(pw, br, busResult)); - subResults.subList(numBus, numBus + numConnections).forEach(br -> generateCSVforConnection(pw, br, busResult)); - subResults.subList(numBus + numConnections, subResults.size()) - .forEach(br -> generateCSVforBroadcast(pw, br, busResult)); - } - - private static void generateCSVforBroadcast(final PrintWriter pw, final Result broadcastResult, - final Result boundTo) { - printItem(pw, broadcastResult.getMessage() + " over bus " + boundTo.getMessage()); - pw.println(); - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Included Connection", "Budget (KB/s)", "Actual (KB/s)"); - - final List subResults = broadcastResult.getSubResults(); - for (final Result subResult : subResults) { - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1))); - } - pw.println(); - - if (!broadcastResult.getDiagnostics().isEmpty()) { - generateCSVforDiagnostics(pw, broadcastResult.getDiagnostics()); - pw.println(); - } - - subResults.forEach(br -> generateCSVforConnection(pw, br, broadcastResult)); - } - - private static void generateCSVforConnection(final PrintWriter pw, final Result connectionResult, - final Result boundTo) { - // only do something if there are diagnostics - if (!connectionResult.getDiagnostics().isEmpty()) { - printItem(pw, "Connection " + connectionResult.getMessage() + " bound to " + boundTo.getMessage()); - generateCSVforDiagnostics(pw, connectionResult.getDiagnostics()); - pw.println(); - } - } - - private static void generateCSVforDiagnostics(final PrintWriter pw, final List diagnostics) { - for (final Diagnostic issue : diagnostics) { - printItem(pw, issue.getDiagnosticType().getName() + ": " + issue.getMessage()); - pw.println(); - } - } - - // ==== Low-level CSV format, this should be abstracted somewhere - - private static void printItems(final PrintWriter pw, final String item1, final String... items) { - printItem(pw, item1); - for (final String nextItem : items) { - printSeparator(pw); - printItem(pw, nextItem); - } - pw.println(); - } - - private static void printItem(final PrintWriter pw, final String item) { - // TODO: Doesn't handle quotes in the item! - pw.print('"'); - pw.print(item); - pw.print('"'); - } - - private static void printSeparator(final PrintWriter pw) { - pw.print(","); - } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java new file mode 100644 index 00000000000..04e9083987a --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java @@ -0,0 +1,79 @@ +package org.osate.analysis.resource.budgets.handlers; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.jobs.Job; +import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; +import org.osate.aadl2.modelsupport.errorreporting.MarkerAnalysisErrorReporter; +import org.osate.aadl2.modelsupport.util.AadlUtil; +import org.osate.analysis.resource.budgets.power.PowerRequirementAnalysis; +import org.osate.result.AnalysisResult; + +/** + * @since 4.0 + */ +public class NewPowerAnalysisHandler extends NewAbstractAaxlHandler { + private static final String MARKER_TYPE = "org.osate.analysis.resource.budgets.PowerAnalysisMarker"; + private static final String REPORT_SUB_DIR = "Power"; + + @Override + protected String getSubDirName() { + return REPORT_SUB_DIR; + } + + @Override + protected String getOutputFileForAaxlFile(final IFile aaxlFile, final String filename) { + return filename + "__Power.csv"; + } + + @Override + protected Job createAnalysisJob(IFile aaxlFile, IFile outputFile) { + // TODO Auto-generated method stub + return null; + } + + private final class PowerReqJob extends WorkspaceJob { + private final IFile aaxlFile; + private final IFile outputFile; + + public PowerReqJob(final IFile aaxlFile, final IFile outputFile) { + super("Power Requirements analysis of " + aaxlFile.getName()); + this.aaxlFile = aaxlFile; + this.outputFile = outputFile; + } + + @Override + public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException { + final AnalysisErrorReporterManager errManager = new AnalysisErrorReporterManager( + new MarkerAnalysisErrorReporter.Factory(MARKER_TYPE)); + + // Three phases (1) analysis, (2) marker generation, (3) csv file + final SubMonitor subMonitor = SubMonitor.convert(monitor, 3); + boolean cancelled = false; + + try { + final AnalysisResult analysisResult = new PowerRequirementAnalysis().invoke(subMonitor.split(1), + (SystemInstance) AadlUtil.getElement(aaxlFile)); + if (subMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + generateMarkers(analysisResult, errManager); + subMonitor.worked(1); + writeCSVFile(analysisResult, outputFile, subMonitor.split(1)); + } catch (final OperationCanceledException e) { + cancelled = true; + } + + return cancelled ? Status.CANCEL_STATUS : Status.OK_STATUS; + } + + } + +} \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java new file mode 100644 index 00000000000..2f052a3fac6 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -0,0 +1,54 @@ +package org.osate.analysis.resource.budgets.power; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.osate.aadl2.Element; +import org.osate.aadl2.instance.InstanceObject; +import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.instance.SystemOperationMode; +import org.osate.aadl2.modelsupport.modeltraversal.SOMIterator; +import org.osate.aadl2.util.Aadl2Util; +import org.osate.result.AnalysisResult; +import org.osate.result.Result; +import org.osate.result.ResultType; +import org.osate.result.util.ResultUtil; +import org.osate.ui.dialogs.Dialog; + +public class PowerRequirementAnalysis { + public PowerRequirementAnalysis() { + super(); + } + + public AnalysisResult invoke(final IProgressMonitor monitor, final SystemInstance systemInstance) { + final IProgressMonitor pm = monitor == null ? new NullProgressMonitor() : monitor; + return analyzeBody(pm, systemInstance); + } + + private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element obj) { + if (obj instanceof InstanceObject) { + final SystemInstance root = ((InstanceObject) obj).getSystemInstance(); + final AnalysisResult analysisResult = ResultUtil.createAnalysisResult("Bus Load", root); + analysisResult.setResultType(ResultType.SUCCESS); + analysisResult.setMessage("Bus load analysis of " + root.getFullName()); + + final SOMIterator soms = new SOMIterator(root); + while (soms.hasNext()) { + final SystemOperationMode som = soms.nextSOM(); + final Result somResult = ResultUtil.createResult( + Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, + ResultType.SUCCESS); + analysisResult.getResults().add(somResult); + // final BusLoadModel model = BusLoadModel.buildModel(root, som); + + // Analyze the model + // model.visit(new PowerAnalysisVisitor(somResult)); + } + monitor.done(); + + return analysisResult; + } else { + Dialog.showError("Bound Bus Bandwidth Analysis Error", "Can only check system instances"); + return null; + } + } +} \ No newline at end of file From acb5f8caba634b2a4b1b4a1c8ee79531936e2cd5 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Wed, 9 Dec 2020 11:54:59 -0500 Subject: [PATCH 02/23] link new handler to UI. verify that it gets called --- alisa/org.osate.verify/META-INF/MANIFEST.MF | 2 +- .../plugin.xml | 4 +-- .../handlers/NewPowerAnalysisHandler.java | 5 ++- .../power/PowerRequirementAnalysis.java | 32 +++++++++++++++++-- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/alisa/org.osate.verify/META-INF/MANIFEST.MF b/alisa/org.osate.verify/META-INF/MANIFEST.MF index dd1a072bed2..5b8b0cd4221 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.resource.budgets/plugin.xml b/analyses/org.osate.analysis.resource.budgets/plugin.xml index ba6bb6df3d1..25c674e8814 100644 --- a/analyses/org.osate.analysis.resource.budgets/plugin.xml +++ b/analyses/org.osate.analysis.resource.budgets/plugin.xml @@ -101,10 +101,10 @@ censes only apply to the Third Party Software and not any other portion of this - + 1) { + whichMode = Dialog.askQuestion("Choose Mode", + "Please choose in which mode(s) the model should be analyzed.", ALL_MODE_CHOICE_LABELS, + lastDefaultModeChoice); + } else { + // A system with no modes still has at least one SOM named NORMAL_SOM_NAME aka "no modes" + whichMode = INITIAL_MODE; + } final SOMIterator soms = new SOMIterator(root); while (soms.hasNext()) { @@ -38,6 +63,7 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, ResultType.SUCCESS); analysisResult.getResults().add(somResult); + // final BusLoadModel model = BusLoadModel.buildModel(root, som); // Analyze the model @@ -47,7 +73,7 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element return analysisResult; } else { - Dialog.showError("Bound Bus Bandwidth Analysis Error", "Can only check system instances"); + Dialog.showError("Power Requirements Analysis Error", "Can only check system instances"); return null; } } From e122f93d764c8ca474fff992d35f695fca072464 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Wed, 9 Dec 2020 14:58:24 -0500 Subject: [PATCH 03/23] carry over code from old analysis file --- .../power/PowerRequirementAnalysis.java | 268 ++++++++++++++++++ 1 file changed, 268 insertions(+) diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index a182f01925a..d61dae3f98a 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -1,18 +1,35 @@ package org.osate.analysis.resource.budgets.power; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.osate.aadl2.Element; +import org.osate.aadl2.instance.ComponentInstance; +import org.osate.aadl2.instance.ConnectionInstance; +import org.osate.aadl2.instance.ConnectionInstanceEnd; +import org.osate.aadl2.instance.FeatureInstance; import org.osate.aadl2.instance.InstanceObject; import org.osate.aadl2.instance.SystemInstance; import org.osate.aadl2.instance.SystemOperationMode; +import org.osate.aadl2.modelsupport.AadlConstants; +import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; +import org.osate.aadl2.modelsupport.errorreporting.MarkerAnalysisErrorReporter; +import org.osate.aadl2.modelsupport.modeltraversal.ForAllElement; import org.osate.aadl2.modelsupport.modeltraversal.SOMIterator; import org.osate.aadl2.util.Aadl2Util; +import org.osate.analysis.flows.reporting.model.Line; +import org.osate.analysis.flows.reporting.model.Report; +import org.osate.analysis.flows.reporting.model.Report.ReportType; +import org.osate.analysis.flows.reporting.model.Section; import org.osate.result.AnalysisResult; import org.osate.result.Result; import org.osate.result.ResultType; import org.osate.result.util.ResultUtil; import org.osate.ui.dialogs.Dialog; +import org.osate.xtext.aadl2.properties.util.GetProperties; + public class PowerRequirementAnalysis { private static final String INITIAL_MODE_LABEL = "Initial Mode"; @@ -27,6 +44,11 @@ public class PowerRequirementAnalysis { private static final int DEFAULT_MODE_CHOICE = INITIAL_MODE; private int lastDefaultModeChoice = DEFAULT_MODE_CHOICE; + private Report powerReport; + + private double capacity = 0; + private double budgetTotal = 0; + private double supplyTotal = 0; public PowerRequirementAnalysis() { super(); @@ -56,6 +78,52 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element whichMode = INITIAL_MODE; } + if (whichMode != -1) { + lastDefaultModeChoice = whichMode; + + SystemOperationMode chosenSOM = null; + if (!si.getSystemOperationModes().isEmpty()) { + // the SOM list should not be empty + if (whichMode == INITIAL_MODE) { + // this may also be "No Modes" aka NORMAL_SOM_NAME + chosenSOM = si.getInitialSystemOperationMode(); + } else if (whichMode == CHOOSE_MODE) { + List ar = new ArrayList(); + si.getSystemOperationModes().forEach((som) -> ar.add(som.getFullName())); + int choosen = Dialog.askQuestion("Choose Mode", + "Please choose in which mode(s) the model should be analyzed.", + ar.toArray(new String[ar.size()]), + lastDefaultModeChoice); + + chosenSOM = si.getSystemOperationModes().get(choosen); + + /* + * final SOMChooserDialog somDialog = new SOMChooserDialog(getShell(), si, false); + * if (somDialog.openThreadSafe() == Window.OK) { + * chosenSOM = somDialog.getSOM(); + * } else { + * return null; + * } + */ + } + } + + final AnalysisErrorReporterManager errManager = new AnalysisErrorReporterManager( + new MarkerAnalysisErrorReporter.Factory(AadlConstants.AADLOBJECTMARKER)); + if (chosenSOM != null) { + analyzeInstanceModelInMode(monitor, errManager, si, chosenSOM); + } else { + final SOMIterator soms = new SOMIterator(si); + while (soms.hasNext()) { + final SystemOperationMode som = soms.nextSOM(); + analyzeInstanceModelInMode(monitor, errManager, si, som); + } + } + + // finalize to csv file + + } + final SOMIterator soms = new SOMIterator(root); while (soms.hasNext()) { final SystemOperationMode som = soms.nextSOM(); @@ -77,4 +145,204 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element return null; } } + + private void analyzeInstanceModelInMode(final IProgressMonitor monitor, + final AnalysisErrorReporterManager errManager, final SystemInstance si, final SystemOperationMode som) { + errManager.addPrefix(Aadl2Util.getPrintableSOMName(som) + ": "); + si.setCurrentSystemOperationMode(som); + analyzeInstanceModel(monitor, errManager, si, som); + si.clearCurrentSystemOperationMode(); + errManager.removePrefix(); + } + + protected void analyzeInstanceModel(IProgressMonitor monitor, AnalysisErrorReporterManager errManager, + SystemInstance root, SystemOperationMode som) { + monitor.beginTask("Power Analysis", 1); +// PowerAnalysis pas = new PowerAnalysis(errManager); + powerReport = new Report(root, "Power", "Power", ReportType.TABLE); +// pas.analyzePowerBudget(root, powerReport, som); + analyzePowerBudget(root, powerReport, som, errManager); + monitor.done(); + } + + public void analyzePowerBudget(SystemInstance si, Report powerReport, SystemOperationMode som, + AnalysisErrorReporterManager errManager) { + 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) { + // supply in form of power budget drawn this power supply from other supply + // this could be a requires bus access, or an incoming abstract feature + // there must be a connection on this feature + if (!fi.getDstConnectionInstances().isEmpty() || !fi.getSrcConnectionInstances().isEmpty()) { + supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + + PowerRequirementAnalysis.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() ? "" : ", ") + + PowerRequirementAnalysis.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() ? "" : ", ") + + PowerRequirementAnalysis.this.toString(budget) + " for " + + dstfi.getContainingComponentInstance().getName(); + budgetTotal += budget; + } + } + } + // power supply and budget based on access connections to this bus + // we are checking whether there are connections with the component with power capacity as source or destination + // 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() ? "" : ", ") + + PowerRequirementAnalysis.this.toString(budget) + " for " + + dstfi.getContainingComponentInstance().getName(); + budgetTotal += budget; + } + double supply = GetProperties.getPowerSupply(dstfi, 0.0); + if (supply > 0) { + supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + + PowerRequirementAnalysis.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() ? "" : ", ") + + PowerRequirementAnalysis.this.toString(budget) + " for " + + srcfi.getContainingComponentInstance().getName(); + budgetTotal += budget; + } + double supply = GetProperties.getPowerSupply(srcfi, 0.0); + if (supply > 0) { + supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") + + PowerRequirementAnalysis.this.toString(supply) + " from " + + srcfi.getContainingComponentInstance().getName(); + supplyTotal += supply; + } + } + report(section, ci, somName, ci.getName() + " power", capacity, budgetTotal, supplyTotal, budgetLine, + supplyLine, errManager); + } + }; + DoCapacity.processPreOrderComponentInstance(si); + } + + private void powerComponentHeader(Section s, String header) { + Line line = new Line(); + line.addHeaderContent(header); + s.addLine(line); + } + + private String toString(double value) { + return value > 2000.0 ? value / 1000 + " W" : value + " mW"; + } + + private void report(Section section, ComponentInstance ci, String somName, String resourceName, double capacity, + double budget, double supply, String budgetDetail, String supplyDetails, + AnalysisErrorReporterManager errManager) { + powerComponentInfo(section, "Capacity: " + toString(capacity), ""); + powerComponentInfo(section, "Supply: " + toString(supply), supplyDetails); + powerComponentInfo(section, "Budget: " + toString(budget), budgetDetail); + if (capacity > 0.0 && budget > 0.0) { + if (budget > capacity) { + String message = "** " + resourceName + " budget total " + toString(budget) + " exceeds capacity " + + toString(capacity); + errManager.error(ci, somName + ": " + message); + powerComponentError(section, message); + } else { + String message = resourceName + " budget total " + toString(budget) + " within capacity " + + toString(capacity); + errManager.info(ci, somName + ": " + message); + powerComponentSuccess(section, message); + } + } + String suppliedmsg = ""; + double available = 0.0; + if (supply == 0.0) { + available = capacity; + suppliedmsg = " capacity "; + } else { + available = supply; + suppliedmsg = " supply "; + } + + if (budget > available) { + String message = "** " + "budget total " + toString(budget) + " exceeds" + suppliedmsg + + toString(available); + powerComponentError(section, message); + errManager.error(ci, somName + ": " + message); + } else { + String message = "budget total " + toString(budget) + " within" + suppliedmsg + toString(available); + errManager.info(ci, somName + ": " + message); + powerComponentSuccess(section, message); + } + Line l = new Line(); + l.addContent(""); + section.addLine(l); + } + + private void powerComponentInfo(Section s, String header, String optional) { + Line line = new Line(); + line.addHeaderContent(header); + if (!optional.isEmpty()) { + line.addContent(optional); + } + s.addLine(line); + } + + private void powerComponentSuccess(Section s, String msg) { + Line line = new Line(); + line.addInfo(msg); + s.addLine(line); + } + + private void powerComponentError(Section s, String msg) { + Line line = new Line(); + line.addError(msg); + s.addLine(line); + } } \ No newline at end of file From ad92495236d01dd2d6e8c5e3a6b22267e7349b8e Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Wed, 9 Dec 2020 20:14:06 -0500 Subject: [PATCH 04/23] start on the model --- .../busload/model/PowerRequirementModel.java | 30 +++++++++++++++ .../power/PowerRequirementAnalysis.java | 38 ++++++++++--------- 2 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java new file mode 100644 index 00000000000..4defa381bd6 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -0,0 +1,30 @@ +package org.osate.analysis.resource.budgets.internal.busload.model; + +import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.instance.SystemOperationMode; + +public class PowerRequirementModel extends ModelElement { + /** + * Use {@link #buildModel(SystemInstance, SystemOperationMode)} to get an instance of the + * model. + */ + private PowerRequirementModel() { + super(); + } + + @Override + void visitSelfPrefix(final Visitor visitor) { + // visitor.visitModelPrefix(this); + } + + @Override + void visitChildren(final Visitor visitor) { + // visit(rootBuses, visitor); + } + + @Override + void visitSelfPostfix(final Visitor visitor) { + // visitor.visitModelPostfix(this); + } + +} diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index d61dae3f98a..3064832aa67 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -111,32 +111,34 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element final AnalysisErrorReporterManager errManager = new AnalysisErrorReporterManager( new MarkerAnalysisErrorReporter.Factory(AadlConstants.AADLOBJECTMARKER)); if (chosenSOM != null) { - analyzeInstanceModelInMode(monitor, errManager, si, chosenSOM); + // analyzeInstanceModelInMode(monitor, errManager, si, chosenSOM); + final Result somResult = ResultUtil.createResult( + Aadl2Util.isPrintableSOMName(chosenSOM) ? Aadl2Util.getPrintableSOMMembers(chosenSOM) : "", + chosenSOM, ResultType.SUCCESS); + analysisResult.getResults().add(somResult); + + // final BusLoadModel model = BusLoadModel.buildModel(root, som); + + // Analyze the model + // model.visit(new PowerAnalysisVisitor(somResult)); } else { final SOMIterator soms = new SOMIterator(si); while (soms.hasNext()) { final SystemOperationMode som = soms.nextSOM(); - analyzeInstanceModelInMode(monitor, errManager, si, som); - } - } + // analyzeInstanceModelInMode(monitor, errManager, si, som); + final Result somResult = ResultUtil.createResult( + Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, + ResultType.SUCCESS); + analysisResult.getResults().add(somResult); - // finalize to csv file + // final BusLoadModel model = BusLoadModel.buildModel(root, som); + // Analyze the model + // model.visit(new PowerAnalysisVisitor(somResult)); + } + } } - final SOMIterator soms = new SOMIterator(root); - while (soms.hasNext()) { - final SystemOperationMode som = soms.nextSOM(); - final Result somResult = ResultUtil.createResult( - Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, - ResultType.SUCCESS); - analysisResult.getResults().add(somResult); - - // final BusLoadModel model = BusLoadModel.buildModel(root, som); - - // Analyze the model - // model.visit(new PowerAnalysisVisitor(somResult)); - } monitor.done(); return analysisResult; From df3fc770edbe32eaecbd1655968c75e929f4a2d4 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Thu, 10 Dec 2020 12:01:47 -0500 Subject: [PATCH 05/23] build up a model for power requirements analysis --- .../internal/busload/model/ConnectionEnd.java | 36 +++++ .../internal/busload/model/Feature.java | 39 +++++ .../busload/model/PowerRequirementModel.java | 146 +++++++++++++++++- .../internal/busload/model/Visitor.java | 73 +++++++++ 4 files changed, 291 insertions(+), 3 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java new file mode 100644 index 00000000000..876ee261cff --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java @@ -0,0 +1,36 @@ +package org.osate.analysis.resource.budgets.internal.busload.model; + +import org.osate.aadl2.instance.ConnectionInstanceEnd; + +public class ConnectionEnd extends AnalysisElement { + /** The connection instance end represented. */ + private final ConnectionInstanceEnd connInstanceEnd; + private final double budget; + private final double supply; + + public ConnectionEnd(final ConnectionInstanceEnd connInstanceEnd, double budget, double supply) { + super("connectionEnd"); + this.connInstanceEnd = connInstanceEnd; + this.budget = budget; + this.supply = supply; + } + + public final ConnectionInstanceEnd getConnectionInstanceEnd() { + return connInstanceEnd; + } + + @Override + void visitChildren(final Visitor visitor) { + // no children + } + + @Override + void visitSelfPrefix(final Visitor visitor) { + // visitor.visitConnectionEnd(this); + } + + @Override + void visitSelfPostfix(final Visitor visitor) { + // leaf node, already visited with prefix + } +} diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java new file mode 100644 index 00000000000..cf4447e815f --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java @@ -0,0 +1,39 @@ +package org.osate.analysis.resource.budgets.internal.busload.model; + +import org.osate.aadl2.instance.FeatureInstance; + +public class Feature extends AnalysisElement { + private final FeatureInstance featureInstance; + private final double budget; + private final double supply; + + public Feature(final FeatureInstance featureInstance, double budget, double supply) { + super("feature"); + this.featureInstance = featureInstance; + this.budget = budget; + this.supply = supply; + } + + public final FeatureInstance getFeatureInstance() { + return featureInstance; + } + + @Override + void visitSelfPrefix(Visitor visitor) { + // TODO Auto-generated method stub + + } + + @Override + void visitChildren(Visitor visitor) { + // TODO Auto-generated method stub + + } + + @Override + void visitSelfPostfix(Visitor visitor) { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java index 4defa381bd6..cd82051a764 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -1,9 +1,35 @@ package org.osate.analysis.resource.budgets.internal.busload.model; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.osate.aadl2.Element; +import org.osate.aadl2.instance.ComponentInstance; +import org.osate.aadl2.instance.ConnectionInstance; +import org.osate.aadl2.instance.ConnectionInstanceEnd; +import org.osate.aadl2.instance.FeatureInstance; import org.osate.aadl2.instance.SystemInstance; import org.osate.aadl2.instance.SystemOperationMode; +import org.osate.aadl2.modelsupport.modeltraversal.ForAllElement; +import org.osate.aadl2.util.Aadl2Util; +import org.osate.xtext.aadl2.properties.util.GetProperties; public class PowerRequirementModel extends ModelElement { + private String sectionName = new String(); + private String powerComponentHeader = new String(); + + private double capacity = 0; + private double budgetTotal = 0; + private double supplyTotal = 0; + + private final List rootFeatures = new ArrayList<>(); + private final List rootConnectionEnds = new ArrayList<>(); + + private final Map features = new HashMap<>(); + private final Map connectionEnds = new HashMap<>(); + /** * Use {@link #buildModel(SystemInstance, SystemOperationMode)} to get an instance of the * model. @@ -14,17 +40,131 @@ private PowerRequirementModel() { @Override void visitSelfPrefix(final Visitor visitor) { - // visitor.visitModelPrefix(this); + visitor.visitModelPrefix(this); } @Override void visitChildren(final Visitor visitor) { - // visit(rootBuses, visitor); + visit(rootFeatures, visitor); + visit(rootConnectionEnds, visitor); } @Override void visitSelfPostfix(final Visitor visitor) { - // visitor.visitModelPostfix(this); + visitor.visitModelPostfix(this); + } + + public static PowerRequirementModel buildModel(final SystemInstance root, final SystemOperationMode som) { + final PowerRequirementModel model = new PowerRequirementModel(); + + final String somName = Aadl2Util.getPrintableSOMName(som); + String systemName = root.getComponentClassifier().getName(); + model.sectionName = systemName + somName; + + final ForAllElement mal = new ForAllElement() { + @Override + protected void process(final Element obj) { + final ComponentInstance ci = (ComponentInstance) obj; + + model.capacity = GetProperties.getPowerCapacity(ci, 0.0); + if (model.capacity == 0) { + return; + } + + model.powerComponentHeader = "Computing Electrical Power for " + ci.getName(); + + for (FeatureInstance fi : ci.getFeatureInstances()) { + double supply = GetProperties.getPowerBudget(fi, 0.0); + if ((supply > 0) && (!fi.getDstConnectionInstances().isEmpty() + || !fi.getSrcConnectionInstances().isEmpty())) { + addFeature(model, fi, som, 0, supply); + } + + 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) { + addConnectionEnd(model, srcfi, som, 0, 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) { + addConnectionEnd(model, dstfi, som, budget, 0); + } + } + } + // power supply and budget based on access connections to this bus + // we are checking whether there are connections with the component with power capacity as source or destination + // 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) { + addFeature(model, dstfi, som, budget, 0); + } + double supply = GetProperties.getPowerSupply(dstfi, 0.0); + if (supply > 0) { + addFeature(model, dstfi, som, 0, 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) { + addFeature(model, srcfi, som, budget, 0); + } + double supply = GetProperties.getPowerSupply(srcfi, 0.0); + if (supply > 0) { + addFeature(model, srcfi, som, 0, supply); + } + } + } + }; + mal.processPreOrderComponentInstance(root); + return model; + } + + void addFeature(final Feature feature) { + rootFeatures.add(feature); + } + + private static void addFeature(final PowerRequirementModel model, final FeatureInstance feature, + final SystemOperationMode som, double budget, double supply) { + final Feature theFeature = model.getFeature(feature, budget, supply); + model.addFeature(theFeature); + } + + private Feature getFeature(final FeatureInstance fi, double budget, double supply) { + Feature feature = features.get(fi); + if (feature == null) { + feature = new Feature(fi, budget, supply); + features.put(fi, feature); + } + return feature; + } + + void addConnection(final ConnectionEnd connectionEnd) { + rootConnectionEnds.add(connectionEnd); } + private static void addConnectionEnd(final PowerRequirementModel model, final ConnectionInstanceEnd connEnd, + final SystemOperationMode som, double budget, double supply) { + final ConnectionEnd theConnEnd = model.getConnectionEnd(connEnd, budget, supply); + model.addConnection(theConnEnd); + } + + private ConnectionEnd getConnectionEnd(final ConnectionInstanceEnd cie, double budget, double supply) { + ConnectionEnd connEnd = connectionEnds.get(cie); + if (connEnd == null) { + connEnd = new ConnectionEnd(cie, budget, supply); + connectionEnds.put(cie, connEnd); + } + return connEnd; + } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java new file mode 100644 index 00000000000..91f51f4f78f --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java @@ -0,0 +1,73 @@ +/** + * 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.internal.busload.model; + +/** + * @since 3.0 + */ +public interface Visitor { + public default void visitModelPrefix(BusLoadModel model) { + } + + public default void visitModelPrefix(PowerRequirementModel model) { + } + + public default void visitModelPostfix(BusLoadModel model) { + } + + public default void visitModelPostfix(PowerRequirementModel model) { + } + + public default void visitBusOrVirtualBusPrefix(BusOrVirtualBus bus) { + } + + public default void visitBusOrVirtualBusPostfix(BusOrVirtualBus bus) { + } + + public default void visitBusPrefix(final Bus bus) { + visitBusOrVirtualBusPrefix(bus); + } + + public default void visitBusPostfix(final Bus bus) { + visitBusOrVirtualBusPostfix(bus); + } + + public default void visitVirtualBusPrefix(final VirtualBus virtualBus) { + visitBusOrVirtualBusPrefix(virtualBus); + } + + public default void visitVirtualBusPostfix(final VirtualBus virtualBus) { + visitBusOrVirtualBusPostfix(virtualBus); + } + + public default void visitBroadcastPrefix(final Broadcast broadcast) { + } + + public default void visitBroadcastPostfix(final Broadcast broadcast) { + } + + // N.B. Leaf node + public default void visitConnection(Connection connection) { + } +} From 06e43e84594e1c05e4e9de96e35c5e10b41a0f3a Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Thu, 10 Dec 2020 16:52:21 -0500 Subject: [PATCH 06/23] Add in a visitor to build up results --- .../internal/busload/model/ConnectionEnd.java | 17 ++- .../internal/busload/model/Feature.java | 12 +- .../busload/model/PowerRequirementModel.java | 31 ++++- .../internal/busload/model/Visitor.java | 16 +++ .../power/PowerRequirementAnalysis.java | 130 ++++++++++++++++-- 5 files changed, 176 insertions(+), 30 deletions(-) diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java index 876ee261cff..dbeb5751aae 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java @@ -20,17 +20,22 @@ public final ConnectionInstanceEnd getConnectionInstanceEnd() { } @Override - void visitChildren(final Visitor visitor) { - // no children + void visitSelfPrefix(final Visitor visitor) { + visitor.visitConnectionEndPrefix(this); } @Override - void visitSelfPrefix(final Visitor visitor) { - // visitor.visitConnectionEnd(this); + void visitSelfPostfix(final Visitor visitor) { + visitor.visitConnectionEndPostfix(this); + } + + public final double getSupply() { + return supply; } @Override - void visitSelfPostfix(final Visitor visitor) { - // leaf node, already visited with prefix + void visitChildren(Visitor visitor) { + // TODO Auto-generated method stub + } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java index cf4447e815f..8b161e531e8 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java @@ -20,18 +20,20 @@ public final FeatureInstance getFeatureInstance() { @Override void visitSelfPrefix(Visitor visitor) { - // TODO Auto-generated method stub - + visitor.visitFeaturePrefix(this); } @Override - void visitChildren(Visitor visitor) { - // TODO Auto-generated method stub + void visitSelfPostfix(Visitor visitor) { + visitor.visitFeaturePostfix(this); + } + public final double getSupply() { + return supply; } @Override - void visitSelfPostfix(Visitor visitor) { + void visitChildren(Visitor visitor) { // TODO Auto-generated method stub } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java index cd82051a764..b93c051a68a 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -66,9 +66,13 @@ public static PowerRequirementModel buildModel(final SystemInstance root, final protected void process(final Element obj) { final ComponentInstance ci = (ComponentInstance) obj; - model.capacity = GetProperties.getPowerCapacity(ci, 0.0); - if (model.capacity == 0) { - return; + try { + model.capacity = GetProperties.getPowerCapacity(ci, 0.0); + if (model.capacity == 0) { + return; + } + } catch (Exception e) { + return; // figure out why it started crashing on get power capacity } model.powerComponentHeader = "Computing Electrical Power for " + ci.getName(); @@ -78,6 +82,7 @@ protected void process(final Element obj) { if ((supply > 0) && (!fi.getDstConnectionInstances().isEmpty() || !fi.getSrcConnectionInstances().isEmpty())) { addFeature(model, fi, som, 0, supply); + model.supplyTotal += supply; } for (ConnectionInstance inconni : fi.getDstConnectionInstances()) { @@ -86,6 +91,7 @@ protected void process(final Element obj) { supply = GetProperties.getPowerSupply(srcfi, 0.0); if (supply > 0) { addConnectionEnd(model, srcfi, som, 0, supply); + model.supplyTotal += supply; } } for (ConnectionInstance outconni : fi.getSrcConnectionInstances()) { @@ -94,6 +100,7 @@ protected void process(final Element obj) { double budget = GetProperties.getPowerBudget(dstfi, 0.0); if (budget > 0) { addConnectionEnd(model, dstfi, som, budget, 0); + model.budgetTotal += budget; } } } @@ -106,10 +113,12 @@ protected void process(final Element obj) { double budget = GetProperties.getPowerBudget(dstfi, 0.0); if (budget > 0) { addFeature(model, dstfi, som, budget, 0); + model.budgetTotal += budget; } double supply = GetProperties.getPowerSupply(dstfi, 0.0); if (supply > 0) { addFeature(model, dstfi, som, 0, supply); + model.supplyTotal += supply; } } for (ConnectionInstance ac : ci.getDstConnectionInstances()) { @@ -118,10 +127,12 @@ protected void process(final Element obj) { double budget = GetProperties.getPowerBudget(srcfi, 0.0); if (budget > 0) { addFeature(model, srcfi, som, budget, 0); + model.budgetTotal += budget; } double supply = GetProperties.getPowerSupply(srcfi, 0.0); if (supply > 0) { addFeature(model, srcfi, som, 0, supply); + model.supplyTotal += supply; } } } @@ -167,4 +178,16 @@ private ConnectionEnd getConnectionEnd(final ConnectionInstanceEnd cie, double b } return connEnd; } -} + + public double getCapacity() { + return this.capacity; + } + + public double getTotalBudget() { + return this.budgetTotal; + } + + public double getTotalSupply() { + return this.supplyTotal; + } +} \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java index 91f51f4f78f..3b812d06c1b 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java @@ -70,4 +70,20 @@ public default void visitBroadcastPostfix(final Broadcast broadcast) { // N.B. Leaf node public default void visitConnection(Connection connection) { } + + public default void visitConnectionEndPrefix(ConnectionEnd connEnd) { + visitConnectionEndPrefix(connEnd); + } + + public default void visitConnectionEndPostfix(ConnectionEnd connEnd) { + visitConnectionEndPostfix(connEnd); + } + + public default void visitFeaturePrefix(Feature feature) { + visitFeaturePrefix(feature); + } + + public default void visitFeaturePostfix(Feature feature) { + visitFeaturePostfix(feature); + } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index 3064832aa67..476f29b76f3 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -1,6 +1,8 @@ package org.osate.analysis.resource.budgets.power; import java.util.ArrayList; +import java.util.Deque; +import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; @@ -23,6 +25,10 @@ import org.osate.analysis.flows.reporting.model.Report; import org.osate.analysis.flows.reporting.model.Report.ReportType; import org.osate.analysis.flows.reporting.model.Section; +import org.osate.analysis.resource.budgets.internal.busload.model.ConnectionEnd; +import org.osate.analysis.resource.budgets.internal.busload.model.Feature; +import org.osate.analysis.resource.budgets.internal.busload.model.PowerRequirementModel; +import org.osate.analysis.resource.budgets.internal.busload.model.Visitor; import org.osate.result.AnalysisResult; import org.osate.result.Result; import org.osate.result.ResultType; @@ -117,10 +123,12 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element chosenSOM, ResultType.SUCCESS); analysisResult.getResults().add(somResult); - // final BusLoadModel model = BusLoadModel.buildModel(root, som); + final PowerRequirementModel model = PowerRequirementModel.buildModel(root, chosenSOM); + // i can get totals from everything in the model // Analyze the model - // model.visit(new PowerAnalysisVisitor(somResult)); + model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), + model.getTotalBudget(), model.getTotalSupply())); } else { final SOMIterator soms = new SOMIterator(si); while (soms.hasNext()) { @@ -131,10 +139,11 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element ResultType.SUCCESS); analysisResult.getResults().add(somResult); - // final BusLoadModel model = BusLoadModel.buildModel(root, som); + final PowerRequirementModel model = PowerRequirementModel.buildModel(root, som); // Analyze the model - // model.visit(new PowerAnalysisVisitor(somResult)); + model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), + model.getTotalBudget(), model.getTotalSupply())); } } } @@ -197,7 +206,7 @@ protected void action(Element aobj) { // there must be a connection on this feature if (!fi.getDstConnectionInstances().isEmpty() || !fi.getSrcConnectionInstances().isEmpty()) { supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(supply) + " from " + + PowerRequirementAnalysis.toString(supply) + " from " + fi.getContainingComponentInstance().getName(); supplyTotal += supply; } else { @@ -210,7 +219,7 @@ protected void action(Element aobj) { supply = GetProperties.getPowerSupply(srcfi, 0.0); if (supply > 0) { supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(supply) + " from " + + PowerRequirementAnalysis.toString(supply) + " from " + srcfi.getContainingComponentInstance().getName(); supplyTotal += supply; } @@ -221,7 +230,7 @@ protected void action(Element aobj) { double budget = GetProperties.getPowerBudget(dstfi, 0.0); if (budget > 0) { budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(budget) + " for " + + PowerRequirementAnalysis.toString(budget) + " for " + dstfi.getContainingComponentInstance().getName(); budgetTotal += budget; } @@ -236,14 +245,14 @@ protected void action(Element aobj) { double budget = GetProperties.getPowerBudget(dstfi, 0.0); if (budget > 0) { budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(budget) + " for " + + PowerRequirementAnalysis.toString(budget) + " for " + dstfi.getContainingComponentInstance().getName(); budgetTotal += budget; } double supply = GetProperties.getPowerSupply(dstfi, 0.0); if (supply > 0) { supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(supply) + " from " + + PowerRequirementAnalysis.toString(supply) + " from " + dstfi.getContainingComponentInstance().getName(); supplyTotal += supply; } @@ -254,14 +263,14 @@ protected void action(Element aobj) { double budget = GetProperties.getPowerBudget(srcfi, 0.0); if (budget > 0) { budgetLine = budgetLine + (budgetLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(budget) + " for " + + PowerRequirementAnalysis.toString(budget) + " for " + srcfi.getContainingComponentInstance().getName(); budgetTotal += budget; } double supply = GetProperties.getPowerSupply(srcfi, 0.0); if (supply > 0) { supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.this.toString(supply) + " from " + + PowerRequirementAnalysis.toString(supply) + " from " + srcfi.getContainingComponentInstance().getName(); supplyTotal += supply; } @@ -279,10 +288,6 @@ private void powerComponentHeader(Section s, String header) { s.addLine(line); } - private String toString(double value) { - return value > 2000.0 ? value / 1000 + " W" : value + " mW"; - } - private void report(Section section, ComponentInstance ci, String somName, String resourceName, double capacity, double budget, double supply, String budgetDetail, String supplyDetails, AnalysisErrorReporterManager errManager) { @@ -347,4 +352,99 @@ private void powerComponentError(Section s, String msg) { line.addError(msg); s.addLine(line); } + + // ==== Analysis Visitor ==== + + private class PowerRequirementAnalysisVisitor implements Visitor { + private Deque previousResult = new LinkedList<>(); + private Result currentResult; + + private final double capacity, tBudget, tSupply; + + public PowerRequirementAnalysisVisitor(final Result rootResult, double capacity, double budget, double supply) { + this.currentResult = rootResult; + this.capacity = capacity; + this.tBudget = budget; + this.tSupply = supply; + } + + @Override + public void visitConnectionEndPrefix(final ConnectionEnd connEnd) { + final ConnectionInstanceEnd connInstanceEnd = connEnd.getConnectionInstanceEnd(); + + // Create a new result object for the connection end + final Result connEndResult = ResultUtil.createResult(connInstanceEnd.getName(), connInstanceEnd, + ResultType.SUCCESS); + currentResult.getSubResults().add(connEndResult); + previousResult.push(currentResult); + currentResult = connEndResult; + } + + @Override + public void visitConnectionEndPostfix(final ConnectionEnd connEnd) { + // unroll the result stack + final Result connEndResult = currentResult; + currentResult = previousResult.pop(); + + double budget = connEnd.getBudget(); + double supply = connEnd.getSupply(); + + ResultUtil.addRealValue(connEndResult, budget); + ResultUtil.addRealValue(connEndResult, supply); + + ResultUtil.addStringValue(connEndResult, + "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + + connEnd.getConnectionInstanceEnd().getName() + " out of total " + + PowerRequirementAnalysis.toString(tBudget)); + + ResultUtil.addStringValue(connEndResult, + "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + + connEnd.getConnectionInstanceEnd().getName() + " out of total " + + PowerRequirementAnalysis.toString(tSupply)); + + ResultUtil.addStringValue(connEndResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); + } + + @Override + public void visitFeaturePrefix(final Feature feature) { + final FeatureInstance featureInstance = feature.getFeatureInstance(); + + // Create a new result object for the connection end + final Result featureResult = ResultUtil.createResult(featureInstance.getName(), featureInstance, + ResultType.SUCCESS); + currentResult.getSubResults().add(featureResult); + previousResult.push(currentResult); + currentResult = featureResult; + } + + @Override + public void visitFeaturePostfix(final Feature feature) { + // unroll the result stack + final Result connEndResult = currentResult; + currentResult = previousResult.pop(); + + double budget = feature.getBudget(); + double supply = feature.getSupply(); + + ResultUtil.addRealValue(connEndResult, budget); + ResultUtil.addRealValue(connEndResult, supply); + + ResultUtil.addStringValue(connEndResult, + "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + + feature.getFeatureInstance().getName() + " out of total " + + PowerRequirementAnalysis.toString(budgetTotal)); + + ResultUtil.addStringValue(connEndResult, + "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + + feature.getFeatureInstance().getName() + " out of total " + + PowerRequirementAnalysis.toString(supplyTotal)); + + ResultUtil.addStringValue(connEndResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); + } + + } + + private static String toString(double value) { + return value > 2000.0 ? value / 1000 + " W" : value + " mW"; + } } \ No newline at end of file From f2d689c535d025fd80b1ebe0f8bc856e91f8d960 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Fri, 11 Dec 2020 11:12:30 -0500 Subject: [PATCH 07/23] changing how the visitor is called --- .../busload/model/PowerRequirementModel.java | 21 +++++++++---------- .../internal/busload/model/Visitor.java | 1 + .../power/PowerRequirementAnalysis.java | 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java index b93c051a68a..fb71248eab6 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -40,18 +40,19 @@ private PowerRequirementModel() { @Override void visitSelfPrefix(final Visitor visitor) { - visitor.visitModelPrefix(this); + rootFeatures.forEach(e -> visitor.visitFeaturePrefix(e)); + rootConnectionEnds.forEach(e -> visitor.visitConnectionEndPrefix(e)); } @Override void visitChildren(final Visitor visitor) { - visit(rootFeatures, visitor); - visit(rootConnectionEnds, visitor); + // no children } @Override void visitSelfPostfix(final Visitor visitor) { - visitor.visitModelPostfix(this); + rootFeatures.forEach(e -> visitor.visitFeaturePostfix(e)); + rootConnectionEnds.forEach(e -> visitor.visitConnectionEndPostfix(e)); } public static PowerRequirementModel buildModel(final SystemInstance root, final SystemOperationMode som) { @@ -61,18 +62,16 @@ public static PowerRequirementModel buildModel(final SystemInstance root, final String systemName = root.getComponentClassifier().getName(); model.sectionName = systemName + somName; + + final ForAllElement mal = new ForAllElement() { @Override protected void process(final Element obj) { final ComponentInstance ci = (ComponentInstance) obj; - try { - model.capacity = GetProperties.getPowerCapacity(ci, 0.0); - if (model.capacity == 0) { - return; - } - } catch (Exception e) { - return; // figure out why it started crashing on get power capacity + model.capacity = GetProperties.getPowerCapacity(ci, 0.0); + if (model.capacity == 0) { + return; } model.powerComponentHeader = "Computing Electrical Power for " + ci.getName(); diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java index 3b812d06c1b..24fcf094d3f 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Visitor.java @@ -31,6 +31,7 @@ public default void visitModelPrefix(BusLoadModel model) { } public default void visitModelPrefix(PowerRequirementModel model) { + } public default void visitModelPostfix(BusLoadModel model) { diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index 476f29b76f3..d82a21d3afe 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -68,6 +68,7 @@ public AnalysisResult invoke(final IProgressMonitor monitor, final SystemInstanc private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element obj) { if (obj instanceof InstanceObject) { final SystemInstance root = ((InstanceObject) obj).getSystemInstance(); + final AnalysisResult analysisResult = ResultUtil.createAnalysisResult("Power Requirements", root); analysisResult.setResultType(ResultType.SUCCESS); analysisResult.setMessage("Power requirements analysis of " + root.getFullName()); From ecdd602d64c1082272f646ee22810e2e2a552b3e Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Fri, 11 Dec 2020 15:32:46 -0500 Subject: [PATCH 08/23] add system and som name to results --- .../busload/model/PowerRequirementModel.java | 11 ++++--- .../power/PowerRequirementAnalysis.java | 33 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java index fb71248eab6..22d1079063f 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -17,7 +17,7 @@ import org.osate.xtext.aadl2.properties.util.GetProperties; public class PowerRequirementModel extends ModelElement { - private String sectionName = new String(); + private String systemSOMname = new String(); private String powerComponentHeader = new String(); private double capacity = 0; @@ -60,9 +60,7 @@ public static PowerRequirementModel buildModel(final SystemInstance root, final final String somName = Aadl2Util.getPrintableSOMName(som); String systemName = root.getComponentClassifier().getName(); - model.sectionName = systemName + somName; - - + model.systemSOMname = systemName + " " + somName; final ForAllElement mal = new ForAllElement() { @Override @@ -70,6 +68,7 @@ protected void process(final Element obj) { final ComponentInstance ci = (ComponentInstance) obj; model.capacity = GetProperties.getPowerCapacity(ci, 0.0); + if (model.capacity == 0) { return; } @@ -189,4 +188,8 @@ public double getTotalBudget() { public double getTotalSupply() { return this.supplyTotal; } + + public String getsystemSOMname() { + return this.systemSOMname; + } } \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index d82a21d3afe..d0c75bc326f 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -129,7 +129,7 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element // Analyze the model model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), - model.getTotalBudget(), model.getTotalSupply())); + model.getTotalBudget(), model.getTotalSupply(), model.getsystemSOMname())); } else { final SOMIterator soms = new SOMIterator(si); while (soms.hasNext()) { @@ -144,7 +144,7 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element // Analyze the model model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), - model.getTotalBudget(), model.getTotalSupply())); + model.getTotalBudget(), model.getTotalSupply(), model.getsystemSOMname())); } } } @@ -361,12 +361,15 @@ private class PowerRequirementAnalysisVisitor implements Visitor { private Result currentResult; private final double capacity, tBudget, tSupply; + private final String systemSOMname; - public PowerRequirementAnalysisVisitor(final Result rootResult, double capacity, double budget, double supply) { + public PowerRequirementAnalysisVisitor(final Result rootResult, double capacity, double budget, double supply, + String systemSOMname) { this.currentResult = rootResult; this.capacity = capacity; this.tBudget = budget; this.tSupply = supply; + this.systemSOMname = systemSOMname; } @Override @@ -393,14 +396,17 @@ public void visitConnectionEndPostfix(final ConnectionEnd connEnd) { ResultUtil.addRealValue(connEndResult, budget); ResultUtil.addRealValue(connEndResult, supply); + ResultUtil.addStringValue(connEndResult, "System name " + this.systemSOMname); ResultUtil.addStringValue(connEndResult, "Budget " + PowerRequirementAnalysis.toString(budget) + " for " - + connEnd.getConnectionInstanceEnd().getName() + " out of total " + + connEnd.getConnectionInstanceEnd().getContainingComponentInstance().getName() + + " out of total " + PowerRequirementAnalysis.toString(tBudget)); ResultUtil.addStringValue(connEndResult, "Supply " + PowerRequirementAnalysis.toString(supply) + " from " - + connEnd.getConnectionInstanceEnd().getName() + " out of total " + + connEnd.getConnectionInstanceEnd().getContainingComponentInstance().getName() + + " out of total " + PowerRequirementAnalysis.toString(tSupply)); ResultUtil.addStringValue(connEndResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); @@ -421,26 +427,27 @@ public void visitFeaturePrefix(final Feature feature) { @Override public void visitFeaturePostfix(final Feature feature) { // unroll the result stack - final Result connEndResult = currentResult; + final Result featureResult = currentResult; currentResult = previousResult.pop(); double budget = feature.getBudget(); double supply = feature.getSupply(); - ResultUtil.addRealValue(connEndResult, budget); - ResultUtil.addRealValue(connEndResult, supply); + ResultUtil.addRealValue(featureResult, budget); + ResultUtil.addRealValue(featureResult, supply); - ResultUtil.addStringValue(connEndResult, + ResultUtil.addStringValue(featureResult, "System name " + this.systemSOMname); + ResultUtil.addStringValue(featureResult, "Budget " + PowerRequirementAnalysis.toString(budget) + " for " - + feature.getFeatureInstance().getName() + " out of total " + + feature.getFeatureInstance().getContainingComponentInstance().getName() + " out of total " + PowerRequirementAnalysis.toString(budgetTotal)); - ResultUtil.addStringValue(connEndResult, + ResultUtil.addStringValue(featureResult, "Supply " + PowerRequirementAnalysis.toString(supply) + " from " - + feature.getFeatureInstance().getName() + " out of total " + + feature.getFeatureInstance().getContainingComponentInstance().getName() + " out of total " + PowerRequirementAnalysis.toString(supplyTotal)); - ResultUtil.addStringValue(connEndResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); + ResultUtil.addStringValue(featureResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); } } From 13fbf0c29a88af883f80550ade662829e8d6512d Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Mon, 14 Dec 2020 08:51:17 -0500 Subject: [PATCH 09/23] finish up analysisResult object and add an excel report for Power Analysis --- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- alisa/org.osate.assure/META-INF/MANIFEST.MF | 2 +- alisa/org.osate.verify/META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../handlers/NewAbstractAaxlHandler.java | 151 +---------------- .../handlers/NewBusLoadAnalysisHandler.java | 156 ++++++++++++++++- .../handlers/NewPowerAnalysisHandler.java | 135 ++++++++++++++- .../internal/busload/model/ConnectionEnd.java | 34 +++- .../internal/busload/model/Feature.java | 35 +++- .../busload/model/PowerRequirementModel.java | 49 +++++- .../power/PowerRequirementAnalysis.java | 159 +++++++++++------- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- 16 files changed, 504 insertions(+), 233 deletions(-) diff --git a/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF index b96a4037643..f4ebb932a58 100644 --- a/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF @@ -24,7 +24,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.19.0,2.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)" Import-Package: org.apache.log4j;version="[1.2.0,2.0.0)" diff --git a/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF index f857cbc05a7..6d6f44404d8 100644 --- a/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.0.5.qualifier Export-Package: alisa_consistency Require-Bundle: org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)", org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)" + org.osate.results;bundle-version="[2.1.0,3.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.osate.alisa.contribution Bundle-Vendor: CMU/SEI diff --git a/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF index 10611be3372..857da51326a 100644 --- a/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF @@ -26,7 +26,7 @@ Require-Bundle: org.osate.alisa.workbench;bundle-version="[3.0.0,4.0.0)";visibil org.osate.verify;bundle-version="[4.0.0,5.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.osate.categories;bundle-version="[3.0.0,4.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)", org.eclipse.xtend.lib;bundle-version="[2.20.0,3.0.0)";resolution:=optional Import-Package: org.apache.commons.lang;version="[2.6.0,3.0.0)", diff --git a/alisa/org.osate.assure/META-INF/MANIFEST.MF b/alisa/org.osate.assure/META-INF/MANIFEST.MF index ac152d7a8fe..cdadeb1ff70 100644 --- a/alisa/org.osate.assure/META-INF/MANIFEST.MF +++ b/alisa/org.osate.assure/META-INF/MANIFEST.MF @@ -39,7 +39,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.osate.aadl2.instantiation;bundle-version="[1.1.0,2.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.8.1,2.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.osate.xtext.aadl2;bundle-version="[6.0.0,7.0.0)", org.osate.organization;bundle-version="[3.0.0,4.0.0)", org.osate.annexsupport;bundle-version="[3.2.0,4.0.0)" diff --git a/alisa/org.osate.verify/META-INF/MANIFEST.MF b/alisa/org.osate.verify/META-INF/MANIFEST.MF index 5b8b0cd4221..f9c71b4119c 100644 --- a/alisa/org.osate.verify/META-INF/MANIFEST.MF +++ b/alisa/org.osate.verify/META-INF/MANIFEST.MF @@ -32,7 +32,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.eclipse.jdt.core;bundle-version="[3.10.0,4.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.8.1,2.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.osate.organization;bundle-version="[3.0.0,4.0.0)", org.eclipse.jface;bundle-version="[3.13.2,4.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", diff --git a/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF index 17f8274e01e..e5b724a8c63 100644 --- a/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", org.osate.ui;bundle-version="[6.0.0,7.0.0)", org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.0.0)", org.osate.xtext.aadl2;bundle-version="[6.0.0,7.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.eclipse.ui.ide;bundle-version="[3.13.1,4.0.0)", org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)", org.eclipse.emf.transaction;bundle-version="[1.4.0,2.0.0)", diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java index 53d60ceb5e6..fd9e9ca84f5 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewAbstractAaxlHandler.java @@ -23,11 +23,9 @@ */ package org.osate.analysis.resource.budgets.handlers; -import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; -import java.io.StringWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -59,18 +57,15 @@ import org.eclipse.ui.handlers.HandlerUtil; import org.osate.aadl2.Element; import org.osate.aadl2.instance.SystemInstance; -import org.osate.aadl2.instance.SystemOperationMode; import org.osate.aadl2.modelsupport.Activator; import org.osate.aadl2.modelsupport.FileNameConstants; import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; import org.osate.aadl2.modelsupport.resources.OsateResourceUtil; -import org.osate.aadl2.util.Aadl2Util; import org.osate.analysis.resource.budgets.ResourceBudgetPlugin; import org.osate.core.AadlNature; import org.osate.result.AnalysisResult; import org.osate.result.Diagnostic; import org.osate.result.Result; -import org.osate.result.util.ResultUtil; import org.osate.ui.internal.instantiate.InstantiationEngine; /** @@ -395,11 +390,8 @@ private static void generateMarkersFromDiagnostics(final List diagno // === CSV Output methods === - public static void writeCSVFile(final AnalysisResult analysisResult, final IFile outputFile, + public static void writeCSVFile(final InputStream inputStream, final IFile outputFile, final IProgressMonitor monitor) { - final String csvContent = getCSVasString(analysisResult); - final InputStream inputStream = new ByteArrayInputStream(csvContent.getBytes()); - try { if (outputFile.exists()) { outputFile.setContents(inputStream, true, true, monitor); @@ -411,143 +403,10 @@ public static void writeCSVFile(final AnalysisResult analysisResult, final IFile } } - private static String getCSVasString(final AnalysisResult analysisResult) { - final StringWriter writer = new StringWriter(); - final PrintWriter pw = new PrintWriter(writer); - generateCSVforAnalysis(pw, analysisResult); - pw.close(); - return writer.toString(); - } - - private static void generateCSVforAnalysis(final PrintWriter pw, final AnalysisResult analysisResult) { - pw.println(analysisResult.getMessage()); - pw.println(); - pw.println(); - analysisResult.getResults().forEach(somResult -> generateCSVforSOM(pw, somResult)); - } - - private static void generateCSVforSOM(final PrintWriter pw, final Result somResult) { - if (Aadl2Util.isPrintableSOMName((SystemOperationMode) somResult.getModelElement())) { - printItem(pw, "Analysis results in modes " + somResult.getMessage()); - pw.println(); - } - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Physical Bus", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", "Actual (KB/s)"); - - for (final Result subResult : somResult.getSubResults()) { - // Label, Capacity, Budget, Required Capacity, Actual - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1)), - Double.toString(ResultUtil.getReal(subResult, 2)), - Double.toString(ResultUtil.getReal(subResult, 3))); - } - pw.println(); - - // NO DIAGNOSTICS AT THE SOM LEVEL - - somResult.getSubResults().forEach(busResult -> generateCSVforBus(pw, busResult, null)); - pw.println(); // add a second newline, the first is from the end of generateCSVforBus() - } - - private static void generateCSVforBus(final PrintWriter pw, final Result busResult, final Result boundTo) { - final long dataOverhead = ResultUtil.getInteger(busResult, 7); - if (boundTo == null) { - printItem(pw, "Bus " + busResult.getMessage() + " has data overhead of " + dataOverhead + " bytes"); - } else { - printItem(pw, "Virtual bus " + busResult.getMessage() + " bound to " + boundTo.getMessage() - + " has data overhead of " + dataOverhead + " bytes"); - } - pw.println(); - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Bound Virtual Bus/Connection", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", - "Actual (KB/s)"); - - final int numBus = (int) ResultUtil.getInteger(busResult, 4); - final int numConnections = (int) ResultUtil.getInteger(busResult, 5); - final List subResults = busResult.getSubResults(); - for (final Result subResult : subResults.subList(0, numBus)) { - // Label, Capacity, Budget, Required Capacity, Actual - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1)), - Double.toString(ResultUtil.getReal(subResult, 2)), - Double.toString(ResultUtil.getReal(subResult, 3))); - } - for (final Result subResult : subResults.subList(numBus, subResults.size())) { - // Label, NO CAPACITY, Budget, NO REQUIRED CAPACITY, Actual - // Capacity, NO BUDGET, Required - printItems(pw, subResult.getMessage(), "", Double.toString(ResultUtil.getReal(subResult, 0)), "", - Double.toString(ResultUtil.getReal(subResult, 1))); - } - pw.println(); - - if (!busResult.getDiagnostics().isEmpty()) { - generateCSVforDiagnostics(pw, busResult.getDiagnostics()); - pw.println(); - } - - subResults.subList(0, numBus).forEach(br -> generateCSVforBus(pw, br, busResult)); - subResults.subList(numBus, numBus + numConnections).forEach(br -> generateCSVforConnection(pw, br, busResult)); - subResults.subList(numBus + numConnections, subResults.size()) - .forEach(br -> generateCSVforBroadcast(pw, br, busResult)); - } - - private static void generateCSVforBroadcast(final PrintWriter pw, final Result broadcastResult, - final Result boundTo) { - printItem(pw, broadcastResult.getMessage() + " over bus " + boundTo.getMessage()); - pw.println(); - - /* - * Go through the children twice: First to print summary information and then to recursively - * print the sub information. - */ - - printItems(pw, "Included Connection", "Budget (KB/s)", "Actual (KB/s)"); - - final List subResults = broadcastResult.getSubResults(); - for (final Result subResult : subResults) { - printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), - Double.toString(ResultUtil.getReal(subResult, 1))); - } - pw.println(); - - if (!broadcastResult.getDiagnostics().isEmpty()) { - generateCSVforDiagnostics(pw, broadcastResult.getDiagnostics()); - pw.println(); - } - - subResults.forEach(br -> generateCSVforConnection(pw, br, broadcastResult)); - } - - private static void generateCSVforConnection(final PrintWriter pw, final Result connectionResult, - final Result boundTo) { - // only do something if there are diagnostics - if (!connectionResult.getDiagnostics().isEmpty()) { - printItem(pw, "Connection " + connectionResult.getMessage() + " bound to " + boundTo.getMessage()); - generateCSVforDiagnostics(pw, connectionResult.getDiagnostics()); - pw.println(); - } - } - - private static void generateCSVforDiagnostics(final PrintWriter pw, final List diagnostics) { - for (final Diagnostic issue : diagnostics) { - printItem(pw, issue.getDiagnosticType().getName() + ": " + issue.getMessage()); - pw.println(); - } - } - // ==== Low-level CSV format, this should be abstracted somewhere - private static void printItems(final PrintWriter pw, final String item1, final String... items) { + + public static void printItems(final PrintWriter pw, final String item1, final String... items) { printItem(pw, item1); for (final String nextItem : items) { printSeparator(pw); @@ -556,14 +415,14 @@ private static void printItems(final PrintWriter pw, final String item1, final S pw.println(); } - private static void printItem(final PrintWriter pw, final String item) { + public static void printItem(final PrintWriter pw, final String item) { // TODO: Doesn't handle quotes in the item! pw.print('"'); pw.print(item); pw.print('"'); } - private static void printSeparator(final PrintWriter pw) { + public static void printSeparator(final PrintWriter pw) { pw.print(","); } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java index 6d6d19d51cf..7e27c529a12 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewBusLoadAnalysisHandler.java @@ -23,6 +23,12 @@ */ package org.osate.analysis.resource.budgets.handlers; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.List; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.WorkspaceJob; import org.eclipse.core.runtime.CoreException; @@ -33,11 +39,16 @@ import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.Job; import org.osate.aadl2.instance.SystemInstance; +import org.osate.aadl2.instance.SystemOperationMode; import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; import org.osate.aadl2.modelsupport.errorreporting.MarkerAnalysisErrorReporter; import org.osate.aadl2.modelsupport.util.AadlUtil; +import org.osate.aadl2.util.Aadl2Util; import org.osate.analysis.resource.budgets.busload.NewBusLoadAnalysis; import org.osate.result.AnalysisResult; +import org.osate.result.Diagnostic; +import org.osate.result.Result; +import org.osate.result.util.ResultUtil; /** * @since 3.0 @@ -92,7 +103,10 @@ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreExcepti } generateMarkers(analysisResult, errManager); subMonitor.worked(1); - writeCSVFile(analysisResult, outputFile, subMonitor.split(1)); + + final String csvContent = getCSVasString(analysisResult); + final InputStream inputStream = new ByteArrayInputStream(csvContent.getBytes()); + writeCSVFile(inputStream, outputFile, subMonitor.split(1)); } catch (final OperationCanceledException e) { cancelled = true; } @@ -111,4 +125,144 @@ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreExcepti * * this is moved to NewAbstractAaxlHandler.java */ + + private static String getCSVasString(final AnalysisResult analysisResult) { + final StringWriter writer = new StringWriter(); + final PrintWriter pw = new PrintWriter(writer); + generateCSVforAnalysis(pw, analysisResult); + pw.close(); + return writer.toString(); + } + + /** + * @since 4.1 + */ + public static void generateCSVforAnalysis(final PrintWriter pw, final AnalysisResult analysisResult) { + pw.println(analysisResult.getMessage()); + pw.println(); + pw.println(); + analysisResult.getResults().forEach(somResult -> generateCSVforSOM(pw, somResult)); + } + + /** + * @since 4.1 + */ + public static void generateCSVforSOM(final PrintWriter pw, final Result somResult) { + if (Aadl2Util.isPrintableSOMName((SystemOperationMode) somResult.getModelElement())) { + printItem(pw, "Analysis results in modes " + somResult.getMessage()); + pw.println(); + } + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Physical Bus", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", "Actual (KB/s)"); + + for (final Result subResult : somResult.getSubResults()) { + // Label, Capacity, Budget, Required Capacity, Actual + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1)), + Double.toString(ResultUtil.getReal(subResult, 2)), + Double.toString(ResultUtil.getReal(subResult, 3))); + } + pw.println(); + + // NO DIAGNOSTICS AT THE SOM LEVEL + + somResult.getSubResults().forEach(busResult -> generateCSVforBus(pw, busResult, null)); + pw.println(); // add a second newline, the first is from the end of generateCSVforBus() + } + + private static void generateCSVforBus(final PrintWriter pw, final Result busResult, final Result boundTo) { + final long dataOverhead = ResultUtil.getInteger(busResult, 7); + if (boundTo == null) { + printItem(pw, "Bus " + busResult.getMessage() + " has data overhead of " + dataOverhead + " bytes"); + } else { + printItem(pw, "Virtual bus " + busResult.getMessage() + " bound to " + boundTo.getMessage() + + " has data overhead of " + dataOverhead + " bytes"); + } + pw.println(); + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Bound Virtual Bus/Connection", "Capacity (KB/s)", "Budget (KB/s)", "Required Budget (KB/s)", + "Actual (KB/s)"); + + final int numBus = (int) ResultUtil.getInteger(busResult, 4); + final int numConnections = (int) ResultUtil.getInteger(busResult, 5); + final List subResults = busResult.getSubResults(); + for (final Result subResult : subResults.subList(0, numBus)) { + // Label, Capacity, Budget, Required Capacity, Actual + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1)), + Double.toString(ResultUtil.getReal(subResult, 2)), + Double.toString(ResultUtil.getReal(subResult, 3))); + } + for (final Result subResult : subResults.subList(numBus, subResults.size())) { + // Label, NO CAPACITY, Budget, NO REQUIRED CAPACITY, Actual + // Capacity, NO BUDGET, Required + printItems(pw, subResult.getMessage(), "", Double.toString(ResultUtil.getReal(subResult, 0)), "", + Double.toString(ResultUtil.getReal(subResult, 1))); + } + pw.println(); + + if (!busResult.getDiagnostics().isEmpty()) { + generateCSVforDiagnostics(pw, busResult.getDiagnostics()); + pw.println(); + } + + subResults.subList(0, numBus).forEach(br -> generateCSVforBus(pw, br, busResult)); + subResults.subList(numBus, numBus + numConnections).forEach(br -> generateCSVforConnection(pw, br, busResult)); + subResults.subList(numBus + numConnections, subResults.size()) + .forEach(br -> generateCSVforBroadcast(pw, br, busResult)); + } + + private static void generateCSVforBroadcast(final PrintWriter pw, final Result broadcastResult, + final Result boundTo) { + printItem(pw, broadcastResult.getMessage() + " over bus " + boundTo.getMessage()); + pw.println(); + + /* + * Go through the children twice: First to print summary information and then to recursively + * print the sub information. + */ + + printItems(pw, "Included Connection", "Budget (KB/s)", "Actual (KB/s)"); + + final List subResults = broadcastResult.getSubResults(); + for (final Result subResult : subResults) { + printItems(pw, subResult.getMessage(), Double.toString(ResultUtil.getReal(subResult, 0)), + Double.toString(ResultUtil.getReal(subResult, 1))); + } + pw.println(); + + if (!broadcastResult.getDiagnostics().isEmpty()) { + generateCSVforDiagnostics(pw, broadcastResult.getDiagnostics()); + pw.println(); + } + + subResults.forEach(br -> generateCSVforConnection(pw, br, broadcastResult)); + } + + private static void generateCSVforConnection(final PrintWriter pw, final Result connectionResult, + final Result boundTo) { + // only do something if there are diagnostics + if (!connectionResult.getDiagnostics().isEmpty()) { + printItem(pw, "Connection " + connectionResult.getMessage() + " bound to " + boundTo.getMessage()); + generateCSVforDiagnostics(pw, connectionResult.getDiagnostics()); + pw.println(); + } + } + + private static void generateCSVforDiagnostics(final PrintWriter pw, final List diagnostics) { + for (final Diagnostic issue : diagnostics) { + printItem(pw, issue.getDiagnosticType().getName() + ": " + issue.getMessage()); + pw.println(); + } + } } diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java index 1d5c323c566..a4630c19ac8 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/handlers/NewPowerAnalysisHandler.java @@ -1,5 +1,33 @@ +/** + * 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.handlers; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.WorkspaceJob; import org.eclipse.core.runtime.CoreException; @@ -15,6 +43,8 @@ import org.osate.aadl2.modelsupport.util.AadlUtil; import org.osate.analysis.resource.budgets.power.PowerRequirementAnalysis; import org.osate.result.AnalysisResult; +import org.osate.result.Result; +import org.osate.result.util.ResultUtil; /** * @since 4.1 @@ -65,14 +95,117 @@ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreExcepti } generateMarkers(analysisResult, errManager); subMonitor.worked(1); - writeCSVFile(analysisResult, outputFile, subMonitor.split(1)); + + final String csvContent = getCSVasString(analysisResult); + final InputStream inputStream = new ByteArrayInputStream(csvContent.getBytes()); + writeCSVFile(inputStream, outputFile, subMonitor.split(1)); } catch (final OperationCanceledException e) { cancelled = true; } return cancelled ? Status.CANCEL_STATUS : Status.OK_STATUS; } + } + private static String getCSVasString(final AnalysisResult analysisResult) { + final StringWriter writer = new StringWriter(); + final PrintWriter pw = new PrintWriter(writer); + generateCSVforAnalysis(pw, analysisResult); + pw.close(); + return writer.toString(); } + // generate csv report + public static void generateCSVforAnalysis(final PrintWriter pw, final AnalysisResult analysisResult) { + pw.println(analysisResult.getMessage()); + pw.println(); + + analysisResult.getResults().forEach(result -> { // section per result + if (result.getSubResults().size() > 0) { + Result subResult = result.getSubResults().get(0); + + String resourceName = ResultUtil.getString(subResult, 5); + printItem(pw, "Computing Electrical Power for " + resourceName); + pw.println(); + + double capacity = ResultUtil.getReal(subResult, 2); + printItem(pw, "Capacity: " + PowerRequirementAnalysis.toString(capacity)); + pw.println(); + + // Supply + double totalSupply = ResultUtil.getReal(subResult, 4); + printItem(pw, "Supply: " + PowerRequirementAnalysis.toString(totalSupply)); + + result.getSubResults().forEach(sResult -> { + double currentValue = ResultUtil.getReal(sResult, 1); + if (currentValue > 0) { + printSeparator(pw); + printItem(pw, PowerRequirementAnalysis.toString(currentValue) + " for " + + ResultUtil.getString(sResult, 7)); + } + }); + pw.println(); + + // Budget + double totalBudget = ResultUtil.getReal(subResult, 3); + printItem(pw, "Budget: " + PowerRequirementAnalysis.toString(totalBudget)); + + result.getSubResults().forEach(sResult -> { + double currentValue = ResultUtil.getReal(sResult, 0); + + if (currentValue > 0) { + printSeparator(pw); + printItem(pw, PowerRequirementAnalysis.toString(currentValue) + " for " + + ResultUtil.getString(sResult, 7)); + } + }); + pw.println(); + + if (capacity > 0.0 && totalBudget > 0.0) { + if (totalBudget > capacity) { + printItem(pw, + "** " + resourceName + " budget total " + PowerRequirementAnalysis.toString(totalBudget) + + " exceeds capacity " + PowerRequirementAnalysis.toString(capacity)); + pw.println(); + + // errManager.error(ci, somName + ": " + message); + // powerComponentError(section, message); + } else { + printItem(pw, resourceName + " budget total " + PowerRequirementAnalysis.toString(totalBudget) + + " within capacity " + PowerRequirementAnalysis.toString(capacity)); + pw.println(); + + // errManager.info(ci, somName + ": " + message); + // powerComponentSuccess(section, message); + } + } + + String suppliedmsg = ""; + double available = 0.0; + if (totalSupply == 0.0) { + available = capacity; + suppliedmsg = " capacity "; + } else { + available = totalSupply; + suppliedmsg = " supply "; + } + + if (totalBudget > available) { + printItem(pw, "** " + "budget total " + PowerRequirementAnalysis.toString(totalBudget) + " exceeds" + + suppliedmsg + PowerRequirementAnalysis.toString(available)); + pw.println(); + // powerComponentError(section, message); + // errManager.error(ci, somName + ": " + message); + } else { + printItem(pw, "budget total " + PowerRequirementAnalysis.toString(totalBudget) + " within" + + suppliedmsg + PowerRequirementAnalysis.toString(available)); + pw.println(); + // errManager.info(ci, somName + ": " + message); + // powerComponentSuccess(section, message); + } + + pw.println(); + } + }); + } } \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java index dbeb5751aae..6e60dbb6098 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/ConnectionEnd.java @@ -1,18 +1,44 @@ +/** + * 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.internal.busload.model; +import java.rmi.server.UID; + import org.osate.aadl2.instance.ConnectionInstanceEnd; public class ConnectionEnd extends AnalysisElement { /** The connection instance end represented. */ private final ConnectionInstanceEnd connInstanceEnd; - private final double budget; private final double supply; + private final UID id; public ConnectionEnd(final ConnectionInstanceEnd connInstanceEnd, double budget, double supply) { super("connectionEnd"); this.connInstanceEnd = connInstanceEnd; - this.budget = budget; this.supply = supply; + this.id = new UID(); + super.setBudget(budget); } public final ConnectionInstanceEnd getConnectionInstanceEnd() { @@ -33,6 +59,10 @@ public final double getSupply() { return supply; } + public final UID getID() { + return id; + } + @Override void visitChildren(Visitor visitor) { // TODO Auto-generated method stub diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java index 8b161e531e8..92dd7fa4889 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/Feature.java @@ -1,17 +1,43 @@ +/** + * 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.internal.busload.model; +import java.rmi.server.UID; + import org.osate.aadl2.instance.FeatureInstance; public class Feature extends AnalysisElement { private final FeatureInstance featureInstance; - private final double budget; private final double supply; + private final UID id; public Feature(final FeatureInstance featureInstance, double budget, double supply) { super("feature"); this.featureInstance = featureInstance; - this.budget = budget; this.supply = supply; + this.id = new UID(); + super.setBudget(budget); } public final FeatureInstance getFeatureInstance() { @@ -32,10 +58,13 @@ public final double getSupply() { return supply; } + public final UID getID() { + return id; + } + @Override void visitChildren(Visitor visitor) { // TODO Auto-generated method stub } - } \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java index 22d1079063f..06d042acd14 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/internal/busload/model/PowerRequirementModel.java @@ -1,3 +1,26 @@ +/** + * 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.internal.busload.model; import java.util.ArrayList; @@ -18,9 +41,9 @@ public class PowerRequirementModel extends ModelElement { private String systemSOMname = new String(); - private String powerComponentHeader = new String(); + private String componentName = new String(); - private double capacity = 0; + private double capacityTotal = 0; private double budgetTotal = 0; private double supplyTotal = 0; @@ -67,13 +90,15 @@ public static PowerRequirementModel buildModel(final SystemInstance root, final protected void process(final Element obj) { final ComponentInstance ci = (ComponentInstance) obj; - model.capacity = GetProperties.getPowerCapacity(ci, 0.0); + double tmpCapacity = GetProperties.getPowerCapacity(ci, 0.0); - if (model.capacity == 0) { + if (tmpCapacity == 0) { return; + } else { + model.capacityTotal = tmpCapacity; } - model.powerComponentHeader = "Computing Electrical Power for " + ci.getName(); + model.componentName = ci.getName(); for (FeatureInstance fi : ci.getFeatureInstances()) { double supply = GetProperties.getPowerBudget(fi, 0.0); @@ -139,6 +164,10 @@ protected void process(final Element obj) { return model; } + public static String addUnits(double value) { + return value > 2000.0 ? value / 1000 + " W" : value + " mW"; + } + void addFeature(final Feature feature) { rootFeatures.add(feature); } @@ -177,8 +206,8 @@ private ConnectionEnd getConnectionEnd(final ConnectionInstanceEnd cie, double b return connEnd; } - public double getCapacity() { - return this.capacity; + public double getTotalCapacity() { + return this.capacityTotal; } public double getTotalBudget() { @@ -189,7 +218,11 @@ public double getTotalSupply() { return this.supplyTotal; } - public String getsystemSOMname() { + public String getSystemSOMname() { return this.systemSOMname; } + + public String getComponentName() { + return this.componentName; + } } \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index d0c75bc326f..523e7e2f1f3 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -1,12 +1,34 @@ +/** + * 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.power; import java.util.ArrayList; -import java.util.Deque; -import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.util.EList; import org.osate.aadl2.Element; import org.osate.aadl2.instance.ComponentInstance; import org.osate.aadl2.instance.ConnectionInstance; @@ -103,38 +125,27 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element lastDefaultModeChoice); chosenSOM = si.getSystemOperationModes().get(choosen); - - /* - * final SOMChooserDialog somDialog = new SOMChooserDialog(getShell(), si, false); - * if (somDialog.openThreadSafe() == Window.OK) { - * chosenSOM = somDialog.getSOM(); - * } else { - * return null; - * } - */ } } final AnalysisErrorReporterManager errManager = new AnalysisErrorReporterManager( new MarkerAnalysisErrorReporter.Factory(AadlConstants.AADLOBJECTMARKER)); if (chosenSOM != null) { - // analyzeInstanceModelInMode(monitor, errManager, si, chosenSOM); final Result somResult = ResultUtil.createResult( Aadl2Util.isPrintableSOMName(chosenSOM) ? Aadl2Util.getPrintableSOMMembers(chosenSOM) : "", chosenSOM, ResultType.SUCCESS); analysisResult.getResults().add(somResult); final PowerRequirementModel model = PowerRequirementModel.buildModel(root, chosenSOM); - // i can get totals from everything in the model // Analyze the model - model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), - model.getTotalBudget(), model.getTotalSupply(), model.getsystemSOMname())); + model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getTotalCapacity(), + model.getTotalBudget(), model.getTotalSupply(), model.getSystemSOMname(), + model.getComponentName())); } else { final SOMIterator soms = new SOMIterator(si); while (soms.hasNext()) { final SystemOperationMode som = soms.nextSOM(); - // analyzeInstanceModelInMode(monitor, errManager, si, som); final Result somResult = ResultUtil.createResult( Aadl2Util.isPrintableSOMName(som) ? Aadl2Util.getPrintableSOMMembers(som) : "", som, ResultType.SUCCESS); @@ -143,8 +154,9 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element final PowerRequirementModel model = PowerRequirementModel.buildModel(root, som); // Analyze the model - model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getCapacity(), - model.getTotalBudget(), model.getTotalSupply(), model.getsystemSOMname())); + model.visit(new PowerRequirementAnalysisVisitor(somResult, model.getTotalCapacity(), + model.getTotalBudget(), model.getTotalSupply(), model.getSystemSOMname(), + model.getComponentName())); } } } @@ -357,19 +369,19 @@ private void powerComponentError(Section s, String msg) { // ==== Analysis Visitor ==== private class PowerRequirementAnalysisVisitor implements Visitor { - private Deque previousResult = new LinkedList<>(); private Result currentResult; private final double capacity, tBudget, tSupply; - private final String systemSOMname; + private final String systemSOMname, componentName; public PowerRequirementAnalysisVisitor(final Result rootResult, double capacity, double budget, double supply, - String systemSOMname) { + String systemSOMname, String componentName) { this.currentResult = rootResult; this.capacity = capacity; this.tBudget = budget; this.tSupply = supply; this.systemSOMname = systemSOMname; + this.componentName = componentName; } @Override @@ -377,39 +389,50 @@ public void visitConnectionEndPrefix(final ConnectionEnd connEnd) { final ConnectionInstanceEnd connInstanceEnd = connEnd.getConnectionInstanceEnd(); // Create a new result object for the connection end - final Result connEndResult = ResultUtil.createResult(connInstanceEnd.getName(), connInstanceEnd, + final Result connEndResult = ResultUtil.createResult(connInstanceEnd.getName() + connEnd.getID().toString(), + connInstanceEnd, ResultType.SUCCESS); + currentResult.getSubResults().add(connEndResult); - previousResult.push(currentResult); - currentResult = connEndResult; } @Override public void visitConnectionEndPostfix(final ConnectionEnd connEnd) { // unroll the result stack - final Result connEndResult = currentResult; - currentResult = previousResult.pop(); - double budget = connEnd.getBudget(); - double supply = connEnd.getSupply(); + EList results = currentResult.getSubResults(); + String visitConnEndID = connEnd.getID().toString(); + + results.forEach(result -> { + String msg = result.getMessage(); - ResultUtil.addRealValue(connEndResult, budget); - ResultUtil.addRealValue(connEndResult, supply); + if (msg.contains(visitConnEndID)) { + result.setMessage(msg.replaceAll(visitConnEndID, "")); - ResultUtil.addStringValue(connEndResult, "System name " + this.systemSOMname); - ResultUtil.addStringValue(connEndResult, - "Budget " + PowerRequirementAnalysis.toString(budget) + " for " - + connEnd.getConnectionInstanceEnd().getContainingComponentInstance().getName() - + " out of total " - + PowerRequirementAnalysis.toString(tBudget)); + double budget = connEnd.getBudget(); + double supply = connEnd.getSupply(); + String name = connEnd.getConnectionInstanceEnd().getContainingComponentInstance().getName(); - ResultUtil.addStringValue(connEndResult, - "Supply " + PowerRequirementAnalysis.toString(supply) + " from " - + connEnd.getConnectionInstanceEnd().getContainingComponentInstance().getName() - + " out of total " - + PowerRequirementAnalysis.toString(tSupply)); + ResultUtil.addRealValue(result, budget); + ResultUtil.addRealValue(result, supply); + ResultUtil.addRealValue(result, capacity); + ResultUtil.addRealValue(result, tBudget); + ResultUtil.addRealValue(result, tSupply); - ResultUtil.addStringValue(connEndResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); + ResultUtil.addStringValue(result, this.componentName); + ResultUtil.addStringValue(result, "System name " + this.systemSOMname); + ResultUtil.addStringValue(result, name); + ResultUtil.addStringValue(result, + "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + name + + " out of total " + PowerRequirementAnalysis.toString(tBudget)); + + ResultUtil.addStringValue(result, + "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + name + + " out of total " + PowerRequirementAnalysis.toString(tSupply)); + + ResultUtil.addStringValue(result, "Total capacity: " + PowerRequirementAnalysis.toString(capacity)); + } + }); } @Override @@ -417,42 +440,52 @@ public void visitFeaturePrefix(final Feature feature) { final FeatureInstance featureInstance = feature.getFeatureInstance(); // Create a new result object for the connection end - final Result featureResult = ResultUtil.createResult(featureInstance.getName(), featureInstance, + final Result featureResult = ResultUtil.createResult(featureInstance.getName() + feature.getID(), + featureInstance, ResultType.SUCCESS); + currentResult.getSubResults().add(featureResult); - previousResult.push(currentResult); - currentResult = featureResult; } @Override public void visitFeaturePostfix(final Feature feature) { // unroll the result stack - final Result featureResult = currentResult; - currentResult = previousResult.pop(); + String visitFeatureID = feature.getID().toString(); - double budget = feature.getBudget(); - double supply = feature.getSupply(); + currentResult.getSubResults().forEach(result -> { + String msg = result.getMessage(); - ResultUtil.addRealValue(featureResult, budget); - ResultUtil.addRealValue(featureResult, supply); + if (msg.contains(visitFeatureID)) { + result.setMessage(msg.replaceAll(visitFeatureID, "")); - ResultUtil.addStringValue(featureResult, "System name " + this.systemSOMname); - ResultUtil.addStringValue(featureResult, - "Budget " + PowerRequirementAnalysis.toString(budget) + " for " - + feature.getFeatureInstance().getContainingComponentInstance().getName() + " out of total " - + PowerRequirementAnalysis.toString(budgetTotal)); + double budget = feature.getBudget(); + double supply = feature.getSupply(); + String name = feature.getFeatureInstance().getContainingComponentInstance().getName(); - ResultUtil.addStringValue(featureResult, - "Supply " + PowerRequirementAnalysis.toString(supply) + " from " - + feature.getFeatureInstance().getContainingComponentInstance().getName() + " out of total " - + PowerRequirementAnalysis.toString(supplyTotal)); + ResultUtil.addRealValue(result, budget); // 0 + ResultUtil.addRealValue(result, supply); // 1 + ResultUtil.addRealValue(result, capacity);// 2 + ResultUtil.addRealValue(result, tBudget); // 3 + ResultUtil.addRealValue(result, tSupply); // 4 - ResultUtil.addStringValue(featureResult, "Total capacity " + PowerRequirementAnalysis.toString(capacity)); - } + ResultUtil.addStringValue(result, this.componentName); // 5 + ResultUtil.addStringValue(result, "System name " + this.systemSOMname); // 6 + ResultUtil.addStringValue(result, name); // 7 + ResultUtil.addStringValue(result, + "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + name + + " out of total " + PowerRequirementAnalysis.toString(tBudget)); + + ResultUtil.addStringValue(result, + "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + name + + " out of total " + PowerRequirementAnalysis.toString(tSupply)); + ResultUtil.addStringValue(result, "Total capacity: " + PowerRequirementAnalysis.toString(capacity)); + } + }); + } } - private static String toString(double value) { + public static String toString(double value) { return value > 2000.0 ? value / 1000 + " W" : value + " mW"; } } \ No newline at end of file diff --git a/core/org.osate.pluginsupport/META-INF/MANIFEST.MF b/core/org.osate.pluginsupport/META-INF/MANIFEST.MF index f8b019c92dd..6d0be42718c 100644 --- a/core/org.osate.pluginsupport/META-INF/MANIFEST.MF +++ b/core/org.osate.pluginsupport/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Activator: org.osate.pluginsupport.PluginSupportPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.xtend.lib;bundle-version="[2.20.0,3.0.0)", org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.eclipse.ui.workbench;bundle-version="[3.117.0,4.0.0)", org.eclipse.core.commands;bundle-version="[3.9.0,4.0.0)", org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)", diff --git a/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF b/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF index 8b1fc57163c..0ce3f054712 100644 --- a/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF +++ b/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.115.0,4.0.0)", org.eclipse.ui.browser;bundle-version="[3.6.100,4.0.0)", org.eclipse.ui.ide;bundle-version="[3.13.1,4.0.0)", org.eclipse.sirius.common.ui;bundle-version="[5.1.0,7.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)" + org.osate.results;bundle-version="[2.1.0,3.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: CMU/SEI diff --git a/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF b/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF index 8b126d0da4c..21ee7a2aba2 100644 --- a/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF +++ b/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF @@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.17.0,4.0.0)", org.osate.xtext.aadl2.errormodel;bundle-version="[6.1.0,7.0.0)";visibility:=reexport, org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.eclipse.jdt.core;bundle-version="[3.13.102,4.0.0)", - org.osate.results;bundle-version="[2.0.0,3.0.0)", + org.osate.results;bundle-version="[2.1.0,3.0.0)", org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)", org.osate.aadl2.errormodel.faulttree;bundle-version="[6.0.0,7.0.0)" Bundle-ActivationPolicy: lazy From 253e764c2c83286b6347aad1ee139e496048bfee Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Mon, 14 Dec 2020 10:51:44 -0500 Subject: [PATCH 10/23] add description of returned object. clean up unused functions --- .../power/PowerRequirementAnalysis.java | 252 +++--------------- 1 file changed, 44 insertions(+), 208 deletions(-) diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index 523e7e2f1f3..e9bfcb9bbf2 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -31,7 +31,6 @@ import org.eclipse.emf.common.util.EList; import org.osate.aadl2.Element; import org.osate.aadl2.instance.ComponentInstance; -import org.osate.aadl2.instance.ConnectionInstance; import org.osate.aadl2.instance.ConnectionInstanceEnd; import org.osate.aadl2.instance.FeatureInstance; import org.osate.aadl2.instance.InstanceObject; @@ -40,13 +39,8 @@ import org.osate.aadl2.modelsupport.AadlConstants; import org.osate.aadl2.modelsupport.errorreporting.AnalysisErrorReporterManager; import org.osate.aadl2.modelsupport.errorreporting.MarkerAnalysisErrorReporter; -import org.osate.aadl2.modelsupport.modeltraversal.ForAllElement; import org.osate.aadl2.modelsupport.modeltraversal.SOMIterator; import org.osate.aadl2.util.Aadl2Util; -import org.osate.analysis.flows.reporting.model.Line; -import org.osate.analysis.flows.reporting.model.Report; -import org.osate.analysis.flows.reporting.model.Report.ReportType; -import org.osate.analysis.flows.reporting.model.Section; import org.osate.analysis.resource.budgets.internal.busload.model.ConnectionEnd; import org.osate.analysis.resource.budgets.internal.busload.model.Feature; import org.osate.analysis.resource.budgets.internal.busload.model.PowerRequirementModel; @@ -56,8 +50,51 @@ import org.osate.result.ResultType; import org.osate.result.util.ResultUtil; import org.osate.ui.dialogs.Dialog; -import org.osate.xtext.aadl2.properties.util.GetProperties; +/** + * Class for performing "power requirements" analysis on a system. Basically it makes sure the selected system + * has enough actual capacity to fulfill the power demand. + * + *

The format for the returned {@code AnalysisResult} object is as follows: + * + *

For the {@code AnalysisResult} object itself: + *

    + *
  • analysis = "Power Requirements" + *
  • modelElement = {@code SystemInstance} being analyzed + *
  • resultType = SUCCESS + *
  • message = "Power requirements analysis of ..." + *
  • diagnostics = empty list + *
  • parameters = empty list + *
  • results = one {@code Result} for each system operation mode + *
      + *
    • modelElement = {@code SystemOperationMode} instance object + *
    • resultType = SUCCESS + *
    • message = empty string + *
    • values = empty list + *
    • diagnostics = empty list + *
    • subResults = one {@code Result} for each {@code ComponentInstance} with category of {@code Feature} or {@code ConnectionEnd} + *
        + *
      • modelElement = {@code Feature} or {@code ConnectionEnd} instance object + *
      • resultType = SUCCESS + *
      • message = The component's name from {@link ComponentInstance#getName()} + *
      • values[0] = The budget of {@code Feature} or {@code ConnectionEnd} instance object (power provided by this component) (RealValue) + *
      • values[1] = The supply in form of power budget drawn from other supply. This could be a requires bus access, or an incoming abstract feature. There must be a connection on this feature (RealValue) + *
      • values[2] = The capacity of the power supplier system in W as specified by SEI::PowerCapacity property (RealValue) + *
      • values[3] = Total Budget across the whole system (RealValue) + *
      • values[4] = Total Supply across the whole system (RealValue) + *
      • values[5] = components that represent a power system with capacity (StringValue) + *
      • values[6] = "System name ..." (StringValue) + *
      • values[7] = {@code Feature} or {@code ConnectionEnd} instance's name (StringValue) + *
      • values[8] = "Budget ... for EPSU out of total ..." (StringValue) + *
      • values[9] = "Supply ... for EPSU out of total ..." (StringValue) + *
      • values[10] = "Total capacity: ..." (StringValue) + *
      • diagnostics is empty + *
      • subResults is empty + *
      + *
    + *
+ * + */ public class PowerRequirementAnalysis { private static final String INITIAL_MODE_LABEL = "Initial Mode"; @@ -72,11 +109,6 @@ public class PowerRequirementAnalysis { private static final int DEFAULT_MODE_CHOICE = INITIAL_MODE; private int lastDefaultModeChoice = DEFAULT_MODE_CHOICE; - private Report powerReport; - - private double capacity = 0; - private double budgetTotal = 0; - private double supplyTotal = 0; public PowerRequirementAnalysis() { super(); @@ -170,202 +202,6 @@ private AnalysisResult analyzeBody(final IProgressMonitor monitor, final Element } } - private void analyzeInstanceModelInMode(final IProgressMonitor monitor, - final AnalysisErrorReporterManager errManager, final SystemInstance si, final SystemOperationMode som) { - errManager.addPrefix(Aadl2Util.getPrintableSOMName(som) + ": "); - si.setCurrentSystemOperationMode(som); - analyzeInstanceModel(monitor, errManager, si, som); - si.clearCurrentSystemOperationMode(); - errManager.removePrefix(); - } - - protected void analyzeInstanceModel(IProgressMonitor monitor, AnalysisErrorReporterManager errManager, - SystemInstance root, SystemOperationMode som) { - monitor.beginTask("Power Analysis", 1); -// PowerAnalysis pas = new PowerAnalysis(errManager); - powerReport = new Report(root, "Power", "Power", ReportType.TABLE); -// pas.analyzePowerBudget(root, powerReport, som); - analyzePowerBudget(root, powerReport, som, errManager); - monitor.done(); - } - - public void analyzePowerBudget(SystemInstance si, Report powerReport, SystemOperationMode som, - AnalysisErrorReporterManager errManager) { - 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) { - // supply in form of power budget drawn this power supply from other supply - // this could be a requires bus access, or an incoming abstract feature - // there must be a connection on this feature - if (!fi.getDstConnectionInstances().isEmpty() || !fi.getSrcConnectionInstances().isEmpty()) { - supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.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() ? "" : ", ") - + PowerRequirementAnalysis.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() ? "" : ", ") - + PowerRequirementAnalysis.toString(budget) + " for " - + dstfi.getContainingComponentInstance().getName(); - budgetTotal += budget; - } - } - } - // power supply and budget based on access connections to this bus - // we are checking whether there are connections with the component with power capacity as source or destination - // 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() ? "" : ", ") - + PowerRequirementAnalysis.toString(budget) + " for " - + dstfi.getContainingComponentInstance().getName(); - budgetTotal += budget; - } - double supply = GetProperties.getPowerSupply(dstfi, 0.0); - if (supply > 0) { - supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.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() ? "" : ", ") - + PowerRequirementAnalysis.toString(budget) + " for " - + srcfi.getContainingComponentInstance().getName(); - budgetTotal += budget; - } - double supply = GetProperties.getPowerSupply(srcfi, 0.0); - if (supply > 0) { - supplyLine = supplyLine + (supplyLine.isEmpty() ? "" : ", ") - + PowerRequirementAnalysis.toString(supply) + " from " - + srcfi.getContainingComponentInstance().getName(); - supplyTotal += supply; - } - } - report(section, ci, somName, ci.getName() + " power", capacity, budgetTotal, supplyTotal, budgetLine, - supplyLine, errManager); - } - }; - DoCapacity.processPreOrderComponentInstance(si); - } - - private void powerComponentHeader(Section s, String header) { - Line line = new Line(); - line.addHeaderContent(header); - s.addLine(line); - } - - private void report(Section section, ComponentInstance ci, String somName, String resourceName, double capacity, - double budget, double supply, String budgetDetail, String supplyDetails, - AnalysisErrorReporterManager errManager) { - powerComponentInfo(section, "Capacity: " + toString(capacity), ""); - powerComponentInfo(section, "Supply: " + toString(supply), supplyDetails); - powerComponentInfo(section, "Budget: " + toString(budget), budgetDetail); - if (capacity > 0.0 && budget > 0.0) { - if (budget > capacity) { - String message = "** " + resourceName + " budget total " + toString(budget) + " exceeds capacity " - + toString(capacity); - errManager.error(ci, somName + ": " + message); - powerComponentError(section, message); - } else { - String message = resourceName + " budget total " + toString(budget) + " within capacity " - + toString(capacity); - errManager.info(ci, somName + ": " + message); - powerComponentSuccess(section, message); - } - } - String suppliedmsg = ""; - double available = 0.0; - if (supply == 0.0) { - available = capacity; - suppliedmsg = " capacity "; - } else { - available = supply; - suppliedmsg = " supply "; - } - - if (budget > available) { - String message = "** " + "budget total " + toString(budget) + " exceeds" + suppliedmsg - + toString(available); - powerComponentError(section, message); - errManager.error(ci, somName + ": " + message); - } else { - String message = "budget total " + toString(budget) + " within" + suppliedmsg + toString(available); - errManager.info(ci, somName + ": " + message); - powerComponentSuccess(section, message); - } - Line l = new Line(); - l.addContent(""); - section.addLine(l); - } - - private void powerComponentInfo(Section s, String header, String optional) { - Line line = new Line(); - line.addHeaderContent(header); - if (!optional.isEmpty()) { - line.addContent(optional); - } - s.addLine(line); - } - - private void powerComponentSuccess(Section s, String msg) { - Line line = new Line(); - line.addInfo(msg); - s.addLine(line); - } - - private void powerComponentError(Section s, String msg) { - Line line = new Line(); - line.addError(msg); - s.addLine(line); - } - // ==== Analysis Visitor ==== private class PowerRequirementAnalysisVisitor implements Visitor { From 063f732c07544c81309383198ac592130261a4a2 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Tue, 15 Dec 2020 15:37:58 -0500 Subject: [PATCH 11/23] Add in markers. Move and add to power analysis markdown. Add JUnit test --- .../models/issue1383/Example.aadl | 91 ++++++++++++ .../budgets/tests/Issue1383Test.xtend | 133 ++++++++++++++++++ .../META-INF/MANIFEST.MF | 3 +- .../help/markdown/power.md | 117 +++++++++++++++ .../help/toc_power.xml | 28 ++++ .../budgets/logic/GenericAnalysis.java | 21 +++ .../power/PowerRequirementAnalysis.java | 74 ++++++++-- core/org.osate.help/aadlhelp.xml | 1 + core/org.osate.help/html/plugins/index.html | 4 - core/org.osate.help/html/plugins/sei.html | 6 - 10 files changed, 459 insertions(+), 19 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl create mode 100644 analyses/org.osate.analysis.resource.budgets.tests/src/org/osate/analysis/resource/budgets/tests/Issue1383Test.xtend create mode 100644 analyses/org.osate.analysis.resource.budgets/help/markdown/power.md create mode 100644 analyses/org.osate.analysis.resource.budgets/help/toc_power.xml create mode 100644 analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/logic/GenericAnalysis.java diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl new file mode 100644 index 00000000000..c763a4dc1ce --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl @@ -0,0 +1,91 @@ +package rbtest +public + with sei; + + abstract Electricity + end Electricity; + + system ElectricGrid + features + Supplier: in feature Electricity; + Consumer: out feature Electricity; + properties + SEI::PowerCapacity => 40.0W; + end ElectricGrid; + + system MySystem + end MySystem; + + -- use this as system root for electrical power consumption and weight + system implementation MySystem.Tier0 + subcomponents + EPSU: system ElectrialPowerSupply; + Grid: system ElectricGrid; + scs: system SCS.tier0; + connections + psupply: feature EPSU.Supplier -> Grid.Supplier; + pconsume: feature Grid.Consumer -> scs.power; + end MySystem.Tier0; + + system ElectrialPowerSupply + features + Supplier: out feature Electricity; + properties + SEI::PowerSupply => 40.0W applies to Supplier; + end ElectrialPowerSupply; + + system SCS + features + power: in feature Electricity; + properties + SEI::PowerBudget => 2.5w applies to power; + SEI::WeightLimit => 2.5kg; + end SCS; + + system implementation SCS.tier0 + subcomponents + dcs: system DCS.singletier0; + sensor1: device sensor; + sensor2: device sensor; + actuator: device actuator; + connections + p1: feature power -> dcs.power; + p2: feature power -> sensor1.power; + p3: feature power -> sensor2.power; + p4: feature power -> actuator.power; + end SCS.tier0; + + device sensor + features + power: in feature Electricity; + properties + SEI::PowerBudget => 0.45w applies to power; + end sensor; + + device actuator + features + power: in feature Electricity; + properties + SEI::PowerBudget => 0.8w applies to power; + end actuator; + + system DCS + features + power: in feature Electricity; + end DCS; + + system implementation DCS.singletier0 + subcomponents + hw: system platform; + connections + p1: feature power -> hw.power; + end DCS.singletier0; + + system platform + features + power: in feature Electricity; + + properties + SEI::PowerBudget => 0.8w applies to power; + end platform; +end rbtest; \ No newline at end of file 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..2a26676b680 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets.tests/src/org/osate/analysis/resource/budgets/tests/Issue1383Test.xtend @@ -0,0 +1,133 @@ +/** + * 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) + checkValues(powerResult); + + val powerResult2 = somResult.subResults.get(1) + checkValues(powerResult2); + + val powerResult3 = somResult.subResults.get(2) + checkValues(powerResult3); + + val powerResult4 = somResult.subResults.get(3) + checkValues(powerResult4); + + val powerResult5 = somResult.subResults.get(4) + checkValues(powerResult5); + } + + private static def void checkValues(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 error(String msg) { + return #[DiagnosticType.ERROR, msg] + } + + private static def List warning(String msg) { + return #[DiagnosticType.WARNING, msg] + } + + private static def void checkDiagnostic(Diagnostic d, DiagnosticType type, String msg) { + assertEquals(type, d.diagnosticType) + assertEquals(msg, d.message) + } + + private static def void checkValues(Result result, List values, List> diagnostics) { + for (var i = 0; i < values.size; i++) { + val expected = values.get(i) + val actual = ResultUtil.getReal(result, i) + assertEquals(expected, actual, 0.0) + } + + assertEquals(diagnostics.size, result.diagnostics.size) + for (var i = 0; i < diagnostics.size; i++) { + val expected = diagnostics.get(i) + checkDiagnostic(result.diagnostics.get(i), expected.get(0) as DiagnosticType, expected.get(1) as String) + } + } + + private static def void checkIntegerValue(Result result, int idx, long expected) { + val actual = ResultUtil.getInteger(result, idx) + assertEquals(expected, actual) + } +} diff --git a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF index 334c9ba3abd..f90001e49c8 100644 --- a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF @@ -23,6 +23,7 @@ Bundle-ActivationPolicy: lazy Export-Package: org.osate.analysis.resource.budgets, org.osate.analysis.resource.budgets.busload, org.osate.analysis.resource.budgets.handlers, - org.osate.analysis.resource.budgets.logic + org.osate.analysis.resource.budgets.logic, + org.osate.analysis.resource.budgets.power Automatic-Module-Name: org.osate.analysis.resource.budgets Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/analyses/org.osate.analysis.resource.budgets/help/markdown/power.md b/analyses/org.osate.analysis.resource.budgets/help/markdown/power.md new file mode 100644 index 00000000000..a5d0211c8a8 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/help/markdown/power.md @@ -0,0 +1,117 @@ + +#Analyze Electrical Power Usage# + +OSATE supports modeling and analysis of electrical power distribution and consumption. You can introduce an *abstract* component type to represent the concept of electrical power, e.g., call it *Electricity*. We will use it as the type of component features. +Our electrical power analysis framework supports the concept of **power suppliers** and **power consumers**. A **power transmission system** is used to move electrical power from suppliers to consumers. +## Electrical Power Suppliers## +Any component type can be an electrical *power supplier*. However, it only make sense for physical components (**device**, **processor**, **bus**, **memory**) as well as **system**, and **abstract**. +We represent the fact that it supplies electricity by defining an outgoing feature, e.g., an abstract feature **out feature**. The fact that it supplies power is indicated by the property **SEI::PowerSupply**. You associate this property value with the outgoing feature. The values are real values in units of *mW* (milli watts), *W* (watts), *KW* (Kilo watts). +Users should also associate a component type as the type of the feature. This ensures that when connections are made that only features dealing with electricity are connected to each other. +## Electrical Power Consumers## +Any component type can be an electrical *power consumer*. We represent this by an incoming feature, e.g., **in feature**. In this case we use the property **SEI::PowerBudget** to indicate the demand for electrical power. Again the values are reals in units of watts. +## Electrical Power Transmission System## +We use **system**, **device**, or **abstract** components to represent the transmission system for electrical power. It has the property **SEI::PowerCapacity** in units or watts. It indicates the amount of electrical power it is able to handle. +The component type also has abstract features to indicate connection points to suppliers and to consumers. Feature connections are used to make the actual connections. + +##Electrical Power Analysis## +Electrical power analysis is available under the *Analyses/Architecture* menu as *Analyze power requirements*, or by clicking on the battery icon in the tool bar. The command is invoked on the selected instance model. + +The analysis is performed for each component that represents a transmission system. The analysis identifies all suppliers and totals the supply. Similarly, it totals the budgets of all consumers. The analysis then ensures that neither the supply total, nor the budget total exceeds the capacity. It also ensure that the budget total does not exceed the supply total. +The results of the analysis are recorded in a report under the *reports/Power* folder. It shows for each transmission system the capacity, the list of suppliers and their amount, the list of consumers and their budgets, as well as their totals. The report closes with the comparison results. +The result comparisons are also recorded as Eclipse Markers and can be viewed in the Eclipse *Problems* view. +> Note that in the problems view you can define filters to to sort the view by problem marker type, and to only see Markers of certain types. + +##Electrial Power Transmission Subsystems## +Electrical power transmission systems can themselves be consumers of electrical power that they receive from another transmission system rather than directly from a supplier. For example, a transmission subsystem may draw its power from a transmission backbone. This is modeled by an *incoming* feature with a *power budget* property. + +##Examples## +One example is available on [Github/Osate](https://github.com/osate/examples) and is called *ResourceBudgets*. You instantiate the top level system called *MySystem* as a tier0 model or as a tier2 model. It has a single transmission system. + +A second example is available on [Github/Osate](https://github.com/osate/alisa-examples) and is called *MutliTierAircraftExample*. You will find a set of project under *MultiTierAircraft* with the AADL model. The example is from the System Architecture Virtual Integration (SAVI) initiative. It has a backbone transmission system as well as a subsystem within the IMA of the aircraft. +The project AircraftSpecified represents *Tier1*, i.e., a single layer. AircraftIntegrated represents variants of *Tier2*, which includes the Integrated Modular Avionics (IMA) at one level of detail. +> Note: The example also includes a requirement and verification plan specification for automated incremental life cycle assurance under the ALISA plug-ins (see ALISA help for details). + +## Running the Analysis + +The analysis can be run over multiple models at the same time: + +1. Select one or more working set, project, directory, or instance model `.aaxl` file in the `AADL Navigator`. +2. Select `Analyses > Budget > Analyze Power Requirements` from the menu bar or navigator context menu, or select the "Analyze power requirements" icon in the toolbar. + +The analysis finds all the instance models (`.aaxl` files) in the selected items and runs over each one. + +* _The analysis runs for each system operation mode in each model._ +* An output comma-separated-values (`.csv`) file is generated for each analyzed model. The file is located in the `reports/Power` folder. The file has the same name as the model file, but with `__Power` appended to the end. +* If the analysis finds inconsistencies, it will produce error or warning markers on the instance model file. + +## Invoking Programmatically + +The analysis can be invoked programmatically by other tools by calling the method + + AnalysisResult invoke(IProgressMonitor, SystemInstance) + +on an instance of the class `PowerRequirementAnalysis` in the package `org.osate.analysis.resource.budgets.power`. This is found in the plug-in `org.osate.analysis.resource.budgets`. + +As the signature indicates, the method takes a possibly-`null` progress monitor, and the `SystemInstance` object of the model to analyze. All the system operation modes of the model are analyzed. + +A new instance of the class `PowerRequirementAnalysis` should be used for each system instance. + +### Result format + +The format for the `AnalysisResult` tree returned by `invoke()` is as follows: + +`AnalysisResult` + +* `analysis` = "Power Requirements" +* `modelElement` = `SystemInstance` being analyzed +* `resultType` = `SUCCESS` +* `message = `"Power analysis of _name of system instance_"` +* `diagnostics` = _empty list_ +* `parameters` = _empty list_ +* `results` = one `Result` for each system operation mode + + * `modelElement` = `SystemOperationMode` instance object + * `resultType` = `SUCCESS` + * `message` = _empty_ + * `values` = _empty list_ + * `diagnostics` = _empty list_ + * `subResults` = one `Result` for each `ComponentInstance` with `category` of `Feature` or `Connection End` + + * `modelElement` = `FeatureInstance` or `ConnectionEndInstance` instance object + * `resultType` = `SUCCESS` + * `message` = The component's name from `getName()` + * `values[0]` = The budget of the feature or connection end in W (`RealValue`) + * `values[1]` = The supply in form of power budget drawn from other supply. This could be a requires bus access, or an incoming abstract feature. There must be a connection on this feature (`RealValue`) + * `values[2]` = The capacity of the power supplier system in W as specified by `SEI::PowerCapacity` property (`RealValue`) + * `values[3]` = Total Budget across the whole system (`RealValue`) + * `values[4]` = Total Supply across the whole system (`RealValue`) + * `values[5]` = Components that represent a power system with capacity (`StringValue`) + * `values[6]` = System name (`StringValue`) + * `values[7]` = `Feature` or `ConnectionEnd` instance's name (`StringValue`) + * `values[8]` = Budget ... for ... out of total ... (`StringValue`) + * `values[9]` = Supply ... for ... out of total ... (`StringValue`) + * `values[10]` = Total capacity: ... (`StringValue`) + * `diagnostics` = Diagnostics associated with this Feature or Connection End. + * `subResults` = _empty_ \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/help/toc_power.xml b/analyses/org.osate.analysis.resource.budgets/help/toc_power.xml new file mode 100644 index 00000000000..9d9906629dc --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/help/toc_power.xml @@ -0,0 +1,28 @@ + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/logic/GenericAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/logic/GenericAnalysis.java new file mode 100644 index 00000000000..76b15cf77ff --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/logic/GenericAnalysis.java @@ -0,0 +1,21 @@ +package org.osate.analysis.resource.budgets.logic; + +import org.osate.aadl2.instance.InstanceObject; +import org.osate.result.DiagnosticType; +import org.osate.result.Result; +import org.osate.result.util.ResultUtil; + +/** + * @since 4.1 + */ +public class GenericAnalysis { + // ==== Error reporting methods for the visitor === + + public static void error(final Result result, final InstanceObject io, final String msg) { + result.getDiagnostics().add(ResultUtil.createDiagnostic(msg, io, DiagnosticType.ERROR)); + } + + public static void warning(final Result result, final InstanceObject io, final String msg) { + result.getDiagnostics().add(ResultUtil.createDiagnostic(msg, io, DiagnosticType.WARNING)); + } +} \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index e9bfcb9bbf2..b578cf50a3d 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -45,6 +45,7 @@ import org.osate.analysis.resource.budgets.internal.busload.model.Feature; import org.osate.analysis.resource.budgets.internal.busload.model.PowerRequirementModel; import org.osate.analysis.resource.budgets.internal.busload.model.Visitor; +import org.osate.analysis.resource.budgets.logic.GenericAnalysis; import org.osate.result.AnalysisResult; import org.osate.result.Result; import org.osate.result.ResultType; @@ -85,18 +86,19 @@ *
  • values[5] = components that represent a power system with capacity (StringValue) *
  • values[6] = "System name ..." (StringValue) *
  • values[7] = {@code Feature} or {@code ConnectionEnd} instance's name (StringValue) - *
  • values[8] = "Budget ... for EPSU out of total ..." (StringValue) - *
  • values[9] = "Supply ... for EPSU out of total ..." (StringValue) + *
  • values[8] = "Budget ... for ... out of total ..." (StringValue) + *
  • values[9] = "Supply ... for ... out of total ..." (StringValue) *
  • values[10] = "Total capacity: ..." (StringValue) - *
  • diagnostics is empty + *
  • diagnostics = Diagnostics associated with this {@code Feature} or {@code ConnectionEnd} instance object *
  • subResults is empty * * * * + * @since 4.1 */ -public class PowerRequirementAnalysis { +public class PowerRequirementAnalysis extends GenericAnalysis { private static final String INITIAL_MODE_LABEL = "Initial Mode"; private static final String CHOOSE_MODE_LABEL = "Choose Mode..."; private static final String ALL_MODES_LABEL = "All Modes"; @@ -258,15 +260,43 @@ public void visitConnectionEndPostfix(final ConnectionEnd connEnd) { ResultUtil.addStringValue(result, this.componentName); ResultUtil.addStringValue(result, "System name " + this.systemSOMname); ResultUtil.addStringValue(result, name); + + String stBudget = PowerRequirementAnalysis.toString(tBudget); + ResultUtil.addStringValue(result, "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + name - + " out of total " + PowerRequirementAnalysis.toString(tBudget)); + + " out of total " + stBudget); ResultUtil.addStringValue(result, "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + name + " out of total " + PowerRequirementAnalysis.toString(tSupply)); - ResultUtil.addStringValue(result, "Total capacity: " + PowerRequirementAnalysis.toString(capacity)); + String stCapacity = PowerRequirementAnalysis.toString(capacity); + + ResultUtil.addStringValue(result, "Total capacity: " + stCapacity); + + // diagnostics -> markers + final ConnectionInstanceEnd connEndInstance = connEnd.getConnectionInstanceEnd(); + + if (capacity > 0.0 && tBudget > 0.0 && tBudget > capacity) { + error(result, connEndInstance, + this.componentName + " budget total " + stBudget + " exceeds capacity " + stCapacity); + } + + double available = 0.0; + String suppliedmsg = ""; + if (tSupply == 0.0) { + available = capacity; + suppliedmsg = " capacity "; + } else { + available = tSupply; + suppliedmsg = " supply "; + } + + if (tBudget > available) { + error(result, connEndInstance, " budget total " + stBudget + " exceeds capacity " + suppliedmsg + + PowerRequirementAnalysis.toString(available)); + } } }); } @@ -307,15 +337,43 @@ public void visitFeaturePostfix(final Feature feature) { ResultUtil.addStringValue(result, this.componentName); // 5 ResultUtil.addStringValue(result, "System name " + this.systemSOMname); // 6 ResultUtil.addStringValue(result, name); // 7 + + String stBudget = PowerRequirementAnalysis.toString(tBudget); + ResultUtil.addStringValue(result, "Budget " + PowerRequirementAnalysis.toString(budget) + " for " + name - + " out of total " + PowerRequirementAnalysis.toString(tBudget)); + + " out of total " + stBudget); ResultUtil.addStringValue(result, "Supply " + PowerRequirementAnalysis.toString(supply) + " from " + name + " out of total " + PowerRequirementAnalysis.toString(tSupply)); - ResultUtil.addStringValue(result, "Total capacity: " + PowerRequirementAnalysis.toString(capacity)); + String stCapacity = PowerRequirementAnalysis.toString(capacity); + + ResultUtil.addStringValue(result, "Total capacity: " + stCapacity); + + // diagnostics -> markers + final FeatureInstance featureInstance = feature.getFeatureInstance(); + + if (capacity > 0.0 && tBudget > 0.0 && tBudget > capacity) { + error(result, featureInstance, + this.componentName + " budget total " + stBudget + " exceeds capacity " + stCapacity); + } + + double available = 0.0; + String suppliedmsg = ""; + if (tSupply == 0.0) { + available = capacity; + suppliedmsg = " capacity "; + } else { + available = tSupply; + suppliedmsg = " supply "; + } + + if (tBudget > available) { + error(result, featureInstance, " budget total " + stBudget + " exceeds capacity " + suppliedmsg + + PowerRequirementAnalysis.toString(available)); + } } }); } diff --git a/core/org.osate.help/aadlhelp.xml b/core/org.osate.help/aadlhelp.xml index 57e4af1e0f0..54cba84004a 100644 --- a/core/org.osate.help/aadlhelp.xml +++ b/core/org.osate.help/aadlhelp.xml @@ -57,6 +57,7 @@ censes only apply to the Third Party Software and not any other portion of this + diff --git a/core/org.osate.help/html/plugins/index.html b/core/org.osate.help/html/plugins/index.html index bcea577e995..302e6b61211 100644 --- a/core/org.osate.help/html/plugins/index.html +++ b/core/org.osate.help/html/plugins/index.html @@ -48,10 +48,6 @@

    OSATE plug-ins

    Weight (Mass) Analysis: analyzes the weight of components in an instance model.
  • -
  • - Electrical Power Analysis: analyzes - electrical power budgets against electrical power supply within the capacity of the electrical power transmission system. -
  • Resource Budget Analysis for MIPS, RAM, ROM, and Network Bandwidth: compares resource budgets against capacities, in case of components bound to a resource, only for those budgets bound to a given resource. diff --git a/core/org.osate.help/html/plugins/sei.html b/core/org.osate.help/html/plugins/sei.html index 92ef9990536..e86d7a2335b 100644 --- a/core/org.osate.help/html/plugins/sei.html +++ b/core/org.osate.help/html/plugins/sei.html @@ -131,12 +131,6 @@

    Weight Analysis Plug-In

    specified weight limits. For details see here.

    -

    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. From 9cf466058116edc31fe23142741439147a5cac70 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Tue, 15 Dec 2020 17:46:45 -0500 Subject: [PATCH 12/23] add 2 more tests --- .../models/issue1383/TestNoSupply.aadl | 92 ++++++++++++++++ .../models/issue1383/TestOverCapacity.aadl | 91 ++++++++++++++++ .../budgets/tests/Issue1383Test.xtend | 101 ++++++++++++++++-- .../power/PowerRequirementAnalysis.java | 12 +-- 4 files changed, 283 insertions(+), 13 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl create mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl new file mode 100644 index 00000000000..9bd26fd1694 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl @@ -0,0 +1,92 @@ + +package rbtest +public + with sei; + + abstract Electricity + end Electricity; + + system ElectricGrid + features + Supplier: in feature Electricity; + Consumer: out feature Electricity; + properties + SEI::PowerCapacity => 40.0W; + end ElectricGrid; + + system MySystem + end MySystem; + + -- use this as system root for electrical power consumption and weight + system implementation MySystem.Tier0 + subcomponents + EPSU: system ElectrialPowerSupply; + Grid: system ElectricGrid; + scs: system SCS.tier0; + connections + psupply: feature EPSU.Supplier -> Grid.Supplier; + pconsume: feature Grid.Consumer -> scs.power; + end MySystem.Tier0; + + system ElectrialPowerSupply + features + Supplier: out feature Electricity; + properties + SEI::PowerSupply => 0.0W applies to Supplier; + end ElectrialPowerSupply; + + system SCS + features + power: in feature Electricity; + properties + SEI::PowerBudget => 90.0w applies to power; + SEI::WeightLimit => 2.5kg; + end SCS; + + system implementation SCS.tier0 + subcomponents + dcs: system DCS.singletier0; + sensor1: device sensor; + sensor2: device sensor; + actuator: device actuator; + connections + p1: feature power -> dcs.power; + p2: feature power -> sensor1.power; + p3: feature power -> sensor2.power; + p4: feature power -> actuator.power; + end SCS.tier0; + + device sensor + features + power: in feature Electricity; + properties + SEI::PowerBudget => 0.45w applies to power; + end sensor; + + device actuator + features + power: in feature Electricity; + properties + SEI::PowerBudget => 90.8w applies to power; + end actuator; + + system DCS + features + power: in feature Electricity; + end DCS; + + system implementation DCS.singletier0 + subcomponents + hw: system platform; + connections + p1: feature power -> hw.power; + end DCS.singletier0; + + system platform + features + power: in feature Electricity; + + properties + SEI::PowerBudget => 0.8w applies to power; + end platform; +end rbtest; \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl new file mode 100644 index 00000000000..142e725aec9 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl @@ -0,0 +1,91 @@ +package rbtest +public + with sei; + + abstract Electricity + end Electricity; + + system ElectricGrid + features + Supplier: in feature Electricity; + Consumer: out feature Electricity; + properties + SEI::PowerCapacity => 40.0W; + end ElectricGrid; + + system MySystem + end MySystem; + + -- use this as system root for electrical power consumption and weight + system implementation MySystem.Tier0 + subcomponents + EPSU: system ElectrialPowerSupply; + Grid: system ElectricGrid; + scs: system SCS.tier0; + connections + psupply: feature EPSU.Supplier -> Grid.Supplier; + pconsume: feature Grid.Consumer -> scs.power; + end MySystem.Tier0; + + system ElectrialPowerSupply + features + Supplier: out feature Electricity; + properties + SEI::PowerSupply => 80.0W applies to Supplier; + end ElectrialPowerSupply; + + system SCS + features + power: in feature Electricity; + properties + SEI::PowerBudget => 90.0w applies to power; + SEI::WeightLimit => 2.5kg; + end SCS; + + system implementation SCS.tier0 + subcomponents + dcs: system DCS.singletier0; + sensor1: device sensor; + sensor2: device sensor; + actuator: device actuator; + connections + p1: feature power -> dcs.power; + p2: feature power -> sensor1.power; + p3: feature power -> sensor2.power; + p4: feature power -> actuator.power; + end SCS.tier0; + + device sensor + features + power: in feature Electricity; + properties + SEI::PowerBudget => 0.45w applies to power; + end sensor; + + device actuator + features + power: in feature Electricity; + properties + SEI::PowerBudget => 90.8w applies to power; + end actuator; + + system DCS + features + power: in feature Electricity; + end DCS; + + system implementation DCS.singletier0 + subcomponents + hw: system platform; + connections + p1: feature power -> hw.power; + end DCS.singletier0; + + system platform + features + power: in feature Electricity; + + properties + SEI::PowerBudget => 0.8w applies to power; + end platform; +end rbtest; \ No newline at end of file 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 index 2a26676b680..daa22546622 100644 --- 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 @@ -54,7 +54,6 @@ class Issue1383Test extends XtextTest { val static PROJECT_LOCATION = "org.osate.analysis.resource.budgets.tests/models/Issue1383/" - @Test def void testBasicResourceBudgetExample() { val pkg = testHelper.parseFile(PROJECT_LOCATION + "Example.aadl") @@ -69,22 +68,110 @@ class Issue1383Test extends XtextTest { val analysisResult = checker.invoke(null, instance) val somResult = analysisResult.results.get(0) val powerResult = somResult.subResults.get(0) - checkValues(powerResult); + 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) - checkValues(powerResult2); + checkOverValues(powerResult2); val powerResult3 = somResult.subResults.get(2) - checkValues(powerResult3); + checkOverValues(powerResult3); val powerResult4 = somResult.subResults.get(3) - checkValues(powerResult4); + checkOverValues(powerResult4); val powerResult5 = somResult.subResults.get(4) - checkValues(powerResult5); + 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); + + val powerResult5 = somResult.subResults.get(4) + checkNoSupplyValues(powerResult5); + } + + private static def void checkNoSupplyValues(Result result){ + val compName = ResultUtil.getString(result, 7) + + if (compName == "EPSU") + checkValues(result, #[0.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 == "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 checkValues(Result result){ + private static def void checkRBValues(Result result){ val compName = ResultUtil.getString(result, 7) if (compName == "EPSU") diff --git a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java index b578cf50a3d..fe716d60205 100644 --- a/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java +++ b/analyses/org.osate.analysis.resource.budgets/src/org/osate/analysis/resource/budgets/power/PowerRequirementAnalysis.java @@ -287,14 +287,14 @@ public void visitConnectionEndPostfix(final ConnectionEnd connEnd) { String suppliedmsg = ""; if (tSupply == 0.0) { available = capacity; - suppliedmsg = " capacity "; + suppliedmsg = "capacity "; } else { available = tSupply; - suppliedmsg = " supply "; + suppliedmsg = "supply "; } if (tBudget > available) { - error(result, connEndInstance, " budget total " + stBudget + " exceeds capacity " + suppliedmsg + error(result, connEndInstance, "budget total " + stBudget + " exceeds " + suppliedmsg + PowerRequirementAnalysis.toString(available)); } } @@ -364,14 +364,14 @@ public void visitFeaturePostfix(final Feature feature) { String suppliedmsg = ""; if (tSupply == 0.0) { available = capacity; - suppliedmsg = " capacity "; + suppliedmsg = "capacity "; } else { available = tSupply; - suppliedmsg = " supply "; + suppliedmsg = "supply "; } if (tBudget > available) { - error(result, featureInstance, " budget total " + stBudget + " exceeds capacity " + suppliedmsg + error(result, featureInstance, "budget total " + stBudget + " exceeds " + suppliedmsg + PowerRequirementAnalysis.toString(available)); } } From 11dc0f2e6e7d60933538d271ca20d00231c3a8a4 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Mon, 4 Jan 2021 08:53:21 -0500 Subject: [PATCH 13/23] Correct no supply test: since EPSU system is set to 0 power supply, it is not pulled in to the object as a power supplier --- .../analysis/resource/budgets/tests/Issue1383Test.xtend | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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 index daa22546622..49398f7e515 100644 --- 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 @@ -136,17 +136,12 @@ class Issue1383Test extends XtextTest { val powerResult4 = somResult.subResults.get(3) checkNoSupplyValues(powerResult4); - - val powerResult5 = somResult.subResults.get(4) - checkNoSupplyValues(powerResult5); } private static def void checkNoSupplyValues(Result result){ val compName = ResultUtil.getString(result, 7) - if (compName == "EPSU") - checkValues(result, #[0.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 == "hw") + 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")]) From a2a61a8c600815edb56a63da82c89cdb9225ba83 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Mon, 4 Jan 2021 14:14:55 -0500 Subject: [PATCH 14/23] rename folder to match path in test --- .../models/{issue1383 => Issue1383}/Example.aadl | 0 .../models/{issue1383 => Issue1383}/TestNoSupply.aadl | 0 .../models/{issue1383 => Issue1383}/TestOverCapacity.aadl | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename analyses/org.osate.analysis.resource.budgets.tests/models/{issue1383 => Issue1383}/Example.aadl (100%) rename analyses/org.osate.analysis.resource.budgets.tests/models/{issue1383 => Issue1383}/TestNoSupply.aadl (100%) rename analyses/org.osate.analysis.resource.budgets.tests/models/{issue1383 => Issue1383}/TestOverCapacity.aadl (100%) diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl similarity index 100% rename from analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/Example.aadl rename to analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl similarity index 100% rename from analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestNoSupply.aadl rename to analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl similarity index 100% rename from analyses/org.osate.analysis.resource.budgets.tests/models/issue1383/TestOverCapacity.aadl rename to analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl From 96e399f53e8bfb38b22740efea23f10d09b5d669 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Thu, 14 Jan 2021 14:14:24 -0500 Subject: [PATCH 15/23] add html file for power analysis --- .../help/.gitignore | 1 - .../help/html/power.html | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 analyses/org.osate.analysis.resource.budgets/help/html/power.html diff --git a/analyses/org.osate.analysis.resource.budgets/help/.gitignore b/analyses/org.osate.analysis.resource.budgets/help/.gitignore index 5abcd60926b..e69de29bb2d 100644 --- a/analyses/org.osate.analysis.resource.budgets/help/.gitignore +++ b/analyses/org.osate.analysis.resource.budgets/help/.gitignore @@ -1 +0,0 @@ -/html/ \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/help/html/power.html b/analyses/org.osate.analysis.resource.budgets/help/html/power.html new file mode 100644 index 00000000000..d3c1c384ba5 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/help/html/power.html @@ -0,0 +1,104 @@ + +

    Analyze Electrical Power Usage

    +

    OSATE supports modeling and analysis of electrical power distribution and consumption. You can introduce an abstract component type to represent the concept of electrical power, e.g., call it Electricity. We will use it as the type of component features. Our electrical power analysis framework supports the concept of power suppliers and power consumers. A power transmission system is used to move electrical power from suppliers to consumers.

    +

    Electrical Power Suppliers

    +

    Any component type can be an electrical power supplier. However, it only make sense for physical components (device, processor, bus, memory) as well as system, and abstract. We represent the fact that it supplies electricity by defining an outgoing feature, e.g., an abstract feature out feature. The fact that it supplies power is indicated by the property SEI::PowerSupply. You associate this property value with the outgoing feature. The values are real values in units of mW (milli watts), W (watts), KW (Kilo watts). Users should also associate a component type as the type of the feature. This ensures that when connections are made that only features dealing with electricity are connected to each other.

    +

    Electrical Power Consumers

    +

    Any component type can be an electrical power consumer. We represent this by an incoming feature, e.g., in feature. In this case we use the property SEI::PowerBudget to indicate the demand for electrical power. Again the values are reals in units of watts.

    +

    Electrical Power Transmission System

    +

    We use system, device, or abstract components to represent the transmission system for electrical power. It has the property SEI::PowerCapacity in units or watts. It indicates the amount of electrical power it is able to handle. The component type also has abstract features to indicate connection points to suppliers and to consumers. Feature connections are used to make the actual connections.

    +

    Electrical Power Analysis

    +

    Electrical power analysis is available under the Analyses/Architecture menu as Analyze power requirements, or by clicking on the battery icon in the tool bar. The command is invoked on the selected instance model.

    +

    The analysis is performed for each component that represents a transmission system. The analysis identifies all suppliers and totals the supply. Similarly, it totals the budgets of all consumers. The analysis then ensures that neither the supply total, nor the budget total exceeds the capacity. It also ensure that the budget total does not exceed the supply total. The results of the analysis are recorded in a report under the reports/Power folder. It shows for each transmission system the capacity, the list of suppliers and their amount, the list of consumers and their budgets, as well as their totals. The report closes with the comparison results. The result comparisons are also recorded as Eclipse Markers and can be viewed in the Eclipse Problems view.

    +
    +

    Note that in the problems view you can define filters to to sort the view by problem marker type, and to only see Markers of certain types.

    +
    +

    Electrial Power Transmission Subsystems

    +

    Electrical power transmission systems can themselves be consumers of electrical power that they receive from another transmission system rather than directly from a supplier. For example, a transmission subsystem may draw its power from a transmission backbone. This is modeled by an incoming feature with a power budget property.

    +

    Examples

    +

    One example is available on Github/Osate and is called ResourceBudgets. You instantiate the top level system called MySystem as a tier0 model or as a tier2 model. It has a single transmission system.

    +

    A second example is available on Github/Osate and is called MutliTierAircraftExample. You will find a set of project under MultiTierAircraft with the AADL model. The example is from the System Architecture Virtual Integration (SAVI) initiative. It has a backbone transmission system as well as a subsystem within the IMA of the aircraft. The project AircraftSpecified represents Tier1, i.e., a single layer. AircraftIntegrated represents variants of Tier2, which includes the Integrated Modular Avionics (IMA) at one level of detail.

    +
    +

    Note: The example also includes a requirement and verification plan specification for automated incremental life cycle assurance under the ALISA plug-ins (see ALISA help for details).

    +
    +

    Running the Analysis

    +

    The analysis can be run over multiple models at the same time:

    +
      +
    1. Select one or more working set, project, directory, or instance model .aaxl file in the AADL Navigator.
    2. +
    3. Select Analyses > Budget > Analyze Power Requirements from the menu bar or navigator context menu, or select the "Analyze power requirements" icon in the toolbar.
    4. +
    +

    The analysis finds all the instance models (.aaxl files) in the selected items and runs over each one.

    +
      +
    • The analysis runs for each system operation mode in each model.
    • +
    • An output comma-separated-values (.csv) file is generated for each analyzed model. The file is located in the reports/Power folder. The file has the same name as the model file, but with __Power appended to the end.
    • +
    • If the analysis finds inconsistencies, it will produce error or warning markers on the instance model file.
    • +
    +

    Invoking Programmatically

    +

    The analysis can be invoked programmatically by other tools by calling the method

    +
        AnalysisResult invoke(IProgressMonitor, SystemInstance)
    +
    +

    on an instance of the class PowerRequirementAnalysis in the package org.osate.analysis.resource.budgets.power. This is found in the plug-in org.osate.analysis.resource.budgets.

    +

    As the signature indicates, the method takes a possibly-null progress monitor, and the SystemInstance object of the model to analyze. All the system operation modes of the model are analyzed.

    +

    A new instance of the class PowerRequirementAnalysis should be used for each system instance.

    +

    Result format

    +

    The format for the AnalysisResult tree returned by invoke() is as follows:

    +

    AnalysisResult

    +
      +
    • analysis = "Power Requirements"
    • +
    • modelElement = SystemInstance being analyzed
    • +
    • resultType = SUCCESS
    • +
    • message ="Power analysis of name of system instance"`
    • +
    • diagnostics = empty list
    • +
    • parameters = empty list
    • +
    • results = one Result for each system operation mode +
        +
      • modelElement = SystemOperationMode instance object
      • +
      • resultType = SUCCESS
      • +
      • message = empty
      • +
      • values = empty list
      • +
      • diagnostics = empty list
      • +
      • subResults = one Result for each ComponentInstance with category of Feature or Connection End +
          +
        • modelElement = FeatureInstance or ConnectionEndInstance instance object
        • +
        • resultType = SUCCESS
        • +
        • message = The component's name from getName()
        • +
        • values[0] = The budget of the feature or connection end in W (RealValue)
        • +
        • values[1] = The supply in form of power budget drawn from other supply. This could be a requires bus access, or an incoming abstract feature. There must be a connection on this feature (RealValue)
        • +
        • values[2] = The capacity of the power supplier system in W as specified by SEI::PowerCapacity property (RealValue)
        • +
        • values[3] = Total Budget across the whole system (RealValue)
        • +
        • values[4] = Total Supply across the whole system (RealValue)
        • +
        • values[5] = Components that represent a power system with capacity (StringValue)
        • +
        • values[6] = System name (StringValue)
        • +
        • values[7] = Feature or ConnectionEnd instance's name (StringValue)
        • +
        • values[8] = Budget ... for ... out of total ... (StringValue)
        • +
        • values[9] = Supply ... for ... out of total ... (StringValue)
        • +
        • values[10] = Total capacity: ... (StringValue)
        • +
        • diagnostics = Diagnostics associated with this Feature or Connection End.
        • +
        • subResults = empty
        • +
        +
      • +
      +
    • +
    From 73bfe6da34600a4eb794e09dec7e53427230c259 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Thu, 14 Jan 2021 14:47:20 -0500 Subject: [PATCH 16/23] Revert "add html file for power analysis" This reverts commit 27aa0648d5656090a6cb2b14d1f92ec81d947f6e. --- .../help/.gitignore | 1 + .../help/html/power.html | 104 ------------------ 2 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 analyses/org.osate.analysis.resource.budgets/help/html/power.html diff --git a/analyses/org.osate.analysis.resource.budgets/help/.gitignore b/analyses/org.osate.analysis.resource.budgets/help/.gitignore index e69de29bb2d..5abcd60926b 100644 --- a/analyses/org.osate.analysis.resource.budgets/help/.gitignore +++ b/analyses/org.osate.analysis.resource.budgets/help/.gitignore @@ -0,0 +1 @@ +/html/ \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets/help/html/power.html b/analyses/org.osate.analysis.resource.budgets/help/html/power.html deleted file mode 100644 index d3c1c384ba5..00000000000 --- a/analyses/org.osate.analysis.resource.budgets/help/html/power.html +++ /dev/null @@ -1,104 +0,0 @@ - -

    Analyze Electrical Power Usage

    -

    OSATE supports modeling and analysis of electrical power distribution and consumption. You can introduce an abstract component type to represent the concept of electrical power, e.g., call it Electricity. We will use it as the type of component features. Our electrical power analysis framework supports the concept of power suppliers and power consumers. A power transmission system is used to move electrical power from suppliers to consumers.

    -

    Electrical Power Suppliers

    -

    Any component type can be an electrical power supplier. However, it only make sense for physical components (device, processor, bus, memory) as well as system, and abstract. We represent the fact that it supplies electricity by defining an outgoing feature, e.g., an abstract feature out feature. The fact that it supplies power is indicated by the property SEI::PowerSupply. You associate this property value with the outgoing feature. The values are real values in units of mW (milli watts), W (watts), KW (Kilo watts). Users should also associate a component type as the type of the feature. This ensures that when connections are made that only features dealing with electricity are connected to each other.

    -

    Electrical Power Consumers

    -

    Any component type can be an electrical power consumer. We represent this by an incoming feature, e.g., in feature. In this case we use the property SEI::PowerBudget to indicate the demand for electrical power. Again the values are reals in units of watts.

    -

    Electrical Power Transmission System

    -

    We use system, device, or abstract components to represent the transmission system for electrical power. It has the property SEI::PowerCapacity in units or watts. It indicates the amount of electrical power it is able to handle. The component type also has abstract features to indicate connection points to suppliers and to consumers. Feature connections are used to make the actual connections.

    -

    Electrical Power Analysis

    -

    Electrical power analysis is available under the Analyses/Architecture menu as Analyze power requirements, or by clicking on the battery icon in the tool bar. The command is invoked on the selected instance model.

    -

    The analysis is performed for each component that represents a transmission system. The analysis identifies all suppliers and totals the supply. Similarly, it totals the budgets of all consumers. The analysis then ensures that neither the supply total, nor the budget total exceeds the capacity. It also ensure that the budget total does not exceed the supply total. The results of the analysis are recorded in a report under the reports/Power folder. It shows for each transmission system the capacity, the list of suppliers and their amount, the list of consumers and their budgets, as well as their totals. The report closes with the comparison results. The result comparisons are also recorded as Eclipse Markers and can be viewed in the Eclipse Problems view.

    -
    -

    Note that in the problems view you can define filters to to sort the view by problem marker type, and to only see Markers of certain types.

    -
    -

    Electrial Power Transmission Subsystems

    -

    Electrical power transmission systems can themselves be consumers of electrical power that they receive from another transmission system rather than directly from a supplier. For example, a transmission subsystem may draw its power from a transmission backbone. This is modeled by an incoming feature with a power budget property.

    -

    Examples

    -

    One example is available on Github/Osate and is called ResourceBudgets. You instantiate the top level system called MySystem as a tier0 model or as a tier2 model. It has a single transmission system.

    -

    A second example is available on Github/Osate and is called MutliTierAircraftExample. You will find a set of project under MultiTierAircraft with the AADL model. The example is from the System Architecture Virtual Integration (SAVI) initiative. It has a backbone transmission system as well as a subsystem within the IMA of the aircraft. The project AircraftSpecified represents Tier1, i.e., a single layer. AircraftIntegrated represents variants of Tier2, which includes the Integrated Modular Avionics (IMA) at one level of detail.

    -
    -

    Note: The example also includes a requirement and verification plan specification for automated incremental life cycle assurance under the ALISA plug-ins (see ALISA help for details).

    -
    -

    Running the Analysis

    -

    The analysis can be run over multiple models at the same time:

    -
      -
    1. Select one or more working set, project, directory, or instance model .aaxl file in the AADL Navigator.
    2. -
    3. Select Analyses > Budget > Analyze Power Requirements from the menu bar or navigator context menu, or select the "Analyze power requirements" icon in the toolbar.
    4. -
    -

    The analysis finds all the instance models (.aaxl files) in the selected items and runs over each one.

    -
      -
    • The analysis runs for each system operation mode in each model.
    • -
    • An output comma-separated-values (.csv) file is generated for each analyzed model. The file is located in the reports/Power folder. The file has the same name as the model file, but with __Power appended to the end.
    • -
    • If the analysis finds inconsistencies, it will produce error or warning markers on the instance model file.
    • -
    -

    Invoking Programmatically

    -

    The analysis can be invoked programmatically by other tools by calling the method

    -
        AnalysisResult invoke(IProgressMonitor, SystemInstance)
    -
    -

    on an instance of the class PowerRequirementAnalysis in the package org.osate.analysis.resource.budgets.power. This is found in the plug-in org.osate.analysis.resource.budgets.

    -

    As the signature indicates, the method takes a possibly-null progress monitor, and the SystemInstance object of the model to analyze. All the system operation modes of the model are analyzed.

    -

    A new instance of the class PowerRequirementAnalysis should be used for each system instance.

    -

    Result format

    -

    The format for the AnalysisResult tree returned by invoke() is as follows:

    -

    AnalysisResult

    -
      -
    • analysis = "Power Requirements"
    • -
    • modelElement = SystemInstance being analyzed
    • -
    • resultType = SUCCESS
    • -
    • message ="Power analysis of name of system instance"`
    • -
    • diagnostics = empty list
    • -
    • parameters = empty list
    • -
    • results = one Result for each system operation mode -
        -
      • modelElement = SystemOperationMode instance object
      • -
      • resultType = SUCCESS
      • -
      • message = empty
      • -
      • values = empty list
      • -
      • diagnostics = empty list
      • -
      • subResults = one Result for each ComponentInstance with category of Feature or Connection End -
          -
        • modelElement = FeatureInstance or ConnectionEndInstance instance object
        • -
        • resultType = SUCCESS
        • -
        • message = The component's name from getName()
        • -
        • values[0] = The budget of the feature or connection end in W (RealValue)
        • -
        • values[1] = The supply in form of power budget drawn from other supply. This could be a requires bus access, or an incoming abstract feature. There must be a connection on this feature (RealValue)
        • -
        • values[2] = The capacity of the power supplier system in W as specified by SEI::PowerCapacity property (RealValue)
        • -
        • values[3] = Total Budget across the whole system (RealValue)
        • -
        • values[4] = Total Supply across the whole system (RealValue)
        • -
        • values[5] = Components that represent a power system with capacity (StringValue)
        • -
        • values[6] = System name (StringValue)
        • -
        • values[7] = Feature or ConnectionEnd instance's name (StringValue)
        • -
        • values[8] = Budget ... for ... out of total ... (StringValue)
        • -
        • values[9] = Supply ... for ... out of total ... (StringValue)
        • -
        • values[10] = Total capacity: ... (StringValue)
        • -
        • diagnostics = Diagnostics associated with this Feature or Connection End.
        • -
        • subResults = empty
        • -
        -
      • -
      -
    • -
    From f471ac95e0c4f8ae0dfc88113b7b8551f92f721f Mon Sep 17 00:00:00 2001 From: Aaron Greenhouse Date: Wed, 17 Feb 2021 12:39:08 -0500 Subject: [PATCH 17/23] Reverted org.osate.results to match the master branch. This shouldn't have been changed. --- .../models/Issue1383/Example.aadl | 91 ------------------ .../models/Issue1383/TestNoSupply.aadl | 92 ------------------- .../models/Issue1383/TestOverCapacity.aadl | 91 ------------------ core/org.osate.results/pom.xml | 2 +- 4 files changed, 1 insertion(+), 275 deletions(-) delete mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl delete mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl delete mode 100644 analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl deleted file mode 100644 index c763a4dc1ce..00000000000 --- a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/Example.aadl +++ /dev/null @@ -1,91 +0,0 @@ -package rbtest -public - with sei; - - abstract Electricity - end Electricity; - - system ElectricGrid - features - Supplier: in feature Electricity; - Consumer: out feature Electricity; - properties - SEI::PowerCapacity => 40.0W; - end ElectricGrid; - - system MySystem - end MySystem; - - -- use this as system root for electrical power consumption and weight - system implementation MySystem.Tier0 - subcomponents - EPSU: system ElectrialPowerSupply; - Grid: system ElectricGrid; - scs: system SCS.tier0; - connections - psupply: feature EPSU.Supplier -> Grid.Supplier; - pconsume: feature Grid.Consumer -> scs.power; - end MySystem.Tier0; - - system ElectrialPowerSupply - features - Supplier: out feature Electricity; - properties - SEI::PowerSupply => 40.0W applies to Supplier; - end ElectrialPowerSupply; - - system SCS - features - power: in feature Electricity; - properties - SEI::PowerBudget => 2.5w applies to power; - SEI::WeightLimit => 2.5kg; - end SCS; - - system implementation SCS.tier0 - subcomponents - dcs: system DCS.singletier0; - sensor1: device sensor; - sensor2: device sensor; - actuator: device actuator; - connections - p1: feature power -> dcs.power; - p2: feature power -> sensor1.power; - p3: feature power -> sensor2.power; - p4: feature power -> actuator.power; - end SCS.tier0; - - device sensor - features - power: in feature Electricity; - properties - SEI::PowerBudget => 0.45w applies to power; - end sensor; - - device actuator - features - power: in feature Electricity; - properties - SEI::PowerBudget => 0.8w applies to power; - end actuator; - - system DCS - features - power: in feature Electricity; - end DCS; - - system implementation DCS.singletier0 - subcomponents - hw: system platform; - connections - p1: feature power -> hw.power; - end DCS.singletier0; - - system platform - features - power: in feature Electricity; - - properties - SEI::PowerBudget => 0.8w applies to power; - end platform; -end rbtest; \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl deleted file mode 100644 index 9bd26fd1694..00000000000 --- a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestNoSupply.aadl +++ /dev/null @@ -1,92 +0,0 @@ - -package rbtest -public - with sei; - - abstract Electricity - end Electricity; - - system ElectricGrid - features - Supplier: in feature Electricity; - Consumer: out feature Electricity; - properties - SEI::PowerCapacity => 40.0W; - end ElectricGrid; - - system MySystem - end MySystem; - - -- use this as system root for electrical power consumption and weight - system implementation MySystem.Tier0 - subcomponents - EPSU: system ElectrialPowerSupply; - Grid: system ElectricGrid; - scs: system SCS.tier0; - connections - psupply: feature EPSU.Supplier -> Grid.Supplier; - pconsume: feature Grid.Consumer -> scs.power; - end MySystem.Tier0; - - system ElectrialPowerSupply - features - Supplier: out feature Electricity; - properties - SEI::PowerSupply => 0.0W applies to Supplier; - end ElectrialPowerSupply; - - system SCS - features - power: in feature Electricity; - properties - SEI::PowerBudget => 90.0w applies to power; - SEI::WeightLimit => 2.5kg; - end SCS; - - system implementation SCS.tier0 - subcomponents - dcs: system DCS.singletier0; - sensor1: device sensor; - sensor2: device sensor; - actuator: device actuator; - connections - p1: feature power -> dcs.power; - p2: feature power -> sensor1.power; - p3: feature power -> sensor2.power; - p4: feature power -> actuator.power; - end SCS.tier0; - - device sensor - features - power: in feature Electricity; - properties - SEI::PowerBudget => 0.45w applies to power; - end sensor; - - device actuator - features - power: in feature Electricity; - properties - SEI::PowerBudget => 90.8w applies to power; - end actuator; - - system DCS - features - power: in feature Electricity; - end DCS; - - system implementation DCS.singletier0 - subcomponents - hw: system platform; - connections - p1: feature power -> hw.power; - end DCS.singletier0; - - system platform - features - power: in feature Electricity; - - properties - SEI::PowerBudget => 0.8w applies to power; - end platform; -end rbtest; \ No newline at end of file diff --git a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl b/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl deleted file mode 100644 index 142e725aec9..00000000000 --- a/analyses/org.osate.analysis.resource.budgets.tests/models/Issue1383/TestOverCapacity.aadl +++ /dev/null @@ -1,91 +0,0 @@ -package rbtest -public - with sei; - - abstract Electricity - end Electricity; - - system ElectricGrid - features - Supplier: in feature Electricity; - Consumer: out feature Electricity; - properties - SEI::PowerCapacity => 40.0W; - end ElectricGrid; - - system MySystem - end MySystem; - - -- use this as system root for electrical power consumption and weight - system implementation MySystem.Tier0 - subcomponents - EPSU: system ElectrialPowerSupply; - Grid: system ElectricGrid; - scs: system SCS.tier0; - connections - psupply: feature EPSU.Supplier -> Grid.Supplier; - pconsume: feature Grid.Consumer -> scs.power; - end MySystem.Tier0; - - system ElectrialPowerSupply - features - Supplier: out feature Electricity; - properties - SEI::PowerSupply => 80.0W applies to Supplier; - end ElectrialPowerSupply; - - system SCS - features - power: in feature Electricity; - properties - SEI::PowerBudget => 90.0w applies to power; - SEI::WeightLimit => 2.5kg; - end SCS; - - system implementation SCS.tier0 - subcomponents - dcs: system DCS.singletier0; - sensor1: device sensor; - sensor2: device sensor; - actuator: device actuator; - connections - p1: feature power -> dcs.power; - p2: feature power -> sensor1.power; - p3: feature power -> sensor2.power; - p4: feature power -> actuator.power; - end SCS.tier0; - - device sensor - features - power: in feature Electricity; - properties - SEI::PowerBudget => 0.45w applies to power; - end sensor; - - device actuator - features - power: in feature Electricity; - properties - SEI::PowerBudget => 90.8w applies to power; - end actuator; - - system DCS - features - power: in feature Electricity; - end DCS; - - system implementation DCS.singletier0 - subcomponents - hw: system platform; - connections - p1: feature power -> hw.power; - end DCS.singletier0; - - system platform - features - power: in feature Electricity; - - properties - SEI::PowerBudget => 0.8w applies to power; - end platform; -end rbtest; \ No newline at end of file diff --git a/core/org.osate.results/pom.xml b/core/org.osate.results/pom.xml index 53948ca2c6c..50f6310297f 100644 --- a/core/org.osate.results/pom.xml +++ b/core/org.osate.results/pom.xml @@ -7,7 +7,7 @@ org.osate core.parent - 2.10.0-SNAPSHOT + 2.9.2-SNAPSHOT org.osate From 2e02a77ab70d46f01e6839762f0cb2d804de741a Mon Sep 17 00:00:00 2001 From: Aaron Greenhouse Date: Wed, 17 Feb 2021 12:39:45 -0500 Subject: [PATCH 18/23] Fixed plugin support version depedencies --- core/org.osate.pluginsupport/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/org.osate.pluginsupport/META-INF/MANIFEST.MF b/core/org.osate.pluginsupport/META-INF/MANIFEST.MF index 6d0be42718c..f8b019c92dd 100644 --- a/core/org.osate.pluginsupport/META-INF/MANIFEST.MF +++ b/core/org.osate.pluginsupport/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Activator: org.osate.pluginsupport.PluginSupportPlugin Bundle-Localization: plugin Require-Bundle: org.eclipse.xtend.lib;bundle-version="[2.20.0,3.0.0)", org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.eclipse.ui.workbench;bundle-version="[3.117.0,4.0.0)", org.eclipse.core.commands;bundle-version="[3.9.0,4.0.0)", org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)", From 8c33daa295250101717838e417658be56446d012 Mon Sep 17 00:00:00 2001 From: Aaron Greenhouse Date: Wed, 17 Feb 2021 13:12:49 -0500 Subject: [PATCH 19/23] Fixed versionsing problem --- alisa/org.osate.alisa.common/META-INF/MANIFEST.MF | 2 +- alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF | 2 +- alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF | 2 +- alisa/org.osate.assure/META-INF/MANIFEST.MF | 2 +- alisa/org.osate.verify/META-INF/MANIFEST.MF | 2 +- analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF index f4ebb932a58..b96a4037643 100644 --- a/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.common/META-INF/MANIFEST.MF @@ -24,7 +24,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.19.0,2.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)" Import-Package: org.apache.log4j;version="[1.2.0,2.0.0)" diff --git a/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF index 6d6f44404d8..f857cbc05a7 100644 --- a/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.contribution/META-INF/MANIFEST.MF @@ -6,7 +6,7 @@ Bundle-Version: 1.0.5.qualifier Export-Package: alisa_consistency Require-Bundle: org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)", org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)" + org.osate.results;bundle-version="[2.0.0,3.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Automatic-Module-Name: org.osate.alisa.contribution Bundle-Vendor: CMU/SEI diff --git a/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF b/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF index 857da51326a..10611be3372 100644 --- a/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF +++ b/alisa/org.osate.alisa.workbench.ui/META-INF/MANIFEST.MF @@ -26,7 +26,7 @@ Require-Bundle: org.osate.alisa.workbench;bundle-version="[3.0.0,4.0.0)";visibil org.osate.verify;bundle-version="[4.0.0,5.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.osate.categories;bundle-version="[3.0.0,4.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.eclipse.emf.transaction;bundle-version="[1.9.0,2.0.0)", org.eclipse.xtend.lib;bundle-version="[2.20.0,3.0.0)";resolution:=optional Import-Package: org.apache.commons.lang;version="[2.6.0,3.0.0)", diff --git a/alisa/org.osate.assure/META-INF/MANIFEST.MF b/alisa/org.osate.assure/META-INF/MANIFEST.MF index cdadeb1ff70..ac152d7a8fe 100644 --- a/alisa/org.osate.assure/META-INF/MANIFEST.MF +++ b/alisa/org.osate.assure/META-INF/MANIFEST.MF @@ -39,7 +39,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.osate.aadl2.instantiation;bundle-version="[1.1.0,2.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.8.1,2.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.osate.xtext.aadl2;bundle-version="[6.0.0,7.0.0)", org.osate.organization;bundle-version="[3.0.0,4.0.0)", org.osate.annexsupport;bundle-version="[3.2.0,4.0.0)" diff --git a/alisa/org.osate.verify/META-INF/MANIFEST.MF b/alisa/org.osate.verify/META-INF/MANIFEST.MF index f9c71b4119c..5b8b0cd4221 100644 --- a/alisa/org.osate.verify/META-INF/MANIFEST.MF +++ b/alisa/org.osate.verify/META-INF/MANIFEST.MF @@ -32,7 +32,7 @@ Require-Bundle: org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)";visibility:=re org.eclipse.jdt.core;bundle-version="[3.10.0,4.0.0)", org.eclipse.xtext.xbase.lib;bundle-version="[2.20.0,3.0.0)", org.eclipse.xsemantics.runtime;bundle-version="[1.8.1,2.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.osate.organization;bundle-version="[3.0.0,4.0.0)", org.eclipse.jface;bundle-version="[3.13.2,4.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", diff --git a/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF index e5b724a8c63..17f8274e01e 100644 --- a/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.architecture/META-INF/MANIFEST.MF @@ -14,7 +14,7 @@ Require-Bundle: org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", org.osate.ui;bundle-version="[6.0.0,7.0.0)", org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.0.0)", org.osate.xtext.aadl2;bundle-version="[6.0.0,7.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.eclipse.ui.ide;bundle-version="[3.13.1,4.0.0)", org.eclipse.xtext;bundle-version="[2.20.0,3.0.0)", org.eclipse.emf.transaction;bundle-version="[1.4.0,2.0.0)", diff --git a/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF b/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF index 0ce3f054712..8b1fc57163c 100644 --- a/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF +++ b/emv2/org.osate.aadl2.errormodel.faulttree.generation/META-INF/MANIFEST.MF @@ -18,7 +18,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.115.0,4.0.0)", org.eclipse.ui.browser;bundle-version="[3.6.100,4.0.0)", org.eclipse.ui.ide;bundle-version="[3.13.1,4.0.0)", org.eclipse.sirius.common.ui;bundle-version="[5.1.0,7.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)" + org.osate.results;bundle-version="[2.0.0,3.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Vendor: CMU/SEI diff --git a/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF b/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF index 21ee7a2aba2..8b126d0da4c 100644 --- a/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF +++ b/emv2/org.osate.aadl2.errormodel.propagationgraph/META-INF/MANIFEST.MF @@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.17.0,4.0.0)", org.osate.xtext.aadl2.errormodel;bundle-version="[6.1.0,7.0.0)";visibility:=reexport, org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.eclipse.jdt.core;bundle-version="[3.13.102,4.0.0)", - org.osate.results;bundle-version="[2.1.0,3.0.0)", + org.osate.results;bundle-version="[2.0.0,3.0.0)", org.osate.pluginsupport;bundle-version="[6.0.0,7.0.0)", org.osate.aadl2.errormodel.faulttree;bundle-version="[6.0.0,7.0.0)" Bundle-ActivationPolicy: lazy From 5d3edfd3eabc3dff5e4262712f9cbb5f02596de8 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Thu, 4 Mar 2021 09:35:51 -0500 Subject: [PATCH 20/23] add EMF model for power requirements analysis --- .../model/power.aird | 99 +++++++++++++++++++ .../model/power.ecore | 21 ++++ .../model/power.genmodel | 27 +++++ 3 files changed, 147 insertions(+) create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.aird create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.ecore create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.genmodel diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.aird b/analyses/org.osate.analysis.resource.budgets/model/power.aird new file mode 100644 index 00000000000..a91e90ce3fb --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.aird @@ -0,0 +1,99 @@ + + + + power.ecore + platform:/resource/org.osate.aadl2/model/instance.ecore + platform:/resource/org.osate.aadl2/model/aadl2.ecore + platform:/resource/org.osate.analysis.model/model/analysis.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + KEEP_LOCATION + KEEP_SIZE + KEEP_RATIO + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.ecore b/analyses/org.osate.analysis.resource.budgets/model/power.ecore new file mode 100644 index 00000000000..2edaa166a72 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.ecore @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.genmodel b/analyses/org.osate.analysis.resource.budgets/model/power.genmodel new file mode 100644 index 00000000000..ef2b938315f --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.genmodel @@ -0,0 +1,27 @@ + + + power.ecore + + + + + + + + + + + + + + + + + + + From 5a0f29df28bb0fa7029a0f08394c9687d813e2b2 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Mon, 12 Jul 2021 09:16:25 -0400 Subject: [PATCH 21/23] new ecore model and generated code for power requirement analysis --- alisa/org.osate.verify/META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- analyses/org.osate.analysis.model/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 17 +- .../model/power.aird | 391 +++++++++ .../model/power.ecore | 26 + .../model/power.genmodel | 35 + .../plugin.xml | 8 + .../pom.xml | 2 +- .../internal/models/power/PowerConsumer.java | 48 ++ .../internal/models/power/PowerElement.java | 94 +++ .../internal/models/power/PowerFactory.java | 71 ++ .../internal/models/power/PowerModel.java | 39 + .../internal/models/power/PowerPackage.java | 751 ++++++++++++++++++ .../internal/models/power/PowerSupplier.java | 48 ++ .../models/power/PowerTransmissionSystem.java | 75 ++ .../models/power/impl/PowerConsumerImpl.java | 161 ++++ .../models/power/impl/PowerElementImpl.java | 281 +++++++ .../models/power/impl/PowerFactoryImpl.java | 137 ++++ .../models/power/impl/PowerModelImpl.java | 150 ++++ .../models/power/impl/PowerPackageImpl.java | 388 +++++++++ .../models/power/impl/PowerSupplierImpl.java | 161 ++++ .../impl/PowerTransmissionSystemImpl.java | 256 ++++++ .../power/util/PowerAdapterFactory.java | 215 +++++ .../models/power/util/PowerSwitch.java | 249 ++++++ .../org.osate.plugins.feature/feature.xml | 2 +- analyses/org.osate.plugins.feature/pom.xml | 2 +- 27 files changed, 3600 insertions(+), 13 deletions(-) create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.aird create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.ecore create mode 100644 analyses/org.osate.analysis.resource.budgets/model/power.genmodel create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerConsumer.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerElement.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerFactory.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerModel.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerPackage.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerSupplier.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerTransmissionSystem.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerConsumerImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerElementImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerFactoryImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerModelImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerPackageImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerSupplierImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerTransmissionSystemImpl.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerAdapterFactory.java create mode 100644 analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerSwitch.java diff --git a/alisa/org.osate.verify/META-INF/MANIFEST.MF b/alisa/org.osate.verify/META-INF/MANIFEST.MF index dd1a072bed2..5b8b0cd4221 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.model/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.model/META-INF/MANIFEST.MF index 9c6fa3c16ed..ce39255e225 100644 --- a/analyses/org.osate.analysis.model/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.model/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.osate.analysis.model;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.0.1.qualifier Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/analyses/org.osate.analysis.model/pom.xml b/analyses/org.osate.analysis.model/pom.xml index 1a73dd99ea0..2742ff5f41a 100644 --- a/analyses/org.osate.analysis.model/pom.xml +++ b/analyses/org.osate.analysis.model/pom.xml @@ -12,7 +12,7 @@ org.osate org.osate.analysis.model - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT eclipse-plugin diff --git a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF index 334c9ba3abd..e14b6f04b65 100644 --- a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF @@ -1,28 +1,31 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Resource Analysis Plug-in +Bundle-Name: %pluginName Bundle-SymbolicName: org.osate.analysis.resource.budgets;singleton:=true -Bundle-Version: 4.0.3.qualifier +Bundle-Version: 4.1.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.osate.analysis.resource.budgets.ResourceBudgetPlugin -Bundle-Vendor: CMU/SEI +Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.ui;bundle-version="[3.115.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.17.0,4.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)", + org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)";visibility:=reexport, org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", - org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", + org.osate.aadl2;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, org.osate.ui;bundle-version="[6.1.0,7.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.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.results;bundle-version="[2.0.0,3.0.0)", - org.osate.analysis.model;bundle-version="[1.0.0,2.0.0)" + org.osate.analysis.model;bundle-version="[1.0.0,2.0.0)";visibility:=reexport Bundle-ActivationPolicy: lazy Export-Package: org.osate.analysis.resource.budgets, org.osate.analysis.resource.budgets.busload, org.osate.analysis.resource.budgets.handlers, - org.osate.analysis.resource.budgets.logic + org.osate.analysis.resource.budgets.logic, + org.osate.analysis.resource.budgets.internal.models.power, + org.osate.analysis.resource.budgets.internal.models.power.impl, + org.osate.analysis.resource.budgets.internal.models.power.util Automatic-Module-Name: org.osate.analysis.resource.budgets Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.aird b/analyses/org.osate.analysis.resource.budgets/model/power.aird new file mode 100644 index 00000000000..2707214c4c5 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.aird @@ -0,0 +1,391 @@ + + + + power.ecore + platform:/resource/org.osate.analysis.model/model/analysis.ecore + platform:/resource/org.osate.aadl2/model/instance.ecore + platform:/resource/org.osate.aadl2/model/aadl2.ecore + power.genmodel + platform:/resource/org.osate.aadl2/model/aadl2.genmodel + platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel + platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore + platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel + platform:/plugin/org.eclipse.uml2.types/model/Types.genmodel + platform:/plugin/org.eclipse.uml2.types/model/Types.ecore + platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore + platform:/resource/org.osate.analysis.model/model/analysis.genmodel + platform:/resource/org.osate.aadl2/model/instance.genmodel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.ecore b/analyses/org.osate.analysis.resource.budgets/model/power.ecore new file mode 100644 index 00000000000..8ef3c45270d --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.ecore @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/model/power.genmodel b/analyses/org.osate.analysis.resource.budgets/model/power.genmodel new file mode 100644 index 00000000000..c6512bdfae7 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/model/power.genmodel @@ -0,0 +1,35 @@ + + + power.ecore + + + + + + + + + + + + + + + + + + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/plugin.xml b/analyses/org.osate.analysis.resource.budgets/plugin.xml index ba6bb6df3d1..ef0f8039d1e 100644 --- a/analyses/org.osate.analysis.resource.budgets/plugin.xml +++ b/analyses/org.osate.analysis.resource.budgets/plugin.xml @@ -282,4 +282,12 @@ censes only apply to the Third Party Software and not any other portion of this genModel="model/busload.genmodel"/> + + + + + diff --git a/analyses/org.osate.analysis.resource.budgets/pom.xml b/analyses/org.osate.analysis.resource.budgets/pom.xml index 563474694c9..36794c521c9 100644 --- a/analyses/org.osate.analysis.resource.budgets/pom.xml +++ b/analyses/org.osate.analysis.resource.budgets/pom.xml @@ -12,7 +12,7 @@ org.osate org.osate.analysis.resource.budgets - 4.0.3-SNAPSHOT + 4.1.0-SNAPSHOT eclipse-plugin diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerConsumer.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerConsumer.java new file mode 100644 index 00000000000..239d9ea8b61 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerConsumer.java @@ -0,0 +1,48 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.osate.aadl2.instance.FeatureInstance; + +/** + * + * A representation of the model object 'Consumer'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer#getFeatureInstance Feature Instance}
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerConsumer() + * @model + * @generated + * @since 4.1 + */ +public interface PowerConsumer extends PowerElement { + /** + * Returns the value of the 'Feature Instance' reference. + * + * + * @return the value of the 'Feature Instance' reference. + * @see #setFeatureInstance(FeatureInstance) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerConsumer_FeatureInstance() + * @model + * @generated + */ + FeatureInstance getFeatureInstance(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer#getFeatureInstance Feature Instance}' reference. + * + * + * @param value the new value of the 'Feature Instance' reference. + * @see #getFeatureInstance() + * @generated + */ + void setFeatureInstance(FeatureInstance value); + +} // PowerConsumer diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerElement.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerElement.java new file mode 100644 index 00000000000..d6965d9a364 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerElement.java @@ -0,0 +1,94 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.osate.analysis.model.AnalysisElement; + +/** + * + * A representation of the model object 'Element'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getCapacity Capacity}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getBudget Budget}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getSupply Supply}
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerElement() + * @model abstract="true" + * @generated + * @since 4.1 + */ +public interface PowerElement extends AnalysisElement { + /** + * Returns the value of the 'Capacity' attribute. + * + * + * @return the value of the 'Capacity' attribute. + * @see #setCapacity(double) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerElement_Capacity() + * @model + * @generated + */ + double getCapacity(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getCapacity Capacity}' attribute. + * + * + * @param value the new value of the 'Capacity' attribute. + * @see #getCapacity() + * @generated + */ + void setCapacity(double value); + + /** + * Returns the value of the 'Budget' attribute. + * + * + * @return the value of the 'Budget' attribute. + * @see #setBudget(double) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerElement_Budget() + * @model + * @generated + */ + double getBudget(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getBudget Budget}' attribute. + * + * + * @param value the new value of the 'Budget' attribute. + * @see #getBudget() + * @generated + */ + void setBudget(double value); + + /** + * Returns the value of the 'Supply' attribute. + * + * + * @return the value of the 'Supply' attribute. + * @see #setSupply(double) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerElement_Supply() + * @model + * @generated + */ + double getSupply(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getSupply Supply}' attribute. + * + * + * @param value the new value of the 'Supply' attribute. + * @see #getSupply() + * @generated + */ + void setSupply(double value); + +} // PowerElement diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerFactory.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerFactory.java new file mode 100644 index 00000000000..065cfea45e1 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerFactory.java @@ -0,0 +1,71 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage + * @generated + * @since 4.1 + */ +public interface PowerFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + PowerFactory eINSTANCE = org.osate.analysis.resource.budgets.internal.models.power.impl.PowerFactoryImpl.init(); + + /** + * Returns a new object of class 'Transmission System'. + * + * + * @return a new object of class 'Transmission System'. + * @generated + */ + PowerTransmissionSystem createPowerTransmissionSystem(); + + /** + * Returns a new object of class 'Supplier'. + * + * + * @return a new object of class 'Supplier'. + * @generated + */ + PowerSupplier createPowerSupplier(); + + /** + * Returns a new object of class 'Consumer'. + * + * + * @return a new object of class 'Consumer'. + * @generated + */ + PowerConsumer createPowerConsumer(); + + /** + * Returns a new object of class 'Model'. + * + * + * @return a new object of class 'Model'. + * @generated + */ + PowerModel createPowerModel(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + PowerPackage getPowerPackage(); + +} //PowerFactory diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerModel.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerModel.java new file mode 100644 index 00000000000..b3facbe82ba --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerModel.java @@ -0,0 +1,39 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.eclipse.emf.common.util.EList; +import org.osate.analysis.model.AnalysisElement; + +/** + * + * A representation of the model object 'Model'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerModel#getRootPowerTransmissionSystem Root Power Transmission System}
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerModel() + * @model + * @generated + * @since 4.1 + */ +public interface PowerModel extends AnalysisElement { + /** + * Returns the value of the 'Root Power Transmission System' containment reference list. + * The list contents are of type {@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem}. + * + * + * @return the value of the 'Root Power Transmission System' containment reference list. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerModel_RootPowerTransmissionSystem() + * @model containment="true" + * @generated + */ + EList getRootPowerTransmissionSystem(); + +} // PowerModel diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerPackage.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerPackage.java new file mode 100644 index 00000000000..131364604fb --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerPackage.java @@ -0,0 +1,751 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.osate.analysis.model.ModelPackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
      + *
    • each class,
    • + *
    • each feature of each class,
    • + *
    • each operation of each class,
    • + *
    • each enum,
    • + *
    • and each data type
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerFactory + * @model kind="package" + * @generated + * @since 4.1 + */ +public interface PowerPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "power"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://osate.org/analysis/power"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "power"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + PowerPackage eINSTANCE = org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl.init(); + + /** + * The meta object id for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl Element}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerElement() + * @generated + */ + int POWER_ELEMENT = 0; + + /** + * The feature id for the 'Capacity' attribute. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT__CAPACITY = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Budget' attribute. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT__BUDGET = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Supply' attribute. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT__SUPPLY = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Element' class. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT_FEATURE_COUNT = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 3; + + /** + * The operation id for the 'Is Leaf' operation. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT___IS_LEAF = ModelPackage.ANALYSIS_ELEMENT___IS_LEAF; + + /** + * The operation id for the 'Get Ordered Children' operation. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT___GET_ORDERED_CHILDREN = ModelPackage.ANALYSIS_ELEMENT___GET_ORDERED_CHILDREN; + + /** + * The number of operations of the 'Element' class. + * + * + * @generated + * @ordered + */ + int POWER_ELEMENT_OPERATION_COUNT = ModelPackage.ANALYSIS_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl Transmission System}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerTransmissionSystem() + * @generated + */ + int POWER_TRANSMISSION_SYSTEM = 1; + + /** + * The feature id for the 'Capacity' attribute. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__CAPACITY = POWER_ELEMENT__CAPACITY; + + /** + * The feature id for the 'Budget' attribute. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__BUDGET = POWER_ELEMENT__BUDGET; + + /** + * The feature id for the 'Supply' attribute. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__SUPPLY = POWER_ELEMENT__SUPPLY; + + /** + * The feature id for the 'Component Instance' reference. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE = POWER_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Suppliers' containment reference list. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__SUPPLIERS = POWER_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Consumers' containment reference list. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM__CONSUMERS = POWER_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Transmission System' class. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM_FEATURE_COUNT = POWER_ELEMENT_FEATURE_COUNT + 3; + + /** + * The operation id for the 'Is Leaf' operation. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM___IS_LEAF = POWER_ELEMENT___IS_LEAF; + + /** + * The operation id for the 'Get Ordered Children' operation. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM___GET_ORDERED_CHILDREN = POWER_ELEMENT___GET_ORDERED_CHILDREN; + + /** + * The number of operations of the 'Transmission System' class. + * + * + * @generated + * @ordered + */ + int POWER_TRANSMISSION_SYSTEM_OPERATION_COUNT = POWER_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerSupplierImpl Supplier}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerSupplierImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerSupplier() + * @generated + */ + int POWER_SUPPLIER = 2; + + /** + * The feature id for the 'Capacity' attribute. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER__CAPACITY = POWER_ELEMENT__CAPACITY; + + /** + * The feature id for the 'Budget' attribute. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER__BUDGET = POWER_ELEMENT__BUDGET; + + /** + * The feature id for the 'Supply' attribute. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER__SUPPLY = POWER_ELEMENT__SUPPLY; + + /** + * The feature id for the 'Feature Instance' reference. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER__FEATURE_INSTANCE = POWER_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Supplier' class. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER_FEATURE_COUNT = POWER_ELEMENT_FEATURE_COUNT + 1; + + /** + * The operation id for the 'Is Leaf' operation. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER___IS_LEAF = POWER_ELEMENT___IS_LEAF; + + /** + * The operation id for the 'Get Ordered Children' operation. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER___GET_ORDERED_CHILDREN = POWER_ELEMENT___GET_ORDERED_CHILDREN; + + /** + * The number of operations of the 'Supplier' class. + * + * + * @generated + * @ordered + */ + int POWER_SUPPLIER_OPERATION_COUNT = POWER_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerConsumerImpl Consumer}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerConsumerImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerConsumer() + * @generated + */ + int POWER_CONSUMER = 3; + + /** + * The feature id for the 'Capacity' attribute. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER__CAPACITY = POWER_ELEMENT__CAPACITY; + + /** + * The feature id for the 'Budget' attribute. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER__BUDGET = POWER_ELEMENT__BUDGET; + + /** + * The feature id for the 'Supply' attribute. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER__SUPPLY = POWER_ELEMENT__SUPPLY; + + /** + * The feature id for the 'Feature Instance' reference. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER__FEATURE_INSTANCE = POWER_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Consumer' class. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER_FEATURE_COUNT = POWER_ELEMENT_FEATURE_COUNT + 1; + + /** + * The operation id for the 'Is Leaf' operation. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER___IS_LEAF = POWER_ELEMENT___IS_LEAF; + + /** + * The operation id for the 'Get Ordered Children' operation. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER___GET_ORDERED_CHILDREN = POWER_ELEMENT___GET_ORDERED_CHILDREN; + + /** + * The number of operations of the 'Consumer' class. + * + * + * @generated + * @ordered + */ + int POWER_CONSUMER_OPERATION_COUNT = POWER_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerModelImpl Model}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerModelImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerModel() + * @generated + */ + int POWER_MODEL = 4; + + /** + * The feature id for the 'Root Power Transmission System' containment reference list. + * + * + * @generated + * @ordered + */ + int POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Model' class. + * + * + * @generated + * @ordered + */ + int POWER_MODEL_FEATURE_COUNT = ModelPackage.ANALYSIS_ELEMENT_FEATURE_COUNT + 1; + + /** + * The operation id for the 'Is Leaf' operation. + * + * + * @generated + * @ordered + */ + int POWER_MODEL___IS_LEAF = ModelPackage.ANALYSIS_ELEMENT___IS_LEAF; + + /** + * The operation id for the 'Get Ordered Children' operation. + * + * + * @generated + * @ordered + */ + int POWER_MODEL___GET_ORDERED_CHILDREN = ModelPackage.ANALYSIS_ELEMENT___GET_ORDERED_CHILDREN; + + /** + * The number of operations of the 'Model' class. + * + * + * @generated + * @ordered + */ + int POWER_MODEL_OPERATION_COUNT = ModelPackage.ANALYSIS_ELEMENT_OPERATION_COUNT + 0; + + + /** + * Returns the meta object for class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement Element}'. + * + * + * @return the meta object for class 'Element'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerElement + * @generated + */ + EClass getPowerElement(); + + /** + * Returns the meta object for the attribute '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getCapacity Capacity}'. + * + * + * @return the meta object for the attribute 'Capacity'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getCapacity() + * @see #getPowerElement() + * @generated + */ + EAttribute getPowerElement_Capacity(); + + /** + * Returns the meta object for the attribute '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getBudget Budget}'. + * + * + * @return the meta object for the attribute 'Budget'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getBudget() + * @see #getPowerElement() + * @generated + */ + EAttribute getPowerElement_Budget(); + + /** + * Returns the meta object for the attribute '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getSupply Supply}'. + * + * + * @return the meta object for the attribute 'Supply'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerElement#getSupply() + * @see #getPowerElement() + * @generated + */ + EAttribute getPowerElement_Supply(); + + /** + * Returns the meta object for class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem Transmission System}'. + * + * + * @return the meta object for class 'Transmission System'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem + * @generated + */ + EClass getPowerTransmissionSystem(); + + /** + * Returns the meta object for the reference '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getComponentInstance Component Instance}'. + * + * + * @return the meta object for the reference 'Component Instance'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getComponentInstance() + * @see #getPowerTransmissionSystem() + * @generated + */ + EReference getPowerTransmissionSystem_ComponentInstance(); + + /** + * Returns the meta object for the containment reference list '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getSuppliers Suppliers}'. + * + * + * @return the meta object for the containment reference list 'Suppliers'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getSuppliers() + * @see #getPowerTransmissionSystem() + * @generated + */ + EReference getPowerTransmissionSystem_Suppliers(); + + /** + * Returns the meta object for the containment reference list '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getConsumers Consumers}'. + * + * + * @return the meta object for the containment reference list 'Consumers'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getConsumers() + * @see #getPowerTransmissionSystem() + * @generated + */ + EReference getPowerTransmissionSystem_Consumers(); + + /** + * Returns the meta object for class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier Supplier}'. + * + * + * @return the meta object for class 'Supplier'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier + * @generated + */ + EClass getPowerSupplier(); + + /** + * Returns the meta object for the reference '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier#getFeatureInstance Feature Instance}'. + * + * + * @return the meta object for the reference 'Feature Instance'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier#getFeatureInstance() + * @see #getPowerSupplier() + * @generated + */ + EReference getPowerSupplier_FeatureInstance(); + + /** + * Returns the meta object for class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer Consumer}'. + * + * + * @return the meta object for class 'Consumer'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer + * @generated + */ + EClass getPowerConsumer(); + + /** + * Returns the meta object for the reference '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer#getFeatureInstance Feature Instance}'. + * + * + * @return the meta object for the reference 'Feature Instance'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer#getFeatureInstance() + * @see #getPowerConsumer() + * @generated + */ + EReference getPowerConsumer_FeatureInstance(); + + /** + * Returns the meta object for class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerModel Model}'. + * + * + * @return the meta object for class 'Model'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerModel + * @generated + */ + EClass getPowerModel(); + + /** + * Returns the meta object for the containment reference list '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerModel#getRootPowerTransmissionSystem Root Power Transmission System}'. + * + * + * @return the meta object for the containment reference list 'Root Power Transmission System'. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerModel#getRootPowerTransmissionSystem() + * @see #getPowerModel() + * @generated + */ + EReference getPowerModel_RootPowerTransmissionSystem(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + PowerFactory getPowerFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
      + *
    • each class,
    • + *
    • each feature of each class,
    • + *
    • each operation of each class,
    • + *
    • each enum,
    • + *
    • and each data type
    • + *
    + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl Element}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerElement() + * @generated + */ + EClass POWER_ELEMENT = eINSTANCE.getPowerElement(); + + /** + * The meta object literal for the 'Capacity' attribute feature. + * + * + * @generated + */ + EAttribute POWER_ELEMENT__CAPACITY = eINSTANCE.getPowerElement_Capacity(); + + /** + * The meta object literal for the 'Budget' attribute feature. + * + * + * @generated + */ + EAttribute POWER_ELEMENT__BUDGET = eINSTANCE.getPowerElement_Budget(); + + /** + * The meta object literal for the 'Supply' attribute feature. + * + * + * @generated + */ + EAttribute POWER_ELEMENT__SUPPLY = eINSTANCE.getPowerElement_Supply(); + + /** + * The meta object literal for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl Transmission System}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerTransmissionSystem() + * @generated + */ + EClass POWER_TRANSMISSION_SYSTEM = eINSTANCE.getPowerTransmissionSystem(); + + /** + * The meta object literal for the 'Component Instance' reference feature. + * + * + * @generated + */ + EReference POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE = eINSTANCE.getPowerTransmissionSystem_ComponentInstance(); + + /** + * The meta object literal for the 'Suppliers' containment reference list feature. + * + * + * @generated + */ + EReference POWER_TRANSMISSION_SYSTEM__SUPPLIERS = eINSTANCE.getPowerTransmissionSystem_Suppliers(); + + /** + * The meta object literal for the 'Consumers' containment reference list feature. + * + * + * @generated + */ + EReference POWER_TRANSMISSION_SYSTEM__CONSUMERS = eINSTANCE.getPowerTransmissionSystem_Consumers(); + + /** + * The meta object literal for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerSupplierImpl Supplier}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerSupplierImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerSupplier() + * @generated + */ + EClass POWER_SUPPLIER = eINSTANCE.getPowerSupplier(); + + /** + * The meta object literal for the 'Feature Instance' reference feature. + * + * + * @generated + */ + EReference POWER_SUPPLIER__FEATURE_INSTANCE = eINSTANCE.getPowerSupplier_FeatureInstance(); + + /** + * The meta object literal for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerConsumerImpl Consumer}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerConsumerImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerConsumer() + * @generated + */ + EClass POWER_CONSUMER = eINSTANCE.getPowerConsumer(); + + /** + * The meta object literal for the 'Feature Instance' reference feature. + * + * + * @generated + */ + EReference POWER_CONSUMER__FEATURE_INSTANCE = eINSTANCE.getPowerConsumer_FeatureInstance(); + + /** + * The meta object literal for the '{@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerModelImpl Model}' class. + * + * + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerModelImpl + * @see org.osate.analysis.resource.budgets.internal.models.power.impl.PowerPackageImpl#getPowerModel() + * @generated + */ + EClass POWER_MODEL = eINSTANCE.getPowerModel(); + + /** + * The meta object literal for the 'Root Power Transmission System' containment reference list feature. + * + * + * @generated + */ + EReference POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM = eINSTANCE.getPowerModel_RootPowerTransmissionSystem(); + + } + +} //PowerPackage diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerSupplier.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerSupplier.java new file mode 100644 index 00000000000..219e9a114ab --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerSupplier.java @@ -0,0 +1,48 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.osate.aadl2.instance.FeatureInstance; + +/** + * + * A representation of the model object 'Supplier'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier#getFeatureInstance Feature Instance}
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerSupplier() + * @model + * @generated + * @since 4.1 + */ +public interface PowerSupplier extends PowerElement { + /** + * Returns the value of the 'Feature Instance' reference. + * + * + * @return the value of the 'Feature Instance' reference. + * @see #setFeatureInstance(FeatureInstance) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerSupplier_FeatureInstance() + * @model + * @generated + */ + FeatureInstance getFeatureInstance(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier#getFeatureInstance Feature Instance}' reference. + * + * + * @param value the new value of the 'Feature Instance' reference. + * @see #getFeatureInstance() + * @generated + */ + void setFeatureInstance(FeatureInstance value); + +} // PowerSupplier diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerTransmissionSystem.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerTransmissionSystem.java new file mode 100644 index 00000000000..1dbb7701743 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/PowerTransmissionSystem.java @@ -0,0 +1,75 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power; + +import org.eclipse.emf.common.util.EList; +import org.osate.aadl2.instance.ComponentInstance; + +/** + * + * A representation of the model object 'Transmission System'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getComponentInstance Component Instance}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getSuppliers Suppliers}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getConsumers Consumers}
    • + *
    + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerTransmissionSystem() + * @model + * @generated + * @since 4.1 + */ +public interface PowerTransmissionSystem extends PowerElement { + /** + * Returns the value of the 'Component Instance' reference. + * + * + * @return the value of the 'Component Instance' reference. + * @see #setComponentInstance(ComponentInstance) + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerTransmissionSystem_ComponentInstance() + * @model + * @generated + */ + ComponentInstance getComponentInstance(); + + /** + * Sets the value of the '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem#getComponentInstance Component Instance}' reference. + * + * + * @param value the new value of the 'Component Instance' reference. + * @see #getComponentInstance() + * @generated + */ + void setComponentInstance(ComponentInstance value); + + /** + * Returns the value of the 'Suppliers' containment reference list. + * The list contents are of type {@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier}. + * + * + * @return the value of the 'Suppliers' containment reference list. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerTransmissionSystem_Suppliers() + * @model containment="true" + * @generated + */ + EList getSuppliers(); + + /** + * Returns the value of the 'Consumers' containment reference list. + * The list contents are of type {@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer}. + * + * + * @return the value of the 'Consumers' containment reference list. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#getPowerTransmissionSystem_Consumers() + * @model containment="true" + * @generated + */ + EList getConsumers(); + +} // PowerTransmissionSystem diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerConsumerImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerConsumerImpl.java new file mode 100644 index 00000000000..b38c892498e --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerConsumerImpl.java @@ -0,0 +1,161 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.osate.aadl2.instance.FeatureInstance; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; + +/** + * + * An implementation of the model object 'Consumer'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerConsumerImpl#getFeatureInstance Feature Instance}
    • + *
    + * + * @generated + * @since 4.1 + */ +public class PowerConsumerImpl extends PowerElementImpl implements PowerConsumer { + /** + * The cached value of the '{@link #getFeatureInstance() Feature Instance}' reference. + * + * + * @see #getFeatureInstance() + * @generated + * @ordered + */ + protected FeatureInstance featureInstance; + + /** + * + * + * @generated + */ + protected PowerConsumerImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PowerPackage.Literals.POWER_CONSUMER; + } + + /** + * + * + * @generated + */ + @Override + public FeatureInstance getFeatureInstance() { + if (featureInstance != null && featureInstance.eIsProxy()) { + InternalEObject oldFeatureInstance = (InternalEObject)featureInstance; + featureInstance = (FeatureInstance)eResolveProxy(oldFeatureInstance); + if (featureInstance != oldFeatureInstance) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE, oldFeatureInstance, featureInstance)); + } + } + } + return featureInstance; + } + + /** + * + * + * @generated + */ + public FeatureInstance basicGetFeatureInstance() { + return featureInstance; + } + + /** + * + * + * @generated + */ + @Override + public void setFeatureInstance(FeatureInstance newFeatureInstance) { + FeatureInstance oldFeatureInstance = featureInstance; + featureInstance = newFeatureInstance; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE, oldFeatureInstance, featureInstance)); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE: + if (resolve) { + return getFeatureInstance(); + } + return basicGetFeatureInstance(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE: + setFeatureInstance((FeatureInstance)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE: + setFeatureInstance((FeatureInstance)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PowerPackage.POWER_CONSUMER__FEATURE_INSTANCE: + return featureInstance != null; + } + return super.eIsSet(featureID); + } + +} //PowerConsumerImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerElementImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerElementImpl.java new file mode 100644 index 00000000000..1de47e0dc38 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerElementImpl.java @@ -0,0 +1,281 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.osate.analysis.model.impl.AnalysisElementImpl; +import org.osate.analysis.resource.budgets.internal.models.power.PowerElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; + +/** + * + * An implementation of the model object 'Element'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl#getCapacity Capacity}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl#getBudget Budget}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerElementImpl#getSupply Supply}
    • + *
    + * + * @generated + * @since 4.1 + */ +public abstract class PowerElementImpl extends AnalysisElementImpl implements PowerElement { + /** + * The default value of the '{@link #getCapacity() Capacity}' attribute. + * + * + * @see #getCapacity() + * @generated + * @ordered + */ + protected static final double CAPACITY_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getCapacity() Capacity}' attribute. + * + * + * @see #getCapacity() + * @generated + * @ordered + */ + protected double capacity = CAPACITY_EDEFAULT; + + /** + * The default value of the '{@link #getBudget() Budget}' attribute. + * + * + * @see #getBudget() + * @generated + * @ordered + */ + protected static final double BUDGET_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getBudget() Budget}' attribute. + * + * + * @see #getBudget() + * @generated + * @ordered + */ + protected double budget = BUDGET_EDEFAULT; + + /** + * The default value of the '{@link #getSupply() Supply}' attribute. + * + * + * @see #getSupply() + * @generated + * @ordered + */ + protected static final double SUPPLY_EDEFAULT = 0.0; + + /** + * The cached value of the '{@link #getSupply() Supply}' attribute. + * + * + * @see #getSupply() + * @generated + * @ordered + */ + protected double supply = SUPPLY_EDEFAULT; + + /** + * + * + * @generated + */ + protected PowerElementImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PowerPackage.Literals.POWER_ELEMENT; + } + + /** + * + * + * @generated + */ + @Override + public double getCapacity() { + return capacity; + } + + /** + * + * + * @generated + */ + @Override + public void setCapacity(double newCapacity) { + double oldCapacity = capacity; + capacity = newCapacity; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_ELEMENT__CAPACITY, oldCapacity, capacity)); + } + } + + /** + * + * + * @generated + */ + @Override + public double getBudget() { + return budget; + } + + /** + * + * + * @generated + */ + @Override + public void setBudget(double newBudget) { + double oldBudget = budget; + budget = newBudget; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_ELEMENT__BUDGET, oldBudget, budget)); + } + } + + /** + * + * + * @generated + */ + @Override + public double getSupply() { + return supply; + } + + /** + * + * + * @generated + */ + @Override + public void setSupply(double newSupply) { + double oldSupply = supply; + supply = newSupply; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_ELEMENT__SUPPLY, oldSupply, supply)); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PowerPackage.POWER_ELEMENT__CAPACITY: + return getCapacity(); + case PowerPackage.POWER_ELEMENT__BUDGET: + return getBudget(); + case PowerPackage.POWER_ELEMENT__SUPPLY: + return getSupply(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PowerPackage.POWER_ELEMENT__CAPACITY: + setCapacity((Double)newValue); + return; + case PowerPackage.POWER_ELEMENT__BUDGET: + setBudget((Double)newValue); + return; + case PowerPackage.POWER_ELEMENT__SUPPLY: + setSupply((Double)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PowerPackage.POWER_ELEMENT__CAPACITY: + setCapacity(CAPACITY_EDEFAULT); + return; + case PowerPackage.POWER_ELEMENT__BUDGET: + setBudget(BUDGET_EDEFAULT); + return; + case PowerPackage.POWER_ELEMENT__SUPPLY: + setSupply(SUPPLY_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PowerPackage.POWER_ELEMENT__CAPACITY: + return capacity != CAPACITY_EDEFAULT; + case PowerPackage.POWER_ELEMENT__BUDGET: + return budget != BUDGET_EDEFAULT; + case PowerPackage.POWER_ELEMENT__SUPPLY: + return supply != SUPPLY_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (capacity: "); + result.append(capacity); + result.append(", budget: "); + result.append(budget); + result.append(", supply: "); + result.append(supply); + result.append(')'); + return result.toString(); + } + +} //PowerElementImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerFactoryImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerFactoryImpl.java new file mode 100644 index 00000000000..61d901d1a99 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerFactoryImpl.java @@ -0,0 +1,137 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerFactory; +import org.osate.analysis.resource.budgets.internal.models.power.PowerModel; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * An implementation of the model Factory. + * + * @generated + * @since 4.1 + */ +public class PowerFactoryImpl extends EFactoryImpl implements PowerFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static PowerFactory init() { + try { + PowerFactory thePowerFactory = (PowerFactory)EPackage.Registry.INSTANCE.getEFactory(PowerPackage.eNS_URI); + if (thePowerFactory != null) { + return thePowerFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new PowerFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public PowerFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM: return createPowerTransmissionSystem(); + case PowerPackage.POWER_SUPPLIER: return createPowerSupplier(); + case PowerPackage.POWER_CONSUMER: return createPowerConsumer(); + case PowerPackage.POWER_MODEL: return createPowerModel(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public PowerTransmissionSystem createPowerTransmissionSystem() { + PowerTransmissionSystemImpl powerTransmissionSystem = new PowerTransmissionSystemImpl(); + return powerTransmissionSystem; + } + + /** + * + * + * @generated + */ + @Override + public PowerSupplier createPowerSupplier() { + PowerSupplierImpl powerSupplier = new PowerSupplierImpl(); + return powerSupplier; + } + + /** + * + * + * @generated + */ + @Override + public PowerConsumer createPowerConsumer() { + PowerConsumerImpl powerConsumer = new PowerConsumerImpl(); + return powerConsumer; + } + + /** + * + * + * @generated + */ + @Override + public PowerModel createPowerModel() { + PowerModelImpl powerModel = new PowerModelImpl(); + return powerModel; + } + + /** + * + * + * @generated + */ + @Override + public PowerPackage getPowerPackage() { + return (PowerPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static PowerPackage getPackage() { + return PowerPackage.eINSTANCE; + } + +} //PowerFactoryImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerModelImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerModelImpl.java new file mode 100644 index 00000000000..78ef0f9cf1e --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerModelImpl.java @@ -0,0 +1,150 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.osate.analysis.model.impl.AnalysisElementImpl; +import org.osate.analysis.resource.budgets.internal.models.power.PowerModel; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * An implementation of the model object 'Model'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerModelImpl#getRootPowerTransmissionSystem Root Power Transmission System}
    • + *
    + * + * @generated + * @since 4.1 + */ +public class PowerModelImpl extends AnalysisElementImpl implements PowerModel { + /** + * The cached value of the '{@link #getRootPowerTransmissionSystem() Root Power Transmission System}' containment reference list. + * + * + * @see #getRootPowerTransmissionSystem() + * @generated + * @ordered + */ + protected EList rootPowerTransmissionSystem; + + /** + * + * + * @generated + */ + protected PowerModelImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PowerPackage.Literals.POWER_MODEL; + } + + /** + * + * + * @generated + */ + @Override + public EList getRootPowerTransmissionSystem() { + if (rootPowerTransmissionSystem == null) { + rootPowerTransmissionSystem = new EObjectContainmentEList(PowerTransmissionSystem.class, this, PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM); + } + return rootPowerTransmissionSystem; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM: + return ((InternalEList)getRootPowerTransmissionSystem()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM: + return getRootPowerTransmissionSystem(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM: + getRootPowerTransmissionSystem().clear(); + getRootPowerTransmissionSystem().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM: + getRootPowerTransmissionSystem().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PowerPackage.POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM: + return rootPowerTransmissionSystem != null && !rootPowerTransmissionSystem.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //PowerModelImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerPackageImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerPackageImpl.java new file mode 100644 index 00000000000..e19b30c0009 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerPackageImpl.java @@ -0,0 +1,388 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.osate.aadl2.Aadl2Package; +import org.osate.aadl2.instance.InstancePackage; +import org.osate.analysis.model.ModelPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerFactory; +import org.osate.analysis.resource.budgets.internal.models.power.PowerModel; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * An implementation of the model Package. + * + * @generated + * @since 4.1 + */ +public class PowerPackageImpl extends EPackageImpl implements PowerPackage { + /** + * + * + * @generated + */ + private EClass powerElementEClass = null; + + /** + * + * + * @generated + */ + private EClass powerTransmissionSystemEClass = null; + + /** + * + * + * @generated + */ + private EClass powerSupplierEClass = null; + + /** + * + * + * @generated + */ + private EClass powerConsumerEClass = null; + + /** + * + * + * @generated + */ + private EClass powerModelEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

    Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage#eNS_URI + * @see #init() + * @generated + */ + private PowerPackageImpl() { + super(eNS_URI, PowerFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

    This method is used to initialize {@link PowerPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static PowerPackage init() { + if (isInited) { + return (PowerPackage)EPackage.Registry.INSTANCE.getEPackage(PowerPackage.eNS_URI); + } + + // Obtain or create and register package + Object registeredPowerPackage = EPackage.Registry.INSTANCE.get(eNS_URI); + PowerPackageImpl thePowerPackage = registeredPowerPackage instanceof PowerPackageImpl ? (PowerPackageImpl)registeredPowerPackage : new PowerPackageImpl(); + + isInited = true; + + // Initialize simple dependencies + Aadl2Package.eINSTANCE.eClass(); + ModelPackage.eINSTANCE.eClass(); + InstancePackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thePowerPackage.createPackageContents(); + + // Initialize created meta-data + thePowerPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thePowerPackage.freeze(); + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(PowerPackage.eNS_URI, thePowerPackage); + return thePowerPackage; + } + + /** + * + * + * @generated + */ + @Override + public EClass getPowerElement() { + return powerElementEClass; + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getPowerElement_Capacity() { + return (EAttribute)powerElementEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getPowerElement_Budget() { + return (EAttribute)powerElementEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getPowerElement_Supply() { + return (EAttribute)powerElementEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EClass getPowerTransmissionSystem() { + return powerTransmissionSystemEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerTransmissionSystem_ComponentInstance() { + return (EReference)powerTransmissionSystemEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerTransmissionSystem_Suppliers() { + return (EReference)powerTransmissionSystemEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerTransmissionSystem_Consumers() { + return (EReference)powerTransmissionSystemEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + @Override + public EClass getPowerSupplier() { + return powerSupplierEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerSupplier_FeatureInstance() { + return (EReference)powerSupplierEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EClass getPowerConsumer() { + return powerConsumerEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerConsumer_FeatureInstance() { + return (EReference)powerConsumerEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public EClass getPowerModel() { + return powerModelEClass; + } + + /** + * + * + * @generated + */ + @Override + public EReference getPowerModel_RootPowerTransmissionSystem() { + return (EReference)powerModelEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + @Override + public PowerFactory getPowerFactory() { + return (PowerFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) { + return; + } + isCreated = true; + + // Create classes and their features + powerElementEClass = createEClass(POWER_ELEMENT); + createEAttribute(powerElementEClass, POWER_ELEMENT__CAPACITY); + createEAttribute(powerElementEClass, POWER_ELEMENT__BUDGET); + createEAttribute(powerElementEClass, POWER_ELEMENT__SUPPLY); + + powerTransmissionSystemEClass = createEClass(POWER_TRANSMISSION_SYSTEM); + createEReference(powerTransmissionSystemEClass, POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE); + createEReference(powerTransmissionSystemEClass, POWER_TRANSMISSION_SYSTEM__SUPPLIERS); + createEReference(powerTransmissionSystemEClass, POWER_TRANSMISSION_SYSTEM__CONSUMERS); + + powerSupplierEClass = createEClass(POWER_SUPPLIER); + createEReference(powerSupplierEClass, POWER_SUPPLIER__FEATURE_INSTANCE); + + powerConsumerEClass = createEClass(POWER_CONSUMER); + createEReference(powerConsumerEClass, POWER_CONSUMER__FEATURE_INSTANCE); + + powerModelEClass = createEClass(POWER_MODEL); + createEReference(powerModelEClass, POWER_MODEL__ROOT_POWER_TRANSMISSION_SYSTEM); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) { + return; + } + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + ModelPackage theModelPackage = (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI); + InstancePackage theInstancePackage = (InstancePackage)EPackage.Registry.INSTANCE.getEPackage(InstancePackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + powerElementEClass.getESuperTypes().add(theModelPackage.getAnalysisElement()); + powerTransmissionSystemEClass.getESuperTypes().add(this.getPowerElement()); + powerSupplierEClass.getESuperTypes().add(this.getPowerElement()); + powerConsumerEClass.getESuperTypes().add(this.getPowerElement()); + powerModelEClass.getESuperTypes().add(theModelPackage.getAnalysisElement()); + + // Initialize classes, features, and operations; add parameters + initEClass(powerElementEClass, PowerElement.class, "PowerElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPowerElement_Capacity(), ecorePackage.getEDouble(), "capacity", null, 0, 1, PowerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPowerElement_Budget(), ecorePackage.getEDouble(), "budget", null, 0, 1, PowerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPowerElement_Supply(), ecorePackage.getEDouble(), "supply", null, 0, 1, PowerElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(powerTransmissionSystemEClass, PowerTransmissionSystem.class, "PowerTransmissionSystem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPowerTransmissionSystem_ComponentInstance(), theInstancePackage.getComponentInstance(), null, "ComponentInstance", null, 0, 1, PowerTransmissionSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPowerTransmissionSystem_Suppliers(), this.getPowerSupplier(), null, "suppliers", null, 0, -1, PowerTransmissionSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPowerTransmissionSystem_Consumers(), this.getPowerConsumer(), null, "consumers", null, 0, -1, PowerTransmissionSystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(powerSupplierEClass, PowerSupplier.class, "PowerSupplier", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPowerSupplier_FeatureInstance(), theInstancePackage.getFeatureInstance(), null, "FeatureInstance", null, 0, 1, PowerSupplier.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(powerConsumerEClass, PowerConsumer.class, "PowerConsumer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPowerConsumer_FeatureInstance(), theInstancePackage.getFeatureInstance(), null, "FeatureInstance", null, 0, 1, PowerConsumer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(powerModelEClass, PowerModel.class, "PowerModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getPowerModel_RootPowerTransmissionSystem(), this.getPowerTransmissionSystem(), null, "rootPowerTransmissionSystem", null, 0, -1, PowerModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //PowerPackageImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerSupplierImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerSupplierImpl.java new file mode 100644 index 00000000000..f4be6240980 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerSupplierImpl.java @@ -0,0 +1,161 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.osate.aadl2.instance.FeatureInstance; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; + +/** + * + * An implementation of the model object 'Supplier'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerSupplierImpl#getFeatureInstance Feature Instance}
    • + *
    + * + * @generated + * @since 4.1 + */ +public class PowerSupplierImpl extends PowerElementImpl implements PowerSupplier { + /** + * The cached value of the '{@link #getFeatureInstance() Feature Instance}' reference. + * + * + * @see #getFeatureInstance() + * @generated + * @ordered + */ + protected FeatureInstance featureInstance; + + /** + * + * + * @generated + */ + protected PowerSupplierImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PowerPackage.Literals.POWER_SUPPLIER; + } + + /** + * + * + * @generated + */ + @Override + public FeatureInstance getFeatureInstance() { + if (featureInstance != null && featureInstance.eIsProxy()) { + InternalEObject oldFeatureInstance = (InternalEObject)featureInstance; + featureInstance = (FeatureInstance)eResolveProxy(oldFeatureInstance); + if (featureInstance != oldFeatureInstance) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE, oldFeatureInstance, featureInstance)); + } + } + } + return featureInstance; + } + + /** + * + * + * @generated + */ + public FeatureInstance basicGetFeatureInstance() { + return featureInstance; + } + + /** + * + * + * @generated + */ + @Override + public void setFeatureInstance(FeatureInstance newFeatureInstance) { + FeatureInstance oldFeatureInstance = featureInstance; + featureInstance = newFeatureInstance; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE, oldFeatureInstance, featureInstance)); + } + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE: + if (resolve) { + return getFeatureInstance(); + } + return basicGetFeatureInstance(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE: + setFeatureInstance((FeatureInstance)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE: + setFeatureInstance((FeatureInstance)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PowerPackage.POWER_SUPPLIER__FEATURE_INSTANCE: + return featureInstance != null; + } + return super.eIsSet(featureID); + } + +} //PowerSupplierImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerTransmissionSystemImpl.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerTransmissionSystemImpl.java new file mode 100644 index 00000000000..76e98e8a4b2 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/impl/PowerTransmissionSystemImpl.java @@ -0,0 +1,256 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.osate.aadl2.instance.ComponentInstance; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * An implementation of the model object 'Transmission System'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl#getComponentInstance Component Instance}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl#getSuppliers Suppliers}
    • + *
    • {@link org.osate.analysis.resource.budgets.internal.models.power.impl.PowerTransmissionSystemImpl#getConsumers Consumers}
    • + *
    + * + * @generated + * @since 4.1 + */ +public class PowerTransmissionSystemImpl extends PowerElementImpl implements PowerTransmissionSystem { + /** + * The cached value of the '{@link #getComponentInstance() Component Instance}' reference. + * + * + * @see #getComponentInstance() + * @generated + * @ordered + */ + protected ComponentInstance componentInstance; + + /** + * The cached value of the '{@link #getSuppliers() Suppliers}' containment reference list. + * + * + * @see #getSuppliers() + * @generated + * @ordered + */ + protected EList suppliers; + + /** + * The cached value of the '{@link #getConsumers() Consumers}' containment reference list. + * + * + * @see #getConsumers() + * @generated + * @ordered + */ + protected EList consumers; + + /** + * + * + * @generated + */ + protected PowerTransmissionSystemImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return PowerPackage.Literals.POWER_TRANSMISSION_SYSTEM; + } + + /** + * + * + * @generated + */ + @Override + public ComponentInstance getComponentInstance() { + if (componentInstance != null && componentInstance.eIsProxy()) { + InternalEObject oldComponentInstance = (InternalEObject)componentInstance; + componentInstance = (ComponentInstance)eResolveProxy(oldComponentInstance); + if (componentInstance != oldComponentInstance) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE, oldComponentInstance, componentInstance)); + } + } + } + return componentInstance; + } + + /** + * + * + * @generated + */ + public ComponentInstance basicGetComponentInstance() { + return componentInstance; + } + + /** + * + * + * @generated + */ + @Override + public void setComponentInstance(ComponentInstance newComponentInstance) { + ComponentInstance oldComponentInstance = componentInstance; + componentInstance = newComponentInstance; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE, oldComponentInstance, componentInstance)); + } + } + + /** + * + * + * @generated + */ + @Override + public EList getSuppliers() { + if (suppliers == null) { + suppliers = new EObjectContainmentEList(PowerSupplier.class, this, PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS); + } + return suppliers; + } + + /** + * + * + * @generated + */ + @Override + public EList getConsumers() { + if (consumers == null) { + consumers = new EObjectContainmentEList(PowerConsumer.class, this, PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS); + } + return consumers; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS: + return ((InternalEList)getSuppliers()).basicRemove(otherEnd, msgs); + case PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS: + return ((InternalEList)getConsumers()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE: + if (resolve) { + return getComponentInstance(); + } + return basicGetComponentInstance(); + case PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS: + return getSuppliers(); + case PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS: + return getConsumers(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE: + setComponentInstance((ComponentInstance)newValue); + return; + case PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS: + getSuppliers().clear(); + getSuppliers().addAll((Collection)newValue); + return; + case PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS: + getConsumers().clear(); + getConsumers().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE: + setComponentInstance((ComponentInstance)null); + return; + case PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS: + getSuppliers().clear(); + return; + case PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS: + getConsumers().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case PowerPackage.POWER_TRANSMISSION_SYSTEM__COMPONENT_INSTANCE: + return componentInstance != null; + case PowerPackage.POWER_TRANSMISSION_SYSTEM__SUPPLIERS: + return suppliers != null && !suppliers.isEmpty(); + case PowerPackage.POWER_TRANSMISSION_SYSTEM__CONSUMERS: + return consumers != null && !consumers.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //PowerTransmissionSystemImpl diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerAdapterFactory.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerAdapterFactory.java new file mode 100644 index 00000000000..db1ecec0046 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerAdapterFactory.java @@ -0,0 +1,215 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.osate.analysis.model.AnalysisElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerModel; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage + * @generated + * @since 4.1 + */ +public class PowerAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static PowerPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public PowerAdapterFactory() { + if (modelPackage == null) { + modelPackage = PowerPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected PowerSwitch modelSwitch = + new PowerSwitch() { + @Override + public Adapter casePowerElement(PowerElement object) { + return createPowerElementAdapter(); + } + @Override + public Adapter casePowerTransmissionSystem(PowerTransmissionSystem object) { + return createPowerTransmissionSystemAdapter(); + } + @Override + public Adapter casePowerSupplier(PowerSupplier object) { + return createPowerSupplierAdapter(); + } + @Override + public Adapter casePowerConsumer(PowerConsumer object) { + return createPowerConsumerAdapter(); + } + @Override + public Adapter casePowerModel(PowerModel object) { + return createPowerModelAdapter(); + } + @Override + public Adapter caseAnalysisElement(AnalysisElement object) { + return createAnalysisElementAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerElement Element}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerElement + * @generated + */ + public Adapter createPowerElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem Transmission System}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem + * @generated + */ + public Adapter createPowerTransmissionSystemAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier Supplier}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier + * @generated + */ + public Adapter createPowerSupplierAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer Consumer}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer + * @generated + */ + public Adapter createPowerConsumerAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.resource.budgets.internal.models.power.PowerModel Model}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerModel + * @generated + */ + public Adapter createPowerModelAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.osate.analysis.model.AnalysisElement Analysis Element}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.osate.analysis.model.AnalysisElement + * @generated + */ + public Adapter createAnalysisElementAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //PowerAdapterFactory diff --git a/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerSwitch.java b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerSwitch.java new file mode 100644 index 00000000000..1bb9eefd1c0 --- /dev/null +++ b/analyses/org.osate.analysis.resource.budgets/src-gen/org/osate/analysis/resource/budgets/internal/models/power/util/PowerSwitch.java @@ -0,0 +1,249 @@ +/** + * Copyright Text Copyright (c) 2004-2021 Carnegie Mellon University and others. (see Contributors file).... + */ +package org.osate.analysis.resource.budgets.internal.models.power.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.osate.analysis.model.AnalysisElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerConsumer; +import org.osate.analysis.resource.budgets.internal.models.power.PowerElement; +import org.osate.analysis.resource.budgets.internal.models.power.PowerModel; +import org.osate.analysis.resource.budgets.internal.models.power.PowerPackage; +import org.osate.analysis.resource.budgets.internal.models.power.PowerSupplier; +import org.osate.analysis.resource.budgets.internal.models.power.PowerTransmissionSystem; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.osate.analysis.resource.budgets.internal.models.power.PowerPackage + * @generated + * @since 4.1 + */ +public class PowerSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static PowerPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public PowerSwitch() { + if (modelPackage == null) { + modelPackage = PowerPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case PowerPackage.POWER_ELEMENT: { + PowerElement powerElement = (PowerElement)theEObject; + T result = casePowerElement(powerElement); + if (result == null) { + result = caseAnalysisElement(powerElement); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PowerPackage.POWER_TRANSMISSION_SYSTEM: { + PowerTransmissionSystem powerTransmissionSystem = (PowerTransmissionSystem)theEObject; + T result = casePowerTransmissionSystem(powerTransmissionSystem); + if (result == null) { + result = casePowerElement(powerTransmissionSystem); + } + if (result == null) { + result = caseAnalysisElement(powerTransmissionSystem); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PowerPackage.POWER_SUPPLIER: { + PowerSupplier powerSupplier = (PowerSupplier)theEObject; + T result = casePowerSupplier(powerSupplier); + if (result == null) { + result = casePowerElement(powerSupplier); + } + if (result == null) { + result = caseAnalysisElement(powerSupplier); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PowerPackage.POWER_CONSUMER: { + PowerConsumer powerConsumer = (PowerConsumer)theEObject; + T result = casePowerConsumer(powerConsumer); + if (result == null) { + result = casePowerElement(powerConsumer); + } + if (result == null) { + result = caseAnalysisElement(powerConsumer); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case PowerPackage.POWER_MODEL: { + PowerModel powerModel = (PowerModel)theEObject; + T result = casePowerModel(powerModel); + if (result == null) { + result = caseAnalysisElement(powerModel); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Element'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Element'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePowerElement(PowerElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Transmission System'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Transmission System'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePowerTransmissionSystem(PowerTransmissionSystem object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Supplier'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Supplier'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePowerSupplier(PowerSupplier object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Consumer'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Consumer'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePowerConsumer(PowerConsumer object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Model'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Model'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePowerModel(PowerModel object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Analysis Element'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Analysis Element'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAnalysisElement(AnalysisElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //PowerSwitch diff --git a/analyses/org.osate.plugins.feature/feature.xml b/analyses/org.osate.plugins.feature/feature.xml index 2b458b4d201..987d6e933a2 100644 --- a/analyses/org.osate.plugins.feature/feature.xml +++ b/analyses/org.osate.plugins.feature/feature.xml @@ -2,7 +2,7 @@ org.osate org.osate.plugins.feature - 6.1.0-SNAPSHOT + 6.2.0-SNAPSHOT eclipse-feature From e9e1423968002100be5faf7c94737139c97fdf63 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Tue, 13 Jul 2021 13:52:09 -0400 Subject: [PATCH 22/23] fix versions --- core/org.osate.help/META-INF/MANIFEST.MF | 2 +- core/org.osate.help/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/org.osate.help/META-INF/MANIFEST.MF b/core/org.osate.help/META-INF/MANIFEST.MF index 4d3f0f9d77f..72a547e8dee 100644 --- a/core/org.osate.help/META-INF/MANIFEST.MF +++ b/core/org.osate.help/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.osate.help;singleton:=true -Bundle-Version: 2.10.0.qualifier +Bundle-Version: 2.10.1.qualifier Bundle-Vendor: CMU/SEI Bundle-Localization: plugin Require-Bundle: org.eclipse.help;bundle-version="[3.8.0,4.0.0)" diff --git a/core/org.osate.help/pom.xml b/core/org.osate.help/pom.xml index 4baff46f463..3bea5c7b3f0 100644 --- a/core/org.osate.help/pom.xml +++ b/core/org.osate.help/pom.xml @@ -12,7 +12,7 @@ org.osate org.osate.help - 2.10.0-SNAPSHOT + 2.10.1-SNAPSHOT eclipse-plugin From 2360fd501622f9edaf1a9e86f0ea2c970e274242 Mon Sep 17 00:00:00 2001 From: Anna Sazonova Date: Tue, 13 Jul 2021 14:42:22 -0400 Subject: [PATCH 23/23] revert manifests --- .../META-INF/MANIFEST.MF | 10 +++++----- core/org.osate.help/META-INF/MANIFEST.MF | 2 +- core/org.osate.help/pom.xml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF index e14b6f04b65..2cf8640bc50 100644 --- a/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF +++ b/analyses/org.osate.analysis.resource.budgets/META-INF/MANIFEST.MF @@ -1,24 +1,24 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName +Bundle-Name: Resource Analysis Plug-in Bundle-SymbolicName: org.osate.analysis.resource.budgets;singleton:=true Bundle-Version: 4.1.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.osate.analysis.resource.budgets.ResourceBudgetPlugin -Bundle-Vendor: %providerName +Bundle-Vendor: CMU/SEI Bundle-Localization: plugin Require-Bundle: org.eclipse.ui;bundle-version="[3.115.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.17.0,4.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)";visibility:=reexport, + org.eclipse.emf.ecore;bundle-version="[2.20.0,3.0.0)", org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)", - org.osate.aadl2;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, + org.osate.aadl2;bundle-version="[4.0.0,5.0.0)", org.osate.ui;bundle-version="[6.1.0,7.0.0)", org.osate.aadl2.modelsupport;bundle-version="[6.0.0,7.0.0)", org.osate.xtext.aadl2.properties;bundle-version="[3.0.0,4.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.results;bundle-version="[2.0.0,3.0.0)", - org.osate.analysis.model;bundle-version="[1.0.0,2.0.0)";visibility:=reexport + org.osate.analysis.model;bundle-version="[1.0.0,2.0.0)" Bundle-ActivationPolicy: lazy Export-Package: org.osate.analysis.resource.budgets, org.osate.analysis.resource.budgets.busload, diff --git a/core/org.osate.help/META-INF/MANIFEST.MF b/core/org.osate.help/META-INF/MANIFEST.MF index 72a547e8dee..4d3f0f9d77f 100644 --- a/core/org.osate.help/META-INF/MANIFEST.MF +++ b/core/org.osate.help/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.osate.help;singleton:=true -Bundle-Version: 2.10.1.qualifier +Bundle-Version: 2.10.0.qualifier Bundle-Vendor: CMU/SEI Bundle-Localization: plugin Require-Bundle: org.eclipse.help;bundle-version="[3.8.0,4.0.0)" diff --git a/core/org.osate.help/pom.xml b/core/org.osate.help/pom.xml index 3bea5c7b3f0..4baff46f463 100644 --- a/core/org.osate.help/pom.xml +++ b/core/org.osate.help/pom.xml @@ -12,7 +12,7 @@ org.osate org.osate.help - 2.10.1-SNAPSHOT + 2.10.0-SNAPSHOT eclipse-plugin