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,
org.fortiss.af3.platform;bundle-version="2.5.0";visibility:=reexport,
org.fortiss.tooling.base;visibility:=reexport,
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,
org.fortiss.af3.platform.raspberry.model,
org.fortiss.af3.platform.raspberry.model.impl,
......
......@@ -18,15 +18,20 @@ $Id$
package org.fortiss.af3.platform.raspberry.generator.executable;
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.Map;
import org.fortiss.af3.bounds.model.VariableBoundsSpecification;
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.Port;
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.platform.language.executable.TransmissionUnitExecutableBase;
import org.fortiss.af3.platform.model.ExecutionUnit;
......@@ -55,52 +60,48 @@ public class BusExecutable extends TransmissionUnitExecutableBase<TransmissionUn
public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair,
Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
int deploymentID) {
checkTypesOfOutputPorts(pack, euPortsPair);
findBusSignals(deploymentID, topComponent, pack);
}
/** Collects the information about type and bounds of all OutputPorts. */
public void checkTypesOfOutputPorts(SourcePackage pack,
Map<ExecutionUnit, List<Port>> portsToCheck) {
// TODO: Look at all ports, which are OutputPorts (instanceof OutputPort)
// save for each port the type (i.e.: int) and the upper+lower bounds
// create a simple string template for the output
// String Keys;
String logPortSpecs = new String();
String portName = new String();
String portType = new String();
Object[] ecus = portsToCheck.keySet().toArray();
for(Object ecu : ecus) { // Iterate over number of Cores
for(Object port : portsToCheck.get(ecu)) { // Iterate over Number of Ports.
if(port instanceof InputPort) {
portName = ((InputPort)port).getName();
PortSpecification portSpecIn =
(PortSpecification)((InputPort)port).getSpecifications().get(0);
portType = portSpecIn.getType().toString();
// logPortSpecification(portName, portSpecIn, "Input");
logPortSpecs +=
"Input PortName: " + portName + "\nType: " + portType + "\n\n";
} else if(port instanceof OutputPort) {
portName = ((OutputPort)port).getName();
PortSpecification portSpecOut =
(PortSpecification)((OutputPort)port).getSpecifications().get(0);
portType = portSpecOut.getType().toString();
// logPortSpecification(portName, portSpecOut, "Output");
logPortSpecs +=
"Output PortName: " + portName + "\nType: " + portType + "\n\n";
} else {
System.out.println("Not a port!");
/** Finds Information about Signals that are transmitted over the Bus. */
public void findBusSignals(int deploymentID, Component topComponent, SourcePackage pack) {
String resultString = "";
Deployment currentDeployment =
(Deployment)findElementById(deploymentID, topComponent.eContainer().eContainer());
for(ComponentAllocation allocation : currentDeployment.getComponentAllocations()) {
Component c1 = allocation.getComponent();
for(Object port : c1.getConnectors()) {
if(port instanceof OutputPort) {
for(Component c2 : getTargetComponent((OutputPort)port)) {
if(getEcuForComponent(c1, currentDeployment) != getEcuForComponent(c2,
currentDeployment) &&
getEcuForComponent(c2, currentDeployment) != null) {
resultString += "Name: " + ((OutputPort)port).getName() + ", ";
for(Object specs : ((OutputPort)port).getSpecifications()) {
if(specs instanceof PortSpecification) {
PortSpecification portSpec = (PortSpecification)specs;
resultString += "Type: " + portSpec.getType() + ", ";
}
if(specs instanceof VariableBoundsSpecification) {
VariableBoundsSpecification varBoundSpec =
(VariableBoundsSpecification)specs;
resultString +=
"From: " + varBoundSpec.getLowerBound() + " To: " +
varBoundSpec.getUpperBound() + " ";
}
}
resultString += "\n";
}
}
}
}
}
RaspberryPortTypeGeneration rspPortInfoGen = new RaspberryPortTypeGeneration(logPortSpecs);
RaspberryPortTypeGeneration rspPortInfoGen = new RaspberryPortTypeGeneration(resultString);
rspPortInfoGen.createInfofile();
pack.addUnit(createStaticContentSourceUnit("PortSpecifications",
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