Share this post on:

Can only be executed when the variable choice is Correct. The
Can only be executed when the variable selection is Correct. The MEE sends the transition guards for the PEE to become reevaluated applying the Python instruction eval any time the marking of your PN modifications. The PEE answers the MEE together with the set of guards satisfied, and also the MEE sends the transition statements to the PEE when a transition is fired, and after that awaits to acquire the execution outcome. The MEE supports each automatic and manual firing of transitions. When firing a transition, it follows the protocol depicted in Figure 7. This protocol is modeled as a PN. The MEE sends the corresponding statement to the PEE when firing a transition. It waits for a response that can be either an “EXECUTED” or an “EXCEPTION” message. Inside the former case, the MEE updates the marking. Within the latter case, it restores the marking to the original state and opens a popup dialog showing the exception thrown. The colour of transitions can be green, red, or orange to denote the states of enabled, disabled, or running, respectively.Enabled Transition In execution Transition Tokens consumedFireConsume tokens update transition colorsSend statement Wait to get a response Obtain EXECUTED Receive EXCEPTIONExecutedExceptionProduce tokens update transition colorsDoneRestore the marking update transitions colors pop up the exceptionFigure 7. The protocol followed by MEE when firing a transition.The PEE is usually a Python system implementing server options. It receives guards and instructions, and returns the outcome of their evaluations and executions, Nicosulfuron manufacturer respectively, toAppl. Sci. 2021, 11,ten ofthe MEE. As an example, when the PEE receives an instruction, it executes the instruction. In the event the instruction is executed with out an exception, the PEE sends an “EXECUTED” message. Otherwise, it sends an “EXCEPTION” message concatenated together with the exception content material. Listing two shows the Python function to become executed when receiving an instruction. It makes use of the exec command inside a try except block to execute the received instruction.Listing two. PEE fundamental code.def execute(instruction ): try : exec(instruction ) reply (“ EXECUTED”) except Exception as e: reply (“ EXCEPTION:” + str(e)) In contrast, in the evaluation applying the instruction eval when an exception is raised, we assume that the evaluation has not succeeded and also the guard is not fulfilled. Within this case, we consider that the transition is disabled. We adhere to this strategy because expressions may well at some point be evaluated as true, as soon as, by way of example, the variable made use of within the expression is defined or made use of (dynamic typing). three.four. The Development, Reconfiguring, and Monitoring of Python Applications We show how a Python application is developed applying the proposed framework together with the following example based around the grading program. Example four. Very first, we should create the appropriate functions for the grading instance. Subsequently, we are able to enrich the transitions with the PN model in Figure two together with the statements and guards shown in Table 2.Table two. Statements and guards of the grading example transition.Transition T0 T1 T2 T3 T4 T5 TStatement from instance import Grade_Frame from instance import Passed_Frame grade_average_1 = Grade_Frame.enter_grade_average(1) grade_average_2 = Grade_Frame.enter_grade_average(2) decision = int(grade_average_1) = 50 and int(grade_average_2) = 50 Passed_Frame.show_decision(“Passed!”) Passed_Frame.show_decision(“Failed!”)Guard True True True Accurate True selection not decisionFigure 2 illustrates how the framework enables u.

Share this post on:

Author: haoyuan2014