Newer
Older
* @author ETSI / STF405
* @version $URL$
* $Id$
* @desc Module containing functions for GeoNetworking
// Libcommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_VerdictControl {type FncRetCode;}
import from LibCommon_Sync all;
// LibIts
import from LibIts_TestSystem all;
import from LibIts_Interface all;
import from LibItsGeoNetworking_Pics all;
* @desc Create Facility component and connects GeoNetworking port
* @remark Only used when ItsFa is a PTC
* @param p_ptcDenm returned Facility component variable
function f_ptcGeoNetworkingUp(out ItsNt p_ptcGeoNetworking) {
p_ptcGeoNetworking := ItsNt.create("GeoNetworking Tester");
// map ports
map(p_ptcGeoNetworking:geoNetworkingPort, system:geoNetworkingPort);
* @desc Wait for component to finish and unmap GeoNetworking ports
* @remark Only used when ItsFa is a PTC
* @param p_camPtc Facility component variable
function f_ptcGeoNetworkingDown(in ItsNt p_ptcGeoNetworking) runs on ItsMtc {
f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_ptcGeoNetworkingDown: Timeout while waiting for component ***");
}
}
unmap(p_ptcGeoNetworking:geoNetworkingPort);
group geoConfigurationFunctions {
/**
* @desc This configuration features:
* - one ITS node (IUT)
* - two ITS nodes (nodeA, nodeB)
* - Area1 which only includes NodeB and IUT
* - Area2 which only includes NodeB
* NodeB being close to the area center
*/
function f_cf01Up() runs on ItsNt {
// Variables
var PositionTable v_positionTable := {};
var LongPosVector v_iutLongPosVector, v_nodeALongPosVector, v_nodeBLongPosVector, v_nodeDLongPosVector;
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
map(self:geoNetworkingPort, system:geoNetworkingPort);
// Connect
f_connect4SelfOrClientSync();
//Initialze the IUT
f_initialState();
//Get positions
v_iutLongPosVector := f_getIutLongPosVector();
v_nodeALongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeA_longitudeFactor, c_compNodeA_latitudeFactor);
v_nodeBLongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeB_longitudeFactor, c_compNodeB_latitudeFactor);
v_nodeDLongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeD_longitudeFactor, c_compNodeD_latitudeFactor);
// Propagate GN addresses
v_nodeALongPosVector.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
v_nodeBLongPosVector.gnAddr := f_getTsGnLocalAddress(c_compNodeB);
// Position table
f_addPosition(v_positionTable, c_compIut, v_iutLongPosVector);
f_addPosition(v_positionTable, c_compNodeA, v_nodeALongPosVector);
f_addPosition(v_positionTable, c_compNodeB, v_nodeBLongPosVector);
// Area table
f_addArea(v_areaTable, c_area1,
f_computeSquareArea(v_nodeDLongPosVector, float2int(1.1 * f_distance(v_nodeBLongPosVector, v_nodeDLongPosVector))));
f_addArea(v_areaTable, c_area2,
f_computeSquareArea(v_nodeBLongPosVector, float2int(1.1 * f_distance(v_nodeBLongPosVector, v_nodeDLongPosVector))));
f_initialiseComponent(v_positionTable, v_areaTable, c_compNodeB);
*/
function f_cf01Down() runs on ItsNt {
unmap(self:acPort, system:acPort);
unmap(self:utPort, system:utPort);
unmap(self:geoNetworkingPort, system:geoNetworkingPort);
// Disconnect
f_disconnect4SelfOrClientSync();
} // end f_cf01Down
/**
* @desc This configuration features:
* - one ITS node (IUT)
* - one ITS node (NodeB)
* - one ITS node (NodeD)
* - Area1 which only includes NodeB, NodeD and IUT
* - Area2 which only includes NodeB and NodeD
* NodeB being close to the area center
function f_cf02Up(out ItsNt p_nodeB, out ItsNt p_nodeD) runs on ItsMtc {
// Variables
var PositionTable v_positionTable := {};
var LongPosVector v_iutLongPosVector, v_nodeBLongPosVector, v_nodeCLongPosVector, v_nodeDLongPosVector;
// Create
p_nodeB := ItsNt.create(c_compNodeB) alive;
map(p_nodeB:acPort, system:acPort);
map(p_nodeD:acPort, system:acPort);
map(p_nodeB:utPort, system:utPort);
map(p_nodeD:utPort, system:utPort);
map(p_nodeB:geoNetworkingPort, system:geoNetworkingPort);
map(p_nodeD:geoNetworkingPort, system:geoNetworkingPort);
// Connect
connect(p_nodeB:syncPort, self:syncPort);
//Initialze the IUT
f_initialState();
//Get positions
v_iutLongPosVector := f_getIutLongPosVector();
v_nodeBLongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeB_longitudeFactor, c_compNodeB_latitudeFactor);
v_nodeCLongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeC_longitudeFactor, c_compNodeC_latitudeFactor);
v_nodeDLongPosVector := f_computePosition(v_iutLongPosVector, c_compNodeD_longitudeFactor, c_compNodeD_latitudeFactor);
// Propagate GN addresses
v_nodeBLongPosVector.gnAddr := f_getTsGnLocalAddress(c_compNodeB);
v_nodeCLongPosVector.gnAddr := f_getTsGnLocalAddress(c_compNodeC);
v_nodeDLongPosVector.gnAddr := f_getTsGnLocalAddress(c_compNodeD);
f_addPosition(v_positionTable, c_compIut, v_iutLongPosVector);
f_addPosition(v_positionTable, c_compNodeB, v_nodeBLongPosVector);
f_addPosition(v_positionTable, c_compNodeD, v_nodeDLongPosVector);
// Area table
f_addArea(v_areaTable, c_area1,
f_computeSquareArea(v_nodeDLongPosVector, float2int(1.1 * f_distance(v_nodeBLongPosVector, v_nodeDLongPosVector))));
f_addArea(v_areaTable, c_area2,
f_computeSquareArea(v_nodeBLongPosVector, float2int(1.1 * f_distance(v_nodeBLongPosVector, v_nodeDLongPosVector))));
p_nodeB.start(f_initialiseComponent(v_positionTable, v_areaTable, c_compNodeB));
p_nodeD.start(f_initialiseComponent(v_positionTable, v_areaTable, c_compNodeD));
function f_cf02Down(in ItsNt p_nodeB, in ItsNt p_nodeD) runs on ItsMtc {
Loading full blame...