Skip to content
Snippets Groups Projects
Commit 117e6473 authored by Sergey Zverlov's avatar Sergey Zverlov
Browse files

refs 2505
parent f1870a64
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,10 @@ Require-Bundle: org.fortiss.af3.project, ...@@ -17,7 +17,10 @@ Require-Bundle: org.fortiss.af3.project,
org.fortiss.af3.platform;bundle-version="2.5.0";visibility:=reexport, org.fortiss.af3.platform;bundle-version="2.5.0";visibility:=reexport,
org.fortiss.tooling.base;visibility:=reexport, org.fortiss.tooling.base;visibility:=reexport,
org.fortiss.af3.expression, org.fortiss.af3.expression,
org.eclipse.jface;bundle-version="3.9.1" org.eclipse.jface;bundle-version="3.9.1",
org.fortiss.af3.deployment,
org.fortiss.af3.component,
org.fortiss.af3.analyses
Export-Package: org.fortiss.af3.platform.raspberry.compositor, Export-Package: org.fortiss.af3.platform.raspberry.compositor,
org.fortiss.af3.platform.raspberry.model, org.fortiss.af3.platform.raspberry.model,
org.fortiss.af3.platform.raspberry.model.impl, org.fortiss.af3.platform.raspberry.model.impl,
......
...@@ -18,15 +18,20 @@ $Id$ ...@@ -18,15 +18,20 @@ $Id$
package org.fortiss.af3.platform.raspberry.generator.executable; package org.fortiss.af3.platform.raspberry.generator.executable;
import static org.fortiss.af3.generator.common.utils.SourceModelElementFactory.createStaticContentSourceUnit; import static org.fortiss.af3.generator.common.utils.SourceModelElementFactory.createStaticContentSourceUnit;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryUtils.getEcuForComponent;
import static org.fortiss.af3.platform.raspberry.utils.RaspberryUtils.getTargetComponent;
import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.findElementById;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.fortiss.af3.bounds.model.VariableBoundsSpecification;
import org.fortiss.af3.component.model.Component; import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.InputPort;
import org.fortiss.af3.component.model.OutputPort; import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.component.model.Port; import org.fortiss.af3.component.model.Port;
import org.fortiss.af3.component.model.PortSpecification; import org.fortiss.af3.component.model.PortSpecification;
import org.fortiss.af3.deployment.model.ComponentAllocation;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.generator.common.model.source.SourcePackage; import org.fortiss.af3.generator.common.model.source.SourcePackage;
import org.fortiss.af3.platform.language.executable.TransmissionUnitExecutableBase; import org.fortiss.af3.platform.language.executable.TransmissionUnitExecutableBase;
import org.fortiss.af3.platform.model.ExecutionUnit; import org.fortiss.af3.platform.model.ExecutionUnit;
...@@ -55,52 +60,48 @@ public class BusExecutable extends TransmissionUnitExecutableBase<TransmissionUn ...@@ -55,52 +60,48 @@ public class BusExecutable extends TransmissionUnitExecutableBase<TransmissionUn
public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair, public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair,
Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent, Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
int deploymentID) { int deploymentID) {
checkTypesOfOutputPorts(pack, euPortsPair); findBusSignals(deploymentID, topComponent, pack);
} }
/** Collects the information about type and bounds of all OutputPorts. */ /** Finds Information about Signals that are transmitted over the Bus. */
public void checkTypesOfOutputPorts(SourcePackage pack, public void findBusSignals(int deploymentID, Component topComponent, SourcePackage pack) {
Map<ExecutionUnit, List<Port>> portsToCheck) { String resultString = "";
Deployment currentDeployment =
// TODO: Look at all ports, which are OutputPorts (instanceof OutputPort) (Deployment)findElementById(deploymentID, topComponent.eContainer().eContainer());
// save for each port the type (i.e.: int) and the upper+lower bounds for(ComponentAllocation allocation : currentDeployment.getComponentAllocations()) {
// create a simple string template for the output Component c1 = allocation.getComponent();
// String Keys; for(Object port : c1.getConnectors()) {
String logPortSpecs = new String(); if(port instanceof OutputPort) {
String portName = new String(); for(Component c2 : getTargetComponent((OutputPort)port)) {
String portType = new String(); if(getEcuForComponent(c1, currentDeployment) != getEcuForComponent(c2,
currentDeployment) &&
Object[] ecus = portsToCheck.keySet().toArray(); getEcuForComponent(c2, currentDeployment) != null) {
for(Object ecu : ecus) { // Iterate over number of Cores resultString += "Name: " + ((OutputPort)port).getName() + ", ";
for(Object port : portsToCheck.get(ecu)) { // Iterate over Number of Ports. for(Object specs : ((OutputPort)port).getSpecifications()) {
if(port instanceof InputPort) { if(specs instanceof PortSpecification) {
portName = ((InputPort)port).getName(); PortSpecification portSpec = (PortSpecification)specs;
PortSpecification portSpecIn = resultString += "Type: " + portSpec.getType() + ", ";
(PortSpecification)((InputPort)port).getSpecifications().get(0); }
portType = portSpecIn.getType().toString(); if(specs instanceof VariableBoundsSpecification) {
// logPortSpecification(portName, portSpecIn, "Input"); VariableBoundsSpecification varBoundSpec =
logPortSpecs += (VariableBoundsSpecification)specs;
"Input PortName: " + portName + "\nType: " + portType + "\n\n"; resultString +=
"From: " + varBoundSpec.getLowerBound() + " To: " +
} else if(port instanceof OutputPort) { varBoundSpec.getUpperBound() + " ";
portName = ((OutputPort)port).getName(); }
PortSpecification portSpecOut = }
(PortSpecification)((OutputPort)port).getSpecifications().get(0); resultString += "\n";
portType = portSpecOut.getType().toString(); }
// logPortSpecification(portName, portSpecOut, "Output"); }
logPortSpecs +=
"Output PortName: " + portName + "\nType: " + portType + "\n\n";
} else {
System.out.println("Not a port!");
} }
} }
} }
RaspberryPortTypeGeneration rspPortInfoGen = new RaspberryPortTypeGeneration(logPortSpecs);
RaspberryPortTypeGeneration rspPortInfoGen = new RaspberryPortTypeGeneration(resultString);
rspPortInfoGen.createInfofile(); rspPortInfoGen.createInfofile();
pack.addUnit(createStaticContentSourceUnit("PortSpecifications", pack.addUnit(createStaticContentSourceUnit("PortSpecifications",
rspPortInfoGen.getContent(), false)); rspPortInfoGen.getContent(), false));
System.out.print(resultString);
} }
} }
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.platform.raspberry.utils;
import java.util.ArrayList;
import java.util.List;
import org.fortiss.af3.component.model.Channel;
import org.fortiss.af3.component.model.Component;
import org.fortiss.af3.component.model.OutputPort;
import org.fortiss.af3.deployment.model.ComponentAllocation;
import org.fortiss.af3.deployment.model.Deployment;
import org.fortiss.af3.platform.model.ExecutionUnit;
/**
*
* @author zverlov
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public class RaspberryUtils {
/** Return the target @{link {@link Component} of the an {@link OutputPort}. */
public static List<Component> getTargetComponent(OutputPort out) {
ArrayList<Component> result = new ArrayList<Component>();
for(Channel chan : out.getOutgoingChannels()) {
result.add(chan.getTarget().getComponent());
}
return result;
}
/** Returns the @{link {@link ExecutionUnit} where a @{link {@link Component} is deployed. */
public static ExecutionUnit getEcuForComponent(Component c1, Deployment deploy) {
for(ComponentAllocation allocaitons : deploy.getComponentAllocations()) {
if(allocaitons.getComponent() == c1) {
return allocaitons.getExecutionUnit();
}
}
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment