Commit c42a402c authored by tepelmann's avatar tepelmann
Browse files

Implemented test cases based on the latest TP document (May 2013).

parent 42b0dfa2
/**
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing common functions for ITS CAM
* @author ETSI / STF405 / STF449
* @version $URL$
* $Id$
* @desc Module containing common functions for ITS CAM
*
*/
module LibItsCam_Functions {
......@@ -17,6 +17,7 @@ module LibItsCam_Functions {
import from LibItsCam_Pixits all;
import from LibItsCam_TypesAndValues all;
import from LibItsCommon_Functions all;
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
......@@ -79,7 +80,7 @@ module LibItsCam_Functions {
* @param p_event The event to check.
* @param p_discard The event should not appear. Default value: FALSE.
*/
function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard) runs on ItsCam {
function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard := false) runs on ItsCam {
var template (value) UtCheck v_utMsg := { p_event };
utPort.send(v_utMsg);
......@@ -149,7 +150,7 @@ module LibItsCam_Functions {
* @desc basic default behaviour handling
*/
altstep a_default() runs on ItsCam {
[] camPort.receive(mw_camInd ( mw_camMsg_any )){
log("*** a_default: INFO: CAM message received in default ***");
vc_camReceived := true;
......@@ -185,8 +186,8 @@ module LibItsCam_Functions {
f_utInitializeIut(m_camInitialize);
// basic default altstep
activate(a_default());
// basic default altstep
activate(a_default());
} // end f_prInitialState
......@@ -202,100 +203,33 @@ module LibItsCam_Functions {
}
} // end group postambles
group otherFunctions {
/** @desc function to generate a random bitstring value
* corresponding to 1 bit position set to 1 (eg '00010000', '01000000', ...)
* @see f_random
* @param p_length bitstring length - max 15
* @return bitstring
*
*/
function f_bitPositionRandom( in integer p_length )
return bitstring {
//Variables
var bitstring v_random := '1'B;
var integer i := 0;
for(i:=0; i < (p_length - 1); i:=i+1) {
v_random := '0'B & v_random;
}
v_random := v_random << f_random(0, (p_length - 1));
log("*** f_bitPositionRandom: INFO: OK - random value = " & bit2str(v_random) & " ***");
return v_random;
} // end function f_bitPositionRandom
} // end group otherFunctions
group getIutFunctions {
/**
* @desc Function to get the PT Line Description
* @see PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE
*/
function f_getIutPtLineDescription()
return PTLineDescription {
var PTLineDescription v_ptLineDescription := {"", "", ""};
v_ptLineDescription := {PX_PTLINE_COURSE, PX_PTLINE_REF, PX_PTLINE_ROUTE};
return v_ptLineDescription ;
} // end function f_getIutPtLineDescription
} // end getIutFunctions
group getTesterFunctions {
group camPositionFunctions {
/**
* @desc Gets tester's station characteristics
* @return Station characteristics
* @see PX_TESTER_IS_MOBILE, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT
*/
function f_getTesterStationCharacteristics()
return CoopAwareness.stationCharacteristics {
var CoopAwareness.stationCharacteristics v_stationCharacteristics := { true, true, true };
v_stationCharacteristics := {PX_TESTER_IS_MOBILE, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT};
return v_stationCharacteristics ;
} // end f_getTesterStationCharacteristics
/**
* @desc Creates a valid CAM for tester
* @desc Compute a position using a reference position, a distance
* and an orientation
*
* @param p_referencePosition The base reference position.
* @param p_offSet Distance to the reference position (in meter).
*
* @return The new reference position.
*/
function f_getTesterValidCam()
return template (value) CamPdu {
var CoopAwareness.stationCharacteristics v_stationCharacteristics;
if(PX_TESTER_IS_MOBILE == false) {
// basic IRS
v_stationCharacteristics := {false, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT};
return m_camMsg_irs(
f_getCurrentTime(),
f_getTsStationId(),
v_stationCharacteristics,
m_tsPosition
);
}
else {
// Vehicle
v_stationCharacteristics := {true, PX_TESTER_IS_PRIVATE, PX_TESTER_IS_PHYSICAL_RELEVANT};
return m_camMsg_vehicle(
f_getCurrentTime(),
f_getTsStationId(),
v_stationCharacteristics,
m_tsPosition
);
}
} // end f_getTesterValidCam
function f_computePositionUsingDistance(in ReferencePosition p_referencePosition, in integer p_offSet) return ReferencePosition {
var ReferencePosition v_referencePosition := p_referencePosition;
log("*** f_computePositionUsingDistance: INFO: calling fx_computePositionUsingDistance() ***");
fx_computePositionUsingDistance(
p_referencePosition.latitude,
p_referencePosition.longitude,
p_offSet,
p_referencePosition.positionConfidenceEllipse.semiMajorOrientation.headingValue,
v_referencePosition.latitude,
v_referencePosition.longitude
);
return v_referencePosition;
}
} // end getTesterFunctions
} // end group camPositionFunctions
} // end LibItsCam_Functions
\ No newline at end of file
/**
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc CAM PICS
* @author ETSI / STF405 / STF449
* @version $URL$
* $Id$
* @desc CAM PICS
*
*/
module LibItsCam_Pics {
......@@ -13,110 +13,82 @@ module LibItsCam_Pics {
group camPics {
/**
* @desc Is IUT a basic vehicle
* @see ETSI TS 102 868-1 v1.1.1 A.2/1
* @desc Is IUT a public transport vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/1
*/
modulepar boolean PICS_BASICVEH := false;
modulepar boolean PICS_PUBLICTRANS := false;
/**
* @desc Is IUT a basic IRS
* @see ETSI TS 102 868-1 v1.1.1 A.3/1
* @desc Is IUT a special transport vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/2
*/
modulepar boolean PICS_BASICIRS := false;
modulepar boolean PICS_SPECIALTRANS := false;
/**
* @desc Does IUT support 'CurvatureGradient' indicatio
* @see ETSI TS 102 868-1 v1.1.1 A.16/32
* @desc Is IUT a dangerous goods vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/3
*/
modulepar boolean PICS_CURVCHANGE := false;
modulepar boolean PICS_DANGEROUSGOODS := false;
/**
* @desc Does IUT support 'DoorOpen' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/28
* @desc Is IUT a road works vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/4
*/
modulepar boolean PICS_DOOROPEN := false;
modulepar boolean PICS_ROADWORKS := false;
/**
* @desc Does IUT support 'distanceToStopLine' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/23
* @desc Is IUT a rescue vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/5
*/
modulepar boolean PICS_DISTTOSTOPLINE := false;
modulepar boolean PICS_RESCUE := false;
/**
* @desc Is IUT an emergency vehicle
* @see ETSI TS 102 868-1 v1.1.1 A.2/2
*/
modulepar boolean PICS_EMERVEH := false;
/**
* @desc Does IUT support 'lightBarInUse' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/3
*/
modulepar boolean PICS_LIGHTBARINUSE := false;
/**
* @desc Does IUT support 'Occupancy' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/25
*/
modulepar boolean PICS_OCCUPANCY := false;
/**
* @desc Does IUT support 'PTLineDescription' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/22
* @see ETSI TS 102 868-1 v0.0.1 A.12/6
*/
modulepar boolean PICS_PTLINEDESCRIPTION := false;
modulepar boolean PICS_EMERGENCY := false;
/**
* @desc Is IUT a public transport vehicle
* @see ETSI TS 102 868-1 v1.1.1 A.2/3
* @desc Is IUT a safety car vehicle
* @see ETSI TS 102 868-1 v0.0.1 A.12/7
*/
modulepar boolean PICS_PUBTRANSVEH := false;
/**
* @desc Does IUT support 'ScheduleDeviation' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/27
*/
modulepar boolean PICS_SCHEDULEDEVIATION := false;
modulepar boolean PICS_SAFETY_CAR := false;
/**
* @desc Does IUT support 'SireneInUse' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/4
* @desc Does IUT support 'lowFrequencyContainer' in CamParameters?
* @see ETSI TS 102 868-1 v0.0.1 A.8/3
*/
modulepar boolean PICS_SIRENEINUSE := false;
/**
* @desc Does IUT support 'TrafficLightPriority' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/28
*/
modulepar boolean PICS_TRAFFICLIGHTPRIORITY := false;
modulepar boolean PICS_LOWFREQUENCYCONTAINER := true;
/**
* @desc Does IUT support 'turnAdvice' indication
* @see ETSI TS 102 868-1 v1.1.1 A.16/22
* @desc Does IUT support 'specialVehicleContainer' in CamParameters?
* @see ETSI TS 102 868-1 v0.0.1 A.8/4
*/
modulepar boolean PICS_TURNADVICE := false;
modulepar boolean PICS_SPECIALVEHICLECONTAINER := true;
/**
* @desc Minimum time interval between CAM generations (in seconds)
* Default value, as per base standard: 0,1s
* @see ETSI TS 102 868-1 v1.1.1 A.66/1
* @desc Minimum time interval between CAM generations (in seconds)
* according to the requirements of the
* Decentralized Congestion Control(DCC).
* Default value, as per base standard: 0.1s
* @see ETSI TS 102 868-1 v0.0.1 A.22/4
*/
modulepar float PICS_CAM_MIN_TRANSMISSION_INTERVAL := 0.1;
modulepar float PICS_T_GENCAMDCC := 0.100;
/**
* @desc Maximum time interval between CAM generations (in seconds)
* Default value, as per base standard: 1s
* @see ETSI TS 102 868-1 v1.1.1 A.66/2
* @desc Maximum time interval between CAM generations (in seconds).
* Default value, as per base standard: 1.0s
* @see ETSI TS 102 868-1 v0.0.1 A.22/1
*/
modulepar float PICS_CAM_MAX_TRANSMISSION_INTERVAL := 1.0;
modulepar float PICS_T_GENCAMMAX := 1.000;
/**
* @desc Duration of doors closure for situational mandatory TaggedValue
* Default value, as per base standard: 30s
* @see ETSI TS 102 868-1 v1.1.1 A.66/5
* @desc Minimum time interval between CAM generations (in seconds).
* Default value, as per base standard: 0.1s
* @see ETSI TS 102 868-1 v0.0.1 A.22/2
*/
modulepar float PICS_DOORS_CLOSED_TIMER := 30.0;
modulepar float PICS_T_GENCAMMIN := 0.100;
} // end camPics
} // end LibItsCam_Pics
This diff is collapsed.
/**
* @author ETSI / STF405
* @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/LibIts/trunk/ttcn/LibIts_TestSystem.ttcn $
* $Id: LibIts_TestSystem.ttcn 408 2012-02-28 13:49:56Z garciay $
* @desc Test System module for ITS CAM
* @author ETSI / STF405 / STF449
* @version $URL: svn+ssh://vcs.etsi.org/TTCN3/LIB/LibIts/trunk/ttcn/LibIts_TestSystem.ttcn $
* $Id: LibIts_TestSystem.ttcn 408 2012-02-28 13:49:56Z garciay $
* @desc Test System module for ITS CAM
*
*/
module LibItsCam_TestSystem {
......@@ -86,7 +86,6 @@ module LibItsCam_TestSystem {
var default vc_default := null;
//global variables
var SequenceNo vc_sequenceNo := 0;
var boolean vc_camReceived := false;
} // End of component ItsCam
......@@ -99,7 +98,7 @@ module LibItsCam_TestSystem {
* @desc FA1 CAM Indication Primitive
*/
type record CamInd {
CamPdu msgIn
CAM msgIn
}
with {
encode (msgIn) "LibItsCam_asn1"
......@@ -109,7 +108,7 @@ module LibItsCam_TestSystem {
* @desc FA1 CAM Request Primitive
*/
type record CamReq {
CamPdu msgOut
CAM msgOut
}
with {
encode (msgOut) "LibItsCam_asn1"
......
/**
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing types and values for CAM Protocol
* @author ETSI / STF405 / STF449
* @version $URL$
* $Id$
* @desc Module containing types and values for CAM Protocol
*
*/
module LibItsCam_TypesAndValues {
......@@ -12,98 +12,58 @@ module LibItsCam_TypesAndValues {
import from LibCommon_DataStrings all;
// LibIts
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
import from DENM_PDU_Descriptions language "ASN.1:1997" all;
group camValues {
const boolean c_precisely := true;
const boolean c_notPrecisely := false;
const CrashStatus c_activated := true;
const CrashStatus c_deactivated := false;
const AccelerationControl c_acIdle := '000000'B;
const AccelerationControl c_cruiseControl := '001000'B;
const AccelerationControl c_acc := '000100'B;
const AccelerationControl c_limiter := '000010'B;
const AccelerationControl c_brakeAssist := '000001'B;
const AccelerationControl c_throttlePedal := '010000'B;
const AccelerationControl c_brakePedal := '100000'B;
const float c_lowFrequencyGenerationTime := 0.5; //500 ms
const float c_specialVehicleGenerationTime := 0.5; //500 ms
const DangerousGoods c_noDangerousGoodsTransported := 0;
const Direction c_south := 14400;
const Direction c_north := 0;
const Direction c_east := 7200;
const Direction c_west := 21600;
const DoorOpen c_doorsClosed := '0000'B;
const DoorOpen c_passengerDoor := '0100'B;
const DoorOpen c_luggageDoor := '0001'B;
const DoorOpen c_maintenanceDoor := '0010'B;
const DoorOpen c_driverDoor := '1000'B;
const ExteriorLights c_elAllLightsOff := '00000000'B;
const ExteriorLights c_automaticLightControlOn := '00001000'B;
const ExteriorLights c_rightTurnSignalOn := '00010000'B;
const ExteriorLights c_leftTurnSignalOn := '00100000'B;
const ExteriorLights c_hazardConditionsOn := '00110000'B;
const ExteriorLights c_lowBeamHeadlightsOn := '10000000'B;
const ExteriorLights c_fogLightOn := '00000010'B;
const ExteriorLights c_parkingLightsOn := '00000001'B;
const ExteriorLights c_highBeamHeadlightsOn := '01000000'B;
const ExteriorLights c_daytimeRunningLightsOn := '00000100'B;
const AccelerationControl c_accCtrlIdle := '0000000'B;
const ExteriorLights c_elAllLightsOff := '00000000'B;
const TurnDirection c_tdAllIndicatorsOff := '00000000'B;
const TurnDirection c_sharpLeft := '00000001'B;
const TurnDirection c_uTurn := '10000000'B;
const TurnDirection c_slightLeft := '00000100'B;
const TurnDirection c_left := '00000010'B;
const TurnDirection c_straight := '00001000'B;
const TurnDirection c_right := '00100000'B;
const TurnDirection c_slightRight := '00010000'B;
const TurnDirection c_sharpRight := '01000000'B;
} // end group camValues
group utPrimitives {
group utCommonPrimitives {
/**
* @desc Upper Tester message to initialize IUT
*/
type union UtInitialize {
UtCamInitialize utCamInitialize
}
/**
* @desc Upper Tester message describing an action/event
*/
type union UtEvent {
UtCamEvent utCamEvent
}
/**
* @desc Upper Tester message to trigger an action on IUT
*/
type record UtTrigger {
UtEvent utEvent
}
/**
* @desc Upper Tester message to check event/status on IUT
*/
type record UtCheck {
UtEvent utEvent
}
/**
* @desc Upper Tester response message
*/
type boolean UtResult;
}
/**
* @desc Upper Tester message to initialize IUT
*/
type union UtInitialize {
UtCamInitialize utCamInitialize
}
/**
* @desc Upper Tester message describing an action/event
*/
type union UtEvent {
UtCamEvent utCamEvent
}
/**
* @desc Upper Tester message to trigger an action on IUT
*/
type record UtTrigger {
UtEvent utEvent
}
/**
* @desc Upper Tester message to check event/status on IUT
*/
type record UtCheck {
UtEvent utEvent
}
/**
* @desc Upper Tester response message
*/
type boolean UtResult;
}
with {
encode "LibItsCommon_TypesAndValues"
}
......@@ -113,46 +73,29 @@ module LibItsCam_TypesAndValues {
*/
type record UtCamInitialize {
}
/**
* @desc Events at the application layer of the IUT.
* @member changeHeading Changes the heading .
* @member changePosition Changes the position in the direction of the current heading in meters.
* @member changeSpeed Changes the speed.
* @member setCrashSignal Sets the crash signal.
* @member setDangerousGoodsStatus Sets the dangerous goods status.
* @member setLengthWidthPrecision Sets the length width precision.
* @member setDistanceToStopLine Set the distance to the stop line.
* @member setTurnAdvice Sets the turn advice.
* @desc
* @member changeCurvature Changes the curvature.
* @member setOccupancy Sets the occupancy.
* @member setDoorStatus Sets the door status.
* @member setLightBarStatus Sets the light bar status.
* @member setSireneStatus Sets the sirene status.
* @member setTrafficLightPriority Sets the traffic light priority.
* @member setScheduleDeviation Sets the schedule deviation.
* @member setPtLineDescription Sets the PT line description.
* @member setExteriorLightsStatus Sets the extirior lights status.
* @member changeSpeed Changes the speed in cm/s.
* @member setAccelerationControlStatus Sets the acceleration control status.
* @member setExteriorLightsStatus Sets the exterior lights status.
* @member changeHeading Changes the heading.
* @member setDriveDirection Sets the drive direction.
* @member changeYawRate Changes the yaw rate in offsets of 0.01 degrees per second.
* @member changePosition Changes the position in the direction of the current heading in meters.
* @member checkLdm Checks that the received CAM was provided at LDM.
*/
type union UtCamEvent {
Direction changeHeading,
integer changePosition,
Speed changeSpeed,
CrashStatus setCrashSignal,
DangerousGoods setDangerousGoodsStatus,
boolean setLengthWidthPrecision,
Distance setDistanceToStopLine,
TurnAdvice setTurnAdvice,
Curvature changeCurvature,
Occupancy setOccupancy,
DoorOpen setDoorStatus,
SimpleSystemState setLightBarStatus,
SimpleSystemState setSireneStatus,
Priority setTrafficLightPriority,
ScheduleDeviation setScheduleDeviation,
PTLineDescription setPtLineDescription,
CurvatureValue changeCurvature,
SpeedValue changeSpeed,
AccelerationControl setAccelerationControlStatus,
ExteriorLights setExteriorLightsStatus,
CamPdu checkLdm
HeadingValue changeHeading,
DriveDirection setDriveDirection,
YawRateValue changeYawRate,
integer changePosition,
CAM checkLdm
}
} // end utPrimitives
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment