|
@@ -1,4 +1,6 @@
|
|
|
import models/RAM_PetriNets_Runtime_Runtime as RAM_PN_R
|
|
|
+include "primitives.alh"
|
|
|
+include "modelling.alh"
|
|
|
|
|
|
RAM_PN_R s {
|
|
|
Composite schedule {
|
|
@@ -21,8 +23,6 @@ RAM_PN_R s {
|
|
|
label = "11"
|
|
|
}
|
|
|
constraint = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
Boolean function constraint(host_model : Element, mapping : Element):
|
|
|
Integer tokens
|
|
|
Integer weight
|
|
@@ -34,14 +34,9 @@ RAM_PN_R s {
|
|
|
RHS {
|
|
|
Post_PetriNets_Runtime/Transition {
|
|
|
label = "1"
|
|
|
- action = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- log("MARK " + name)
|
|
|
- unset_attribute(host_model, name, "executing")
|
|
|
- instantiate_attribute(host_model, name, "executing", True)
|
|
|
- return!
|
|
|
+ value_executing = $
|
|
|
+ Boolean function value(host_model : Element, name : String, mapping : Element):
|
|
|
+ return True!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
@@ -50,12 +45,9 @@ RAM_PN_R s {
|
|
|
LHS {
|
|
|
Pre_PetriNets_Runtime/Transition lhs_consume_t{
|
|
|
label = "0"
|
|
|
- constraint = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ constraint_executing = $
|
|
|
+ Boolean function constraint(value : Boolean):
|
|
|
+ return value!
|
|
|
$
|
|
|
}
|
|
|
Pre_PetriNets_Runtime/Place lhs_consume_p{
|
|
@@ -71,20 +63,9 @@ RAM_PN_R s {
|
|
|
}
|
|
|
Post_PetriNets_Runtime/Place rhs_consume_p {
|
|
|
label = "1"
|
|
|
- action = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- Integer tokens
|
|
|
- Integer weight
|
|
|
- tokens = read_attribute(host_model, name, "tokens")
|
|
|
- weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
- unset_attribute(host_model, name, "tokens")
|
|
|
- instantiate_attribute(host_model, name, "tokens", tokens - weight)
|
|
|
- log("Consume for " + cast_v2s(read_attribute(host_model, name, "name")))
|
|
|
- log("Previous: " + cast_v2s(tokens))
|
|
|
- log("Now: " + cast_v2s(tokens - weight))
|
|
|
- return!
|
|
|
+ value_tokens = $
|
|
|
+ Integer function value(host_model : Element, name : String, mapping : Element):
|
|
|
+ return integer_subtraction(read_attribute(host_model, name, "tokens"), read_attribute(host_model, mapping["2"], "weight"))!
|
|
|
$
|
|
|
}
|
|
|
Post_PetriNets_Runtime/P2T (rhs_consume_p, rhs_consume_t){
|
|
@@ -96,12 +77,9 @@ RAM_PN_R s {
|
|
|
LHS {
|
|
|
Pre_PetriNets_Runtime/Transition lhs_produce_t{
|
|
|
label = "0"
|
|
|
- constraint = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ constraint_executing = $
|
|
|
+ Boolean function constraint(value : Boolean):
|
|
|
+ return value!
|
|
|
$
|
|
|
}
|
|
|
Pre_PetriNets_Runtime/Place lhs_produce_p{
|
|
@@ -117,20 +95,9 @@ RAM_PN_R s {
|
|
|
}
|
|
|
Post_PetriNets_Runtime/Place rhs_produce_p{
|
|
|
label = "1"
|
|
|
- action = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- Integer tokens
|
|
|
- Integer weight
|
|
|
- tokens = read_attribute(host_model, name, "tokens")
|
|
|
- weight = read_attribute(host_model, mapping["2"], "weight")
|
|
|
- unset_attribute(host_model, name, "tokens")
|
|
|
- instantiate_attribute(host_model, name, "tokens", tokens + weight)
|
|
|
- log("Produce for " + cast_v2s(read_attribute(host_model, name, "name")))
|
|
|
- log("Previous: " + cast_v2s(tokens))
|
|
|
- log("Now: " + cast_v2s(tokens + weight))
|
|
|
- return!
|
|
|
+ value_tokens = $
|
|
|
+ Integer function value(host_model : Element, name : String, mapping : Element):
|
|
|
+ return integer_addition(read_attribute(host_model, name, "tokens"), read_attribute(host_model, mapping["2"], "weight"))!
|
|
|
$
|
|
|
}
|
|
|
Post_PetriNets_Runtime/T2P (rhs_produce_t, rhs_produce_p){
|
|
@@ -142,25 +109,18 @@ RAM_PN_R s {
|
|
|
LHS {
|
|
|
Pre_PetriNets_Runtime/Transition {
|
|
|
label = "0"
|
|
|
- constraint = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Boolean function constraint(host_model : Element, name : String):
|
|
|
- // Check if this node is executing currently
|
|
|
- return value_eq(read_attribute(host_model, name, "executing"), True)!
|
|
|
+ constraint_executing = $
|
|
|
+ Boolean function constraint(value : Boolean):
|
|
|
+ return value!
|
|
|
$
|
|
|
}
|
|
|
}
|
|
|
RHS {
|
|
|
Post_PetriNets_Runtime/Transition {
|
|
|
label = "0"
|
|
|
- action = $
|
|
|
- include "primitives.alh"
|
|
|
- include "modelling.alh"
|
|
|
- Void function action(host_model : Element, name : String, mapping : Element):
|
|
|
- unset_attribute(host_model, name, "executing")
|
|
|
- instantiate_attribute(host_model, name, "executing", False)
|
|
|
- return!
|
|
|
+ value_executing = $
|
|
|
+ Boolean function value(host_model : Element, name : String, mapping : Element):
|
|
|
+ return False!
|
|
|
$
|
|
|
}
|
|
|
}
|