Commit f1777e80 authored by mullers's avatar mullers
Browse files

ttcn files added from madalina

parent 82afda40
Loading
Loading
Loading
Loading
+284 −307
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ 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;
        
@@ -17,11 +16,10 @@ module MainModule {
                // when the first broadcast message is received then take it's time stamp
                transactionRSUTimer.stop;
                //---
                commmunOBURSUPort.send(v_receivedMsg);
                commonOBURSUPort.send(v_receivedMsg);
                //---
                v_startTS := v_ts;
                transactionRSUTimer.start;
                compPort.send(true);
                repeat; 
            }
            [] compPort.receive(v_linkId) -> value v_linkId{
@@ -30,17 +28,12 @@ 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;
                //---
                commmunOBURSUPort.send(v_receivedMsg);
                commonOBURSUPort.send(v_receivedMsg);
                //---
                compPort.send(m_stop);
                
@@ -60,18 +53,21 @@ module MainModule {
                
                
                p_tranDuration := v_ts - v_startTS;
                if (p_tranDuration <= 100000) {
                    setverdict (pass, "Transaction finished in " & int2str(p_tranDuration) & " micro s"  & " The Number of empty messages received is : " & int2str(v_nrOfEmptyMsg));
                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));
                }
                else {
                else if(p_tranDuration > 100000){
                    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;
                //---
                commmunOBURSUPort.send(v_receivedMsg);
                commonOBURSUPort.send(v_receivedMsg);
                //---
                transactionRSUTimer.start;
                repeat;
@@ -80,7 +76,7 @@ module MainModule {
                //If another broadcast is received than ignore
                transactionRSUTimer.stop;
                //---
                commmunOBURSUPort.send(v_receivedMsg);
                commonOBURSUPort.send(v_receivedMsg);
                //---
                transactionRSUTimer.start;
                repeat;
@@ -92,14 +88,7 @@ module MainModule {
                stop;                
            }
            [] transactionRSUTimer.timeout {
                if(v_actionAtOBU)
                	{setverdict (fail, "Transaction incomplete!");}
                else
                	{if(v_startTS==0)
                		{setverdict (fail, "Transaction empty!");}
                	 else
                     	{setverdict (fail);}
                	}
                setverdict (inconc, "No RSU message was received");
                compPort.send(m_stop);
                stop;
            }
@@ -108,64 +97,46 @@ 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;
        
        transactionOBUTimer.start;
        t_obuTimer.start;
        alt{
            []obuPort.receive(mw_msg_withLinkId(v_linkId)) -> value v_msg{
                transactionOBUTimer.stop;
                t_obuTimer.stop;
                //---
                 commmunOBURSUPort.send(v_msg);
                 commonOBURSUPort.send(v_msg);
                //---
                if (v_sentLinkId == false) {
                       v_linkId := valueof(v_msg.linkMsg.linkId);
                       compPort.send(valueof(v_linkId));
                }
                v_sentLinkId := true;
                transactionOBUTimer.start;
                compPort.send(true);
                t_obuTimer.start;
                repeat;
            }
            []obuPort.receive(mw_msg_empty) ->value v_msg{
                transactionOBUTimer.stop;
                t_obuTimer.stop;
                //---
                 commmunOBURSUPort.send(v_msg);
                 commonOBURSUPort.send(v_msg);
                //---
                v_cntEmpty := v_cntEmpty +1;
                transactionOBUTimer.start;
                t_obuTimer.start;
                repeat;
            }
            []obuPort.receive{
                transactionOBUTimer.stop;
                t_obuTimer.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;
            }
            []transactionOBUTimer.timeout{
				if(v_actionAtRSU)
					{setverdict(fail, "No OBU message received");}
				else
                	{setverdict(fail);}
            []t_obuTimer.timeout{
                setverdict(inconc, "No OBU messaged received");
                stop;
            }
        }
@@ -200,7 +171,12 @@ 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");
@@ -224,7 +200,7 @@ module MainModule {
        map(rsuComponent:rsuPort, system:msgPort);
        map(obuComponent:obuPort, system:msgPort);
        connect(rsuComponent:compPort, obuComponent:compPort);
        connect(rsuComponent:commmunOBURSUPort, obuComponent:commmunOBURSUPort);
        connect(rsuComponent:commonOBURSUPort, obuComponent:commonOBURSUPort);
        
        rsuComponent.start(f_rsuBehaviour(p_tranDuration));
        obuComponent.start(f_obuBehaviour());
@@ -296,13 +272,14 @@ 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
+18 −5
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ module TraceParserSystem {
    	inout LinkId, SyncCommand, NrOfEmptyMsg;
    }
    
    type port CommunPortOBURSUType message{
    type port CommonPortOBURSUType message{
        inout PayloadStructure;
    }
    
@@ -63,14 +63,14 @@ module TraceParserSystem {
    type component RsuType { //downLinkType
        port TraceMsgPortType rsuPort;
        port CompPortType compPort;
        port CommunPortOBURSUType commmunOBURSUPort;
        timer transactionRSUTimer := 1.5 ;
        port CommonPortOBURSUType commonOBURSUPort;
        timer transactionRSUTimer := 1.0 ;
    }
    
    type component ObuType { //upLinkType
        port TraceMsgPortType obuPort;
        port CompPortType compPort;
        port CommunPortOBURSUType commmunOBURSUPort;
        port CommonPortOBURSUType commonOBURSUPort;
        timer transactionOBUTimer := 1.0 ;
    }
    
@@ -113,6 +113,9 @@ module TraceParserSystem {
            msg := ?
       }
    }
    with {
        display "RSU BROADCAST"
    }
    
    template PayloadStructure mw_releaseMsg(template (present) LinkId p_linkId) :={
        linkMsg := {
@@ -123,6 +126,9 @@ module TraceParserSystem {
            tapdu := '200000'O
        }
    }
    with {
        display "RSU RELEASE"
    }
    
    template PayloadStructure mw_msg_withLinkId(template (present) LinkId p_linkId) :={ 
        linkMsg := {
@@ -133,6 +139,9 @@ module TraceParserSystem {
            tapdu := *
        }
    }
    with {
        display "MSG with LINK ID"
    }
    
    template PayloadStructure mw_msg_empty :={ 
        linkMsg := {
@@ -143,9 +152,13 @@ module TraceParserSystem {
            tapdu := omit
        }
    }
    with {
        display "EMPTY MSG"
    }
    
    template SyncCommand m_stop := e_stop;
    

    group baseMessages {
        type integer address;
    }