Commit a2d4c16e authored by mullers's avatar mullers
Browse files

files from Peter reloaded

parent f1777e80
Loading
Loading
Loading
Loading
+307 −284
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ module MainModule {
        var integer v_startTS := 0;
        var template (present) LinkId v_linkId := ?;
        var boolean v_receivedLinkId := false;
        var boolean v_actionAtOBU := false;
        var NrOfEmptyMsg v_nrOfEmptyMsg := 0;
        var PayloadStructure v_receivedMsg;
        
@@ -16,10 +17,11 @@ module MainModule {
                // when the first broadcast message is received then take it's time stamp
                transactionRSUTimer.stop;
                //---
                commonOBURSUPort.send(v_receivedMsg);
                commmunOBURSUPort.send(v_receivedMsg);
                //---
                v_startTS := v_ts;
                transactionRSUTimer.start;
                compPort.send(true);
                repeat; 
            }
            [] compPort.receive(v_linkId) -> value v_linkId{
@@ -28,12 +30,17 @@ module MainModule {
                transactionRSUTimer.start;
                repeat;
            }
            [] compPort.receive(true){
                v_actionAtOBU := true;
                repeat;
            }

            [v_startTS!=0 and v_receivedLinkId == true] rsuPort.receive(mw_releaseMsg(v_linkId)) -> sender v_ts value v_receivedMsg{ 
                // when the release message was received take it's time stamp and calculate the transaction time
                // inform the rsu component 
                transactionRSUTimer.stop;
                //---
                commonOBURSUPort.send(v_receivedMsg);
                commmunOBURSUPort.send(v_receivedMsg);
                //---
                compPort.send(m_stop);
                
@@ -53,21 +60,18 @@ module MainModule {
                
                
                p_tranDuration := v_ts - v_startTS;
                if (p_tranDuration <= 100000 and v_nrOfEmptyMsg <= PX_MAX_NUM_EMPTY_UPLINK_FRAMES){
                    setverdict (pass, "Transaction finished in " & int2str(p_tranDuration) & " microsec." & " The Number of empty messages received is : " & int2str(v_nrOfEmptyMsg));
                if (p_tranDuration <= 100000) {
                    setverdict (pass, "Transaction finished in " & int2str(p_tranDuration) & " micro s"  & " The Number of empty messages received is : " & int2str(v_nrOfEmptyMsg));
                }
                else if(p_tranDuration > 100000){
                else {
                    setverdict (fail, "Transaction finished in more than 100ms (" & int2str(p_tranDuration) & " micro s "  &")");
                }else if(v_nrOfEmptyMsg > PX_MAX_NUM_EMPTY_UPLINK_FRAMES){
                    setverdict (fail, "Maximum number of received empty frames exceeded! (" 
                                                         & int2str(v_nrOfEmptyMsg) & " > " & int2str(PX_MAX_NUM_EMPTY_UPLINK_FRAMES) & ")");
                }
                stop;
            }
            [v_startTS!=0 and v_receivedLinkId == true] rsuPort.receive(mw_msg_withLinkId(v_linkId))-> value v_receivedMsg{
                transactionRSUTimer.stop;
                //---
                commonOBURSUPort.send(v_receivedMsg);
                commmunOBURSUPort.send(v_receivedMsg);
                //---
                transactionRSUTimer.start;
                repeat;
@@ -76,7 +80,7 @@ module MainModule {
                //If another broadcast is received than ignore
                transactionRSUTimer.stop;
                //---
                commonOBURSUPort.send(v_receivedMsg);
                commmunOBURSUPort.send(v_receivedMsg);
                //---
                transactionRSUTimer.start;
                repeat;
@@ -88,7 +92,14 @@ module MainModule {
                stop;                
            }
            [] transactionRSUTimer.timeout {
                setverdict (inconc, "No RSU message was received");
                if(v_actionAtOBU)
                	{setverdict (fail, "Transaction incomplete!");}
                else
                	{if(v_startTS==0)
                		{setverdict (fail, "Transaction empty!");}
                	 else
                     	{setverdict (fail);}
                	}
                compPort.send(m_stop);
                stop;
            }
@@ -97,46 +108,64 @@ module MainModule {
    
    function f_obuBehaviour() runs on ObuType {
        var boolean v_sentLinkId := false;
        var boolean v_actionAtRSU := false;
        var PayloadStructure v_msg;
        var NrOfEmptyMsg v_cntEmpty := 0;
        var template (present) LinkId v_linkId := ?;
        timer t_obuTimer := 2.0;
        
        t_obuTimer.start;
        transactionOBUTimer.start;
        alt{
            []obuPort.receive(mw_msg_withLinkId(v_linkId)) -> value v_msg{
                t_obuTimer.stop;
                transactionOBUTimer.stop;
                //---
                 commonOBURSUPort.send(v_msg);
                 commmunOBURSUPort.send(v_msg);
                //---
                if (v_sentLinkId == false) {
                       v_linkId := valueof(v_msg.linkMsg.linkId);
                       compPort.send(valueof(v_linkId));
                }
                v_sentLinkId := true;
                t_obuTimer.start;
                transactionOBUTimer.start;
                compPort.send(true);
                repeat;
            }
            []obuPort.receive(mw_msg_empty) ->value v_msg{
                t_obuTimer.stop;
                transactionOBUTimer.stop;
                //---
                 commonOBURSUPort.send(v_msg);
                 commmunOBURSUPort.send(v_msg);
                //---
                v_cntEmpty := v_cntEmpty +1;
                t_obuTimer.start;
                transactionOBUTimer.start;
                repeat;
            }
            []obuPort.receive{
                t_obuTimer.stop;
                transactionOBUTimer.stop;
                setverdict (inconc, "Unexpected message received.");
                stop;
            }
            [] compPort.receive(true){
                v_actionAtRSU := true;
                repeat;
            }

            []compPort.receive(m_stop) {
                compPort.send(v_cntEmpty);
                if (v_cntEmpty <= PX_MAX_NUM_EMPTY_UPLINK_FRAMES){
                    // do nothing so that the last verdict would be taken from the RSU component
                    // only in case of fail (to many received empty frames) is the verdict from OBU component used
                    //setverdict (pass, "Number of received empty frames : " & int2str(v_cntEmpty));      
                }
                else {
                    setverdict (fail, "Maximum number of received empty frames exceeded! (" 
                                      & int2str(v_cntEmpty) & " > " & int2str(PX_MAX_NUM_EMPTY_UPLINK_FRAMES) & ")");
                }
                stop;
            }
            []t_obuTimer.timeout{
                setverdict(inconc, "No OBU messaged received");
            []transactionOBUTimer.timeout{
				if(v_actionAtRSU)
					{setverdict(fail, "No OBU message received");}
				else
                	{setverdict(fail);}
                stop;
            }
        }
@@ -171,12 +200,7 @@ module MainModule {

        controlPort.call(getTransactionCnt:{}, 5.0) {
            [] controlPort.getreply(getTransactionCnt:{} value ?) -> value p_nrOfTransactions {
                if(p_nrOfTransactions != 0){
                setverdict (pass, "Number of Transaction = " & int2str(p_nrOfTransactions));
                }else{
                    setverdict (fail, "!!No Transaction Found!! Please verify the log file!!");   
                    stop;
                }
            }
            [] controlPort.getreply {
                setverdict (fail, "Unexpected reply");
@@ -200,7 +224,7 @@ module MainModule {
        map(rsuComponent:rsuPort, system:msgPort);
        map(obuComponent:obuPort, system:msgPort);
        connect(rsuComponent:compPort, obuComponent:compPort);
        connect(rsuComponent:commonOBURSUPort, obuComponent:commonOBURSUPort);
        connect(rsuComponent:commmunOBURSUPort, obuComponent:commmunOBURSUPort);
        
        rsuComponent.start(f_rsuBehaviour(p_tranDuration));
        obuComponent.start(f_obuBehaviour());
@@ -272,14 +296,13 @@ module MainModule {
            }
        };
        
        if(v_nrOfRelevantTransactions != 0){
        v_averageTranDuration := float2int(int2float(v_cumulativeTranDuration) / int2float(v_nrOfRelevantTransactions));
        
        execute(TC_LogAnalyzesTrace(v_averageTranDuration,
                                    v_shortestTransDuration,
                                    v_shortestTransIndex,
                                    v_longestTransDuration,
                                    v_longestTransIndex));
        }
        }
    
}
 No newline at end of file
+5 −18
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ module TraceParserSystem {
        inout LinkId, SyncCommand, NrOfEmptyMsg;
    }
    
    type port CommonPortOBURSUType message{
    type port CommunPortOBURSUType message{
        inout PayloadStructure;
    }
    
@@ -63,14 +63,14 @@ module TraceParserSystem {
    type component RsuType { //downLinkType
        port TraceMsgPortType rsuPort;
        port CompPortType compPort;
        port CommonPortOBURSUType commonOBURSUPort;
        timer transactionRSUTimer := 1.0 ;
        port CommunPortOBURSUType commmunOBURSUPort;
        timer transactionRSUTimer := 1.5 ;
    }
    
    type component ObuType { //upLinkType
        port TraceMsgPortType obuPort;
        port CompPortType compPort;
        port CommonPortOBURSUType commonOBURSUPort;
        port CommunPortOBURSUType commmunOBURSUPort;
        timer transactionOBUTimer := 1.0 ;
    }
    
@@ -113,9 +113,6 @@ module TraceParserSystem {
            msg := ?
       }
    }
    with {
        display "RSU BROADCAST"
    }
    
    template PayloadStructure mw_releaseMsg(template (present) LinkId p_linkId) :={
        linkMsg := {
@@ -126,9 +123,6 @@ module TraceParserSystem {
            tapdu := '200000'O
        }
    }
    with {
        display "RSU RELEASE"
    }
    
    template PayloadStructure mw_msg_withLinkId(template (present) LinkId p_linkId) :={ 
        linkMsg := {
@@ -139,9 +133,6 @@ module TraceParserSystem {
            tapdu := *
        }
    }
    with {
        display "MSG with LINK ID"
    }
    
    template PayloadStructure mw_msg_empty :={ 
        linkMsg := {
@@ -152,13 +143,9 @@ module TraceParserSystem {
            tapdu := omit
        }
    }
    with {
        display "EMPTY MSG"
    }
    
    template SyncCommand m_stop := e_stop;


    group baseMessages {
        type integer address;
    }