Behavior/DecisionControlFlowPN [ Rules ]

[ Top ] [ Behavior ] [ Rules ]

SUMMARY

Transfotrm a SysML DecisionControlFlow into its HiLeS Petri Net representation. Additional Petri Net elements are created to connect to the Functional Block created when transforming the DecisionControlFlow Guard. ($Rev: 298 $)

DESCRIPTION

ControlFlows that have a DecisionNode as the source element and the target is a ForkNode or a JoinNode. They are transformed into a structure identical to CallOperationAction where the FB will represent the logic associated to evaluating the ControlFlow's Guard. Additionally a hiles:Transition and two hiles:Arcs are created to represent the ControlFlow per se.

SEE ALSO

DOMAIN

SPECIFICATION

        relation DecisionControlFlow
        {
            checkonly domain SysML cf:ControlFlow {
                activity = a:Activity{},
                guard = g:ValueSpecification{},
                target = cft,
            }
            primitive domain HiLeS guardPort:Port;
            primitive domain HiLeS fb:Functional;
            enforce domain HiLeS aIn:Arc {
                PetriNet = pn:PetriNet{},
                from_node = td:Node{},
                to_node = p1:Node{},
            }
            enforce domain HiLeS p1:Place {
                PetriNet = pn:PetriNet{},
                name = fb.name + '_P1',
            }
            enforce domain HiLeS p2:Place {
                PetriNet = pn:PetriNet{},
                name = fb.name + '_P2',
            }
            enforce domain HiLeS p3:Place {
                PetriNet = pn:PetriNet{},
                name = fb.name + '_P3',
            }
            enforce domain HiLeS t1:Transition {
                PetriNet = pn:PetriNet{},
                name = fb.name + '_T1',
            }
            enforce domain HiLeS t2:Transition {
                PetriNet = pn:PetriNet{},
                name = fb.name + '_T2',
            }
            enforce domain HiLeS a1:Arc {
                PetriNet = pn:PetriNet{},
                from_node = p1:Node{},
                to_node = t1:Node{},
            }
            enforce domain HiLeS a2:Arc {
                PetriNet = pn:PetriNet{},
                from_node = t1:Node{},
                to_node = p2:Node{},
            }
            enforce domain HiLeS a3:Arc {
                PetriNet = pn:PetriNet{},
                from_node = t1:Node{},
                to_point = a3tp:Port{},
            }
            enforce domain HiLeS a4:Arc {
                PetriNet = pn:PetriNet{},
                from_node = p2:Node{},
                to_node = t2:Node{},
            }
            enforce domain HiLeS a5:Arc {
                PetriNet = pn:PetriNet{},
                from_point = a5fp:Port{},
                to_node = t2:Node{},
            }
            enforce domain HiLeS a6:Arc {
                PetriNet = pn:PetriNet{},
                from_node = t2:Node{},
                to_node = p3:Node{},
            }
            enforce domain HiLeSB a1cf:Arc {
                PetriNet = pn:PetriNet{},
                from_node = p3:Node{},
                to_node = tcf:Node{},
            }
            enforce domain HiLeS pl:Payload {
                PetriNet = pn:PetriNet{},
                target = guardPort:Port{},
            }
            when {
                ActivityPetriNet(a, pn, arch);
                cf.source->isTypeOf(SysML:DecisionNode) and ( cf.target->isTypeOf(SysML:ForkNode)
                or cf.target->isTypeOf(SysML:JoinNode))
            }
            where {
                DecisionNodePN(node, pd, td, ad);
                Guard(g, fb);
                fb.name = cf.source.name + "_" + fb.name,
                fb.associated = p2,
                guardPort.name = "Guard";
                guardPort.direction = PointDirection::input;
                fb.ports->append(guardPort);
                a3tp = fb.ports->select(direction = PointDirection::input);
                a5fp = fb.ports->select(direction = PointDirection::input);
                if cft->isTypeOf(CallBehaviorAction) then
                    CallBehaviorPN(cft, p1t, p2t, p3t, t1t, t2t, a1t, a2t, a4t, a6t, a3t, a5t);
                else
                    if cft->isTypeOf(CallOperationAction) then
                        CallOperationPN(cft, p1t, p2t, p3t, t1t, t2t, a1t, a2t, a4t, a6t, a3t, a5t);
                    endif
                endif
            }
        }
 *