Beispiel #1
0
    def traceConfluent(self, aDEVS):
        """
        The trace functionality for XML output at a confluent transition

        :param aDEVS: the model that transitioned
        """
        port_info = ""
        for I in range(len(aDEVS.IPorts)):
            port_info += '<port name="' + aDEVS.IPorts[I].getPortName() + '" category="I">\n'
            for j in aDEVS.my_input[aDEVS.IPorts[I]]:
                port_info += "<message>" + str(j) + "</message>\n</port>\n"
        runTraceAtController(self.server, 
                             self.uid, 
                             aDEVS, 
                             [toStr(aDEVS.getModelFullName()), 
                                aDEVS.time_last, 
                                "'EX'", 
                                toStr(port_info), 
                                toStr(aDEVS.state.toXML()), 
                                toStr(aDEVS.state)])
        port_info = ""
        for I in range(len(aDEVS.OPorts)):
            if aDEVS.OPorts[I] in aDEVS.my_output:
                port_info += '<port name="' + aDEVS.OPorts[I].getPortName() + '" category="O">\n'
                for j in aDEVS.my_output[aDEVS.OPorts[I]]:
                    port_info += "<message>" + str(j) + "</message>\n</port>\n"
        runTraceAtController(self.server, 
                             self.uid, 
                             aDEVS, 
                             [toStr(aDEVS.getModelFullName()), 
                                aDEVS.time_last, 
                                "'IN'", 
                                toStr(port_info), 
                                toStr(aDEVS.state.toXML()), 
                                toStr(aDEVS.state)])
    def traceConfluent(self, aDEVS):
        """
        Tracing done for the confluent transition function

        :param aDEVS: the model that transitioned
        """
        text = "\n"
        text += "\tCONFLUENT TRANSITION in model <%s>\n" % aDEVS.getModelFullName(
        )
        text += "\t\tInput Port Configuration:\n"
        for I in range(len(aDEVS.IPorts)):
            text += "\t\t\tport <" + str(
                aDEVS.IPorts[I].getPortName()) + ">: \n"
            for msg in aDEVS.my_input.get(aDEVS.IPorts[I], []):
                text += "\t\t\t\t" + str(msg) + "\n"
        text += "\t\tNew State: %s\n" % str(aDEVS.state)
        text += "\t\tOutput Port Configuration:\n"
        for I in range(len(aDEVS.OPorts)):
            text += "\t\t\tport <" + str(
                aDEVS.OPorts[I].getPortName()) + ">:\n"
            for msg in aDEVS.my_output.get(aDEVS.OPorts[I], []):
                text += "\t\t\t\t" + str(msg) + "\n"
        # Don't show the age
        text += "\t\tNext scheduled internal transition at time %.2f\n" \
                % (aDEVS.time_next[0])
        runTraceAtController(self.server, self.uid, aDEVS,
                             [aDEVS.time_last, '"' + text + '"'])
Beispiel #3
0
    def traceConfluent(self, aDEVS):
        """
        The trace functionality for VCD output at a confluent transition

        :param aDEVS: the model that transitioned
        """
        name = toStr(aDEVS.getModelFullName())
        for I in range(len(aDEVS.IPorts)):
            port_name = aDEVS.IPorts[I].getPortName()
            signal_bag = aDEVS.my_input.get(aDEVS.IPorts[I], [])
            if signal_bag is not None:
                for port_signal in signal_bag:
                    runTraceAtController(self.server, 
                                         self.uid, 
                                         aDEVS, 
                                         [name, 
                                            aDEVS.time_last, 
                                            toStr(port_name), 
                                            toStr(port_signal)])
        for I in range(len(aDEVS.OPorts) ):
            if aDEVS.OPorts[I] in aDEVS.my_output:
                port_name = aDEVS.OPorts[I].getPortName()
                signal_bag = aDEVS.my_output.get(aDEVS.OPorts[I], [])
                if signal_bag is not None:
                    for port_signal in signal_bag:
                        runTraceAtController(self.server, 
                                             self.uid, 
                                             aDEVS, 
                                             [name, 
                                                aDEVS.time_last, 
                                                toStr(port_name), 
                                                toStr(port_signal)])
Beispiel #4
0
    def traceConfluent(self, aDEVS):
        """
        The trace functionality for XML output at a confluent transition

        :param aDEVS: the model that transitioned
        """
        port_info = ""
        for I in range(len(aDEVS.IPorts)):
            port_info += '<port name="' + aDEVS.IPorts[I].getPortName(
            ) + '" category="I">\n'
            for j in aDEVS.my_input[aDEVS.IPorts[I]]:
                port_info += "<message>" + str(j) + "</message>\n</port>\n"
        runTraceAtController(self.server, self.uid, aDEVS, [
            toStr(aDEVS.getModelFullName()), aDEVS.time_last, "'EX'",
            toStr(port_info),
            toStr(aDEVS.state.toXML()),
            toStr(aDEVS.state)
        ])
        port_info = ""
        for I in range(len(aDEVS.OPorts)):
            if aDEVS.OPorts[I] in aDEVS.my_output:
                port_info += '<port name="' + aDEVS.OPorts[I].getPortName(
                ) + '" category="O">\n'
                for j in aDEVS.my_output[aDEVS.OPorts[I]]:
                    port_info += "<message>" + str(j) + "</message>\n</port>\n"
        runTraceAtController(self.server, self.uid, aDEVS, [
            toStr(aDEVS.getModelFullName()), aDEVS.time_last, "'IN'",
            toStr(port_info),
            toStr(aDEVS.state.toXML()),
            toStr(aDEVS.state)
        ])
Beispiel #5
0
    def traceConfluent(self, aDEVS):
        """
        Tracing done for the confluent transition function

        :param aDEVS: the model that transitioned
        """
        text = "\n"
        text += "\tCONFLUENT TRANSITION in model <%s>\n" % aDEVS.getModelFullName()
        text += "\t\tInput Port Configuration:\n"
        for I in range(len(aDEVS.IPorts)):
            text += "\t\t\tport <" + str(aDEVS.IPorts[I].getPortName()) + ">: \n"
            for msg in aDEVS.my_input.get(aDEVS.IPorts[I], []):
                text += "\t\t\t\t" + str(msg) + "\n"
        text += "\t\tNew State: %s\n" % str(aDEVS.state)
        text += "\t\tOutput Port Configuration:\n"
        for I in range(len(aDEVS.OPorts)):
            text += "\t\t\tport <" + str(aDEVS.OPorts[I].getPortName()) + ">:\n"
            for msg in aDEVS.my_output.get(aDEVS.OPorts[I], []):
                text += "\t\t\t\t" + str(msg) + "\n"
        # Don't show the age
        text += "\t\tNext scheduled internal transition at time %.2f\n" \
                % (aDEVS.time_next[0])
        runTraceAtController(self.server, 
                             self.uid, 
                             aDEVS, 
                             [aDEVS.time_last, '"' + text + '"'])
Beispiel #6
0
    def traceInit(self, aDEVS, t):
        """
        The trace functionality for XML output at initialization

        :param aDEVS: the model that transitioned
        :param t: time at which it should be traced
        """
        runTraceAtController(self.server, self.uid, aDEVS, [
            toStr(aDEVS.getModelFullName()), t, "'EX'", "''",
            toStr(aDEVS.state.toXML()),
            toStr(aDEVS.state)
        ])
    def traceInit(self, aDEVS, t):
        """
        Tracing done for the initialisation

        :param aDEVS: the model that was initialised
        :param t: time at which it should be traced
        """
        text = "\n"
        text += "\tINITIAL CONDITIONS in model <%s>\n" % aDEVS.getModelFullName(
        )
        text += "\t\tInitial State: %s\n" % str(aDEVS.state)
        # Don't show the age
        text += "\t\tNext scheduled internal transition at time %.2f\n" \
                % (aDEVS.time_next[0])
        runTraceAtController(self.server, self.uid, aDEVS,
                             [t, '"' + text + '"'])
Beispiel #8
0
    def traceInternal(self, aDEVS):
        """
        The trace functionality for Cell DEVS output at an internal transition

        :param aDEVS: the model that transitioned
        """
        try:
            runTraceAtController(self.server, 
                                 self.uid, 
                                 aDEVS, 
                                 [aDEVS.x, 
                                    aDEVS.y, 
                                    aDEVS.time_last, 
                                    toStr(aDEVS.state.toCellState())])
        except AttributeError:
            pass
Beispiel #9
0
    def traceInit(self, aDEVS, t):
        """
        The trace functionality for XML output at initialization

        :param aDEVS: the model that transitioned
        :param t: time at which it should be traced
        """
        runTraceAtController(self.server, 
                             self.uid, 
                             aDEVS, 
                             [toStr(aDEVS.getModelFullName()), 
                                t, 
                                "'EX'", 
                                "''", 
                                toStr(aDEVS.state.toXML()), 
                                toStr(aDEVS.state)])
Beispiel #10
0
    def traceInit(self, aDEVS, t):
        """
        The trace functionality for Cell DEVS output at initialisation

        :param aDEVS: the model that was initialised
        :param t: time at which it should be traced
        """
        try:
            runTraceAtController(self.server, 
                                 self.uid, 
                                 aDEVS, 
                                 [aDEVS.x, 
                                    aDEVS.y, 
                                    t, 
                                    toStr(aDEVS.state.toCellState())])
        except AttributeError:
            pass
Beispiel #11
0
    def traceInit(self, aDEVS, t):
        """
        Tracing done for the initialisation

        :param aDEVS: the model that was initialised
        :param t: time at which it should be traced
        """
        text = "\n"
        text += "\tINITIAL CONDITIONS in model <%s>\n" % aDEVS.getModelFullName()
        text += "\t\tInitial State: %s\n" % str(aDEVS.state)
        # Don't show the age
        text += "\t\tNext scheduled internal transition at time %.2f\n" \
                % (aDEVS.time_next[0])
        runTraceAtController(self.server, 
                             self.uid, 
                             aDEVS, 
                             [t, '"' + text + '"'])