Skip to content
Snippets Groups Projects
Commit 65d2c740 authored by Sebastian Ebert's avatar Sebastian Ebert
Browse files

service example, service keys, documentation

parent 576402b5
No related branches found
No related tags found
No related merge requests found
# pnml-relast-splitter
# Petri Net Splitter Tool
* Currently not supported: reference-places and reference transitions
\ No newline at end of file
This is the 3rd tool of the DiNeROS model driven tool chain. The input of this tool as an (extended) PNML-described Global ROS Petri Net.
Based on the localization information contained in the corresponding subnets for target ROS node is created, theses subnets are containing special transitions and places respresenting the inputs and outputs of ROS publishers/subscribers or and service clients and servers.
## The Programflow
1. Global ROS Petri Net (**PNML**)
2. Parsed Representation (**Jastadd**)
3. Splitted Local ROS Petri Net (**Jastadd**)
4. Splitted Local ROS Petri Net (**PNML**)
## How Publisher and subscribers are transformed
1. Get location/subnet of source/target - places
2. Create new source and target Transition
3. Attributized infos need to be written back to XML
4. Reconnect Input Signals
5. Get all incoming arcs and connect them to new output transition
6. Gel all outgoing arcs and connect them to new input transition
7. Add new transitions to net
8. Remove "old transition"
## How Service Clients and Servers are tranformed
TBD
## Currently not supported pnml features
* reference-places and reference transitions
\ No newline at end of file
......@@ -2,27 +2,48 @@ package de.tudresden.inf.st.constants;
public final class PnmlConstants {
// general transitions
public static final String TRANSITION_TYPE_DISCRETE = "discreteTransitionType";
public static final String TRANSITION_TYPE_CONTINUOUS = "continuousTransitionType";
// topic transitions
public static final String TRANSITION_TYPE_TOPIC = "topicTransitionType";
public static final String TRANSITION_TOPIC_TYPE_LIMITED_IN = "limitedChannelInType";
public static final String TRANSITION_TOPIC_TYPE_UNLIMITED_IN = "unlimitedChannelInType";
public static final String TRANSITION_TYPE_TOPIC_LIMITED_IN = "limitedChannelInType";
public static final String TRANSITION_TYPE_TOPIC_UNLIMITED_IN = "unlimitedChannelInType";
public static final String TRANSITION_TOPIC_TYPE_LIMITED_OUT = "limitedChannelOutType";
public static final String TRANSITION_TOPIC_TYPE_UNLIMITED_OUT = "unlimitedChannelOutType";
public static final String TRANSITION_TYPE_TOPIC_LIMITED_OUT = "limitedChannelOutType";
public static final String TRANSITION_TYPE_TOPIC_UNLIMITED_OUT = "unlimitedChannelOutType";
// service transitions
public static final String TRANSITION_TYPE_SERVICE_REQUEST = "serviceTransitionTypeRequest";
public static final String TRANSITION_TYPE_SERVICE_RESPONSE = "serviceTransitionTypeResponse";
public static final String TRANSITION_TYPE_SERVICE_REQUEST_IN = "serviceTransitionRequestIn";
public static final String TRANSITION_TYPE_SERVICE_REQUEST_OUT = "serviceTransitionRequestOut";
public static final String TRANSITION_TYPE_SERVICE_RESPONSE_IN = "serviceTransitionResponseIn";
public static final String TRANSITION_TYPE_SERVICE_RESPONSE_OUT = "serviceTransitionResponseOut";
// place types
public static final String PLACE_TYPE_DISCRETE = "discretePlaceType";
public static final String PLACE_TYPE_CONTINUOUS = "continuousPlaceType";
// general properties
public static final String LOCATION_KEY = "location";
public static final String TYPE_KEY = "type";
// service related keys
public static final String SERVICE_NAME = "serviceName";
public static final String SERVICE_INSTANCE = "serviceInstance";
// pub-sub related keys
public static final String INPUT_LIMIT_KEY = "inputlimit";
public static final String OUTPUT_LIMIT_KEY = "outputlimit";
public static final String SUBNET_KEY = "subnet";
public static final String TOPIC_KEY = "topic";
// bindings
public static final String INPUT_SIGNAL_BINDINGS_KEY = "inputsignalbindings";
public static final String OUTPUT_SIGNAL_BINDINGS_KEY = "outputsignalbindings";
......@@ -37,7 +58,7 @@ public final class PnmlConstants {
public static final String EQUAL_OS_KEY = "equal";
public static final String RANGE_OS_KEY = "range";
public static final String TRESHOLD_KEY = "threshold";
public static final String THRESHOLD_KEY = "threshold";
public static final String VALUE_KEY = "value";
public static final String RESULT_KEY = "result";
......
......@@ -5,7 +5,6 @@ import de.tudresden.inf.st.pnml.jastadd.model.JastAddList;
import de.tudresden.inf.st.pnml.jastadd.model.PlaceInformation;
import de.tudresden.inf.st.pnml.jastadd.model.ToolInfo;
import javax.tools.Tool;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
......@@ -78,8 +77,8 @@ public class ToolSpecificsParser {
if (typeList.getLength() > 0 && typeList.item(0) != null) {
String type = typeList.item(0).getTextContent();
if (type.equals(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_IN) || type.equals(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_OUT)
|| type.equals(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_IN) || type.equals(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_OUT)
if (type.equals(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_IN) || type.equals(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_OUT)
|| type.equals(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_IN) || type.equals(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_OUT)
|| type.equals(PnmlConstants.TRANSITION_TYPE_TOPIC)) {
NodeList topicList = doc.getElementsByTagName(PnmlConstants.TOPIC_KEY);
......
......@@ -138,13 +138,13 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
if (channelIst.getStaticTransitionInformation().getInputLimit() >= 0) {
tInfoSource.setType(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_OUT);
inputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_OUT, inLocation, inSubNet, tInfoSource.getTopic(),
tInfoSource.setType(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_OUT);
inputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_OUT, inLocation, inSubNet, tInfoSource.getTopic(),
channelIst.getStaticTransitionInformation().getInputLimit(), channelIst.getStaticTransitionInformation().getOutputLimit(), channelIst.getStaticInputSignalBindingList()));
} else {
tInfoSource.setType(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_OUT);
inputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_OUT, inLocation, inSubNet, tInfoSource.getTopic(),
tInfoSource.setType(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_OUT);
inputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_OUT, inLocation, inSubNet, tInfoSource.getTopic(),
channelIst.getStaticTransitionInformation().getInputLimit(), channelIst.getStaticTransitionInformation().getOutputLimit(), channelIst.getStaticInputSignalBindingList()));
}
......@@ -164,12 +164,12 @@ public class GlobalToLocalNetsPostProcessor implements PostProcessor<PetriNet> {
JastAddList<ToolInfo> outputToolInfoJastAddList = new JastAddList<>();
if (channelIst.getStaticTransitionInformation().getOutputLimit() >= 0) {
tInfoTarget.setType(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_IN);
outputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TOPIC_TYPE_LIMITED_IN, outLocation, outSubNet, tInfoTarget.getTopic(),
tInfoTarget.setType(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_IN);
outputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TYPE_TOPIC_LIMITED_IN, outLocation, outSubNet, tInfoTarget.getTopic(),
channelIst.getStaticTransitionInformation().getInputLimit(), channelIst.getStaticTransitionInformation().getOutputLimit(), null));
} else {
tInfoTarget.setType(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_IN);
outputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TOPIC_TYPE_UNLIMITED_IN, outLocation, outSubNet, tInfoTarget.getTopic(),
tInfoTarget.setType(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_IN);
outputToolInfoJastAddList.add(buildToolSpecifics(PnmlConstants.TRANSITION_TYPE_TOPIC_UNLIMITED_IN, outLocation, outSubNet, tInfoTarget.getTopic(),
channelIst.getStaticTransitionInformation().getInputLimit(), channelIst.getStaticTransitionInformation().getOutputLimit(), null));
}
......
......@@ -129,7 +129,7 @@ public class IoPetriNetPostProcessor implements PostProcessor<PetriNet> {
osb.setPlaceID(pID);
NodeList eqMappingNodeList = osBindingElement.getElementsByTagName(PnmlConstants.EQUAL_OS_KEY);
NodeList thresholdMappingNodeList = osBindingElement.getElementsByTagName(PnmlConstants.TRESHOLD_KEY);
NodeList thresholdMappingNodeList = osBindingElement.getElementsByTagName(PnmlConstants.THRESHOLD_KEY);
NodeList rangeMappingNodeList = osBindingElement.getElementsByTagName(PnmlConstants.RANGE_OS_KEY);
for (int j = 0; j < eqMappingNodeList.getLength(); j++) {
......
<pnml xmlns="http://www.pnml.org/version-2009/grammar/pnml">
<net id="n-E2D0-BCF46-0" type ="http://www.pnml.org/version-2009/grammar/ptnet">
<name>
<text>minimal</text>
</name>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<page id="g-E2D0-BCF68-1">
<place id="p1">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<subnet>subnet-1</subnet>
<type>discretePlaceType</type>
<outputsignalbindings>
<outputsignalbinding>
<placeID>p1</placeID>
<outputsignalID>os2</outputsignalID>
<initialvalue>1</initialvalue> <!-- -1 = undefined -->
<outputmappings>
<equal>
<value>1</value>
<result>3</result>
</equal>
<equal>
<value>0</value>
<result>2</result>
</equal>
<threshold>
<value>6</value>
<result>0</result>
</threshold>
<range>
<upperbound>5</upperbound>
<lowerbound>3</lowerbound>
<result>1</result>
</range>
</outputmappings>
</outputsignalbinding>
</outputsignalbindings>
</toolspecific>
<name>
<text>p1</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>1</text>
</initialMarking>
<graphics>
<position x="30" y="50"/>
</graphics>
</place>
<place id="p2">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-2</location>
<subnet>subnet-2</subnet>
<type>discretePlaceType</type>
<outputsignalbindings>
<outputsignalbinding>
<placeID>p2</placeID>
<outputsignalID>os1</outputsignalID>
<initialvalue>4</initialvalue> <!-- -1 = undefined -->
<outputmappings>
<equal>
<value>1</value>
<result>1</result>
</equal>
<threshold>
<value>6</value>
<result>0</result>
</threshold>
<range>
<upperbound>5</upperbound>
<lowerbound>3</lowerbound>
<result>1</result>
</range>
</outputmappings>
</outputsignalbinding>
</outputsignalbindings>
</toolspecific>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<name>
<text>p2</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<place id="p3">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-2</location>
<subnet>subnet-2</subnet>
<type>discretePlaceType</type>
</toolspecific>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<name>
<text>p2</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<place id="p4">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>node-1</location>
<subnet>subnet-1</subnet>
<type>discretePlaceType</type>
</toolspecific>
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
</toolspecific>
<name>
<text>p4</text>
<graphics>
<offset x="0" y="-10" />
</graphics>
</name>
<initialMarking>
<text>0</text>
</initialMarking>
<graphics>
<position x="635" y="90"/>
</graphics>
</place>
<transition id="t1">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>channel</location>
<subnet>channel</subnet>
<type>serviceTransitionTypeRequest</type>
<serviceName>sampleService</serviceName>
</toolspecific>
<name>
<text>t1</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<transition id="t2">
<toolspecific tool="de.tudresden.inf.st.pnml.distributedPN" version="0.1">
<location>channel</location>
<subnet>channel</subnet>
<type>serviceTransitionTypeResponse</type>
<serviceName>sampleService</serviceName>
</toolspecific>
<name>
<text>t2</text>
<graphics>
<offset x="0" y="0" />
</graphics>
</name>
<graphics>
<position x="300" y="50"/>
</graphics>
</transition>
<arc id="arc-p3-t2" source="p3" target="t2">
</arc>
<arc id="arc-t2-p4" source="t2" target="p4">
</arc>
</page>
</net>
</pnml>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment