Loading TraceParser/MainModule.ttcn3 +33 −17 Original line number Diff line number Diff line Loading @@ -2,17 +2,18 @@ module MainModule { import from TraceParserSystem all; function f_obuBehaviour() runs on ObuType { var address ts := 0; var integer startTS := 0; var address v_ts := 0; var integer v_startTS := 0; var template (present) LinkId v_linkId := ?; var boolean v_receivedLinkId := false; transactionOBUTimer.start; alt { [startTS==0] obuPort.receive(mw_obuBroadCastMsg) -> sender ts { // when the first broadcast message is received then take it's time stamp [v_startTS==0] obuPort.receive(mw_obuBroadCastMsg) -> sender v_ts { // when the first broadcast message is received then take it's time stamp transactionOBUTimer.stop; startTS := ts; v_startTS := v_ts; transactionOBUTimer.start; repeat; } Loading @@ -22,37 +23,38 @@ module MainModule { transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_releaseMsg(v_linkId)) -> sender ts { [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_releaseMsg(v_linkId)) -> sender v_ts { // when the release message was received take it's time stamp and calculate the transaction time // inform the rsu component transactionOBUTimer.stop; compPort.send(m_stop); if (ts - startTS <= 100000) { setverdict (pass, "Transaction finished in " & int2str(ts - startTS)); if (v_ts - v_startTS <= 100000) { setverdict (pass, "Transaction finished in " & int2str(v_ts - v_startTS) & "µs"); } else { setverdict (fail, "Transaction finished in more than 100ms (" & int2str(ts - startTS) & ")"); setverdict (fail, "Transaction finished in more than 100ms! (" & int2str(v_ts - v_startTS) & "µs)"); } stop; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_msg_withLinkId(v_linkId)){ [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_msg_withLinkId(v_linkId)){ transactionOBUTimer.stop; transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_obuBroadCastMsg){ //If another broadcast is received than ignore [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_obuBroadCastMsg){ //If another broadcast is received than ignore transactionOBUTimer.stop; transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive { [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive { transactionOBUTimer.stop; setverdict(fail, "Unexpected message received"); compPort.send(m_stop); stop; } [] transactionOBUTimer.timeout { setverdict (inconc, "No message was received"); setverdict (inconc, "No OBU message was received"); compPort.send(m_stop); stop; } Loading Loading @@ -91,7 +93,13 @@ module MainModule { stop; } []compPort.receive(m_stop) { setverdict (pass, "Number of empty messages received: " & int2str(v_cntEmpty)); if (v_cntEmpty <= PX_MAX_NUM_EMPTY_UPLINK_FRAMES){ 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) & ")"); } } []t_rsuTimer.timeout{ setverdict(inconc, "No RSU messaged received"); Loading @@ -104,7 +112,7 @@ module MainModule { map(mtc:controlPort, system:controlPort); controlPort.call(setTraceFile:{TRACE_PATH}, 5.0) { controlPort.call(setTraceFile:{PX_TRACE_PATH}, 5.0) { [] controlPort.getreply(setTraceFile:{-} value true) { setverdict (pass); } Loading @@ -120,7 +128,7 @@ module MainModule { controlPort.call(getTransactionCnt:{}, 5.0) { [] controlPort.getreply(getTransactionCnt:{} value ?) -> value p_nrOfTransactions { setverdict (pass); setverdict (pass, "Number of Transaction = " & int2str(p_nrOfTransactions)); } [] controlPort.getreply { setverdict (fail, "Unexpected reply"); Loading @@ -146,7 +154,7 @@ module MainModule { obuComponent.start(f_obuBehaviour()); rsuComponent.start(f_rsuBehaviour()); log ("Starting analysis of trace: ", p_traceIndex); log ("Starting analysis of trace: " & int2str(p_traceIndex)); controlPort.call(startAnalyzeTrace:{p_traceIndex}, 5.0) { [] controlPort.getreply(startAnalyzeTrace:{-} value true) { Loading @@ -165,13 +173,21 @@ module MainModule { all component.done; } testcase TC_Trace_File_Summary(inout integer p_traceIndex) runs on MtcType system SystemType { var ObuType obuComponent := ObuType.create("OBU"); //DL var RsuType rsuComponent := RsuType.create("RSU"); //UL log ("Summary analysis of all traces in : " & PX_TRACE_PATH); } control { var integer v_nrOfTransactions := 0; execute(TC_Initialization(v_nrOfTransactions)); log("Number of traces: " , v_nrOfTransactions); for(var integer i:=0; i<v_nrOfTransactions; i:=i + 1) { execute(TC_AnalyzesTrace(i)); } execute(TC_Trace_File_Summary(v_nrOfTransactions)); } } No newline at end of file TraceParser/TraceParserSystem.ttcn3 +4 −2 Original line number Diff line number Diff line module TraceParserSystem { modulepar charstring TRACE_PATH:= "C:\Demo_Dump2.txt"; /* @desc Path to file that holds the trace */ modulepar charstring PX_TRACE_PATH:= "C:\Demo_Dump2.txt"; /* @desc Maximum allowed number of empty uplink frames from the On Board Unit (OBU) */ modulepar integer PX_MAX_NUM_EMPTY_UPLINK_FRAMES:= 100; type port TraceMsgPortType message{ in PayloadStructure; Loading Loading
TraceParser/MainModule.ttcn3 +33 −17 Original line number Diff line number Diff line Loading @@ -2,17 +2,18 @@ module MainModule { import from TraceParserSystem all; function f_obuBehaviour() runs on ObuType { var address ts := 0; var integer startTS := 0; var address v_ts := 0; var integer v_startTS := 0; var template (present) LinkId v_linkId := ?; var boolean v_receivedLinkId := false; transactionOBUTimer.start; alt { [startTS==0] obuPort.receive(mw_obuBroadCastMsg) -> sender ts { // when the first broadcast message is received then take it's time stamp [v_startTS==0] obuPort.receive(mw_obuBroadCastMsg) -> sender v_ts { // when the first broadcast message is received then take it's time stamp transactionOBUTimer.stop; startTS := ts; v_startTS := v_ts; transactionOBUTimer.start; repeat; } Loading @@ -22,37 +23,38 @@ module MainModule { transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_releaseMsg(v_linkId)) -> sender ts { [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_releaseMsg(v_linkId)) -> sender v_ts { // when the release message was received take it's time stamp and calculate the transaction time // inform the rsu component transactionOBUTimer.stop; compPort.send(m_stop); if (ts - startTS <= 100000) { setverdict (pass, "Transaction finished in " & int2str(ts - startTS)); if (v_ts - v_startTS <= 100000) { setverdict (pass, "Transaction finished in " & int2str(v_ts - v_startTS) & "µs"); } else { setverdict (fail, "Transaction finished in more than 100ms (" & int2str(ts - startTS) & ")"); setverdict (fail, "Transaction finished in more than 100ms! (" & int2str(v_ts - v_startTS) & "µs)"); } stop; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_msg_withLinkId(v_linkId)){ [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_msg_withLinkId(v_linkId)){ transactionOBUTimer.stop; transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_obuBroadCastMsg){ //If another broadcast is received than ignore [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive(mw_obuBroadCastMsg){ //If another broadcast is received than ignore transactionOBUTimer.stop; transactionOBUTimer.start; repeat; } [startTS!=0 and v_receivedLinkId == true] obuPort.receive { [v_startTS!=0 and v_receivedLinkId == true] obuPort.receive { transactionOBUTimer.stop; setverdict(fail, "Unexpected message received"); compPort.send(m_stop); stop; } [] transactionOBUTimer.timeout { setverdict (inconc, "No message was received"); setverdict (inconc, "No OBU message was received"); compPort.send(m_stop); stop; } Loading Loading @@ -91,7 +93,13 @@ module MainModule { stop; } []compPort.receive(m_stop) { setverdict (pass, "Number of empty messages received: " & int2str(v_cntEmpty)); if (v_cntEmpty <= PX_MAX_NUM_EMPTY_UPLINK_FRAMES){ 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) & ")"); } } []t_rsuTimer.timeout{ setverdict(inconc, "No RSU messaged received"); Loading @@ -104,7 +112,7 @@ module MainModule { map(mtc:controlPort, system:controlPort); controlPort.call(setTraceFile:{TRACE_PATH}, 5.0) { controlPort.call(setTraceFile:{PX_TRACE_PATH}, 5.0) { [] controlPort.getreply(setTraceFile:{-} value true) { setverdict (pass); } Loading @@ -120,7 +128,7 @@ module MainModule { controlPort.call(getTransactionCnt:{}, 5.0) { [] controlPort.getreply(getTransactionCnt:{} value ?) -> value p_nrOfTransactions { setverdict (pass); setverdict (pass, "Number of Transaction = " & int2str(p_nrOfTransactions)); } [] controlPort.getreply { setverdict (fail, "Unexpected reply"); Loading @@ -146,7 +154,7 @@ module MainModule { obuComponent.start(f_obuBehaviour()); rsuComponent.start(f_rsuBehaviour()); log ("Starting analysis of trace: ", p_traceIndex); log ("Starting analysis of trace: " & int2str(p_traceIndex)); controlPort.call(startAnalyzeTrace:{p_traceIndex}, 5.0) { [] controlPort.getreply(startAnalyzeTrace:{-} value true) { Loading @@ -165,13 +173,21 @@ module MainModule { all component.done; } testcase TC_Trace_File_Summary(inout integer p_traceIndex) runs on MtcType system SystemType { var ObuType obuComponent := ObuType.create("OBU"); //DL var RsuType rsuComponent := RsuType.create("RSU"); //UL log ("Summary analysis of all traces in : " & PX_TRACE_PATH); } control { var integer v_nrOfTransactions := 0; execute(TC_Initialization(v_nrOfTransactions)); log("Number of traces: " , v_nrOfTransactions); for(var integer i:=0; i<v_nrOfTransactions; i:=i + 1) { execute(TC_AnalyzesTrace(i)); } execute(TC_Trace_File_Summary(v_nrOfTransactions)); } } No newline at end of file
TraceParser/TraceParserSystem.ttcn3 +4 −2 Original line number Diff line number Diff line module TraceParserSystem { modulepar charstring TRACE_PATH:= "C:\Demo_Dump2.txt"; /* @desc Path to file that holds the trace */ modulepar charstring PX_TRACE_PATH:= "C:\Demo_Dump2.txt"; /* @desc Maximum allowed number of empty uplink frames from the On Board Unit (OBU) */ modulepar integer PX_MAX_NUM_EMPTY_UPLINK_FRAMES:= 100; type port TraceMsgPortType message{ in PayloadStructure; Loading