Exemple #1
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)])
Exemple #2
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)
        ])
Exemple #3
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)])
Exemple #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)
        ])
Exemple #5
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)])
Exemple #6
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
Exemple #7
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