Skip to content
LibItsDenm_Templates.ttcn 20.6 KiB
Newer Older
tepelmann's avatar
tepelmann committed
 *	@author 	ETSI / STF449
berge's avatar
berge committed
 *  @version 	$URL$
 *				$Id$
 *	@desc		Module containing base template definitions for DENM
 *
 */
module LibItsDenm_Templates {
tepelmann's avatar
tepelmann committed
    //LibIts
tepelmann's avatar
tepelmann committed
    import from LibItsCommon_TypesAndValues all;
    import from LibItsCommon_Functions all;
reinaortega's avatar
reinaortega committed
    import from LibItsDenm_TestSystem all;
    import from LibItsDenm_TypesAndValues all;
tepelmann's avatar
tepelmann committed
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
tepelmann's avatar
tepelmann committed
    import from ITS_Container language "ASN.1:1997" all;
tepelmann's avatar
tepelmann committed

    group primitivesTemplates {
        /**
         * @desc    Send template for DEN Message (DenmPort Primitive)
         * @param   p_denMsg DEN Message to be sent
         */
        template (value) DenmReq m_denmReq(
tepelmann's avatar
tepelmann committed
            template (value) DENM p_denMsg
tepelmann's avatar
tepelmann committed
            ) := {
            msgOut := p_denMsg
        }
        
        /**
         * @desc    Receive template for DEN Message (DenmPort Primitive)
         * @param   p_denMsg Expected DEN Message
tepelmann's avatar
tepelmann committed
        template DenmInd mw_denmInd(
tepelmann's avatar
tepelmann committed
            template (present) DENM p_denMsg
tepelmann's avatar
tepelmann committed
            ) := {
berge's avatar
berge committed
            msgIn := p_denMsg,
            receptionTime := ?
tepelmann's avatar
tepelmann committed
        }
        
        group utPrimitives {
            
            /**
             * @desc Initializes the DENM IUT. 
             */
            template (value) UtInitialize m_denmInitialize := {
            }
            
             * @desc    Send template for Upper Tester Trigger event
            template (value) UtTrigger m_utTriggerEvent(
tepelmann's avatar
tepelmann committed
                template (value) SituationContainer p_situation,
                template (value) LocationContainer p_location,
tepelmann's avatar
tepelmann committed
                template (omit) ValidityDuration p_validityDuration := omit,
tepelmann's avatar
tepelmann committed
                template (omit) TransmissionInterval p_transmissionInterval := omit,
                template (omit) boolean p_keepAliveForwardingRequest := omit,
                template (omit) AlacarteContainer p_alacarte := omit
            ) := {
                detectionTime := f_getCurrentTime(),
tepelmann's avatar
tepelmann committed
                validityDuration := c_validityDuration_10sec,
tepelmann's avatar
tepelmann committed
                repetitionDuration := 10,
                situtation := p_situation,
                location := p_location,
                alacarte := p_alacarte,
                relevanceDistance := lessThan50m,
                relevanceTrafficDirection := allTrafficDirection,
                trafficClass := 0,
                transmissionInterval := p_transmissionInterval,
                keepAliveForwardingRequest := p_keepAliveForwardingRequest
tepelmann's avatar
tepelmann committed
            template (value) UtUpdate m_utUpdateEvent(
                template (value) ActionID p_actionId,
                template (omit) SituationContainer p_situation := omit,
                template (omit) LocationContainer p_location := omit,
                template (omit) ValidityDuration p_validityDuration := omit,
                template (omit) RelevanceDistance p_relevanceDistance := omit,
                template (omit) RelevanceTrafficDirection p_relevanceTrafficDirection := omit,
                template (omit) integer p_trafficClass := omit,
                template (omit) TransmissionInterval p_transmissionInterval := omit,
                template (omit) boolean p_keepAliveForwardingRequest := omit,
                template (omit) AlacarteContainer p_alacarte := omit
            ) := {
                actionId := p_actionId,
                detectionTime := f_getCurrentTime(),
                validityDuration := p_validityDuration,
                situation := p_situation,
                location := p_location,
                alacarte := p_alacarte,
                relevanceDistance := p_relevanceDistance,
                relevanceTrafficDirection := p_relevanceTrafficDirection,
                trafficClass := p_trafficClass,
                transmissionInterval := p_transmissionInterval,
                keepAliveForwardingRequest := p_keepAliveForwardingRequest
            }
            
            /**
             * @desc    Send template for Upper Tester event cancellation
             * @param   p_actionId      Action ID of the event to be cancelled
tepelmann's avatar
tepelmann committed
            template (value) UtTermination m_utEventCancellation(
                in template (value) ActionID p_actionId
tepelmann's avatar
tepelmann committed
            ) := {
                actionId := p_actionId
berge's avatar
berge committed
            template (value) UtChangePosition m_utChangePosition(
	            in template (value) integer p_latitude,
	            in template (value) integer p_longitude,
	            in template (value) integer p_elevation := 0
	        ) := {
	        	latitude := p_latitude,
	        	longitude := p_longitude,
	        	elevation := p_elevation
	        }
            
        } // end utPrimitives
      
tepelmann's avatar
tepelmann committed
    } // end primitives
    
    group denmPduTemplates {
        
tepelmann's avatar
tepelmann committed
         * @desc    Send template for DENM PDU
         * @param   p_denm  DEN Message
tepelmann's avatar
tepelmann committed
        template (value) DENM m_denmPdu(
            in template (value) DecentralizedEnvironmentalNotificationMessage p_denm
        ) := {
            header := m_itsPduHeader,
            denm := p_denm
        /**
         * @desc    Receive template for DENM PDU
         * @param   p_denm  DEN Message 
         */
        template DENM mw_anyDenmPdu(
            in template (present) ItsPduHeader p_itsPduHeader := ?,
            in template (present) DecentralizedEnvironmentalNotificationMessage p_denm := ?
        ) := {
            header := p_itsPduHeader,
            denm := p_denm
        }
        
tepelmann's avatar
tepelmann committed
         * @desc    Receive template for DENM PDU
         * @param   p_denm  DEN Message 
tepelmann's avatar
tepelmann committed
        template DENM mw_denmPdu(
            in template (present) DecentralizedEnvironmentalNotificationMessage p_denm,
            template (present) StationID p_stationID := ?,
            template (present) ItsPduHeader.protocolVersion p_protocolVersion := c_protocolVersionDenm,
            template (present) ItsPduHeader.messageID p_messageID := c_messageId
        ) := {
            header := mw_itsPduHeader(p_stationID, p_protocolVersion, p_messageID),
            denm := p_denm
tepelmann's avatar
tepelmann committed
        
    } // end denmPduTemplates
    
    group headerTemplates {
        
tepelmann's avatar
tepelmann committed
         * @desc    Default send template for ITS PDU header
         * @param   p_stationID Source station ID
         * @param   p_protocolVersion Protocol version (Default: current DENM protocol version)
         * @param   p_messageID Message Id of DENM (Default: DENM message id)
tepelmann's avatar
tepelmann committed
        template (value) ItsPduHeader m_itsPduHeader(
            template (value) StationID p_stationID := f_getTsStationId(),
            template (value) ItsPduHeader.protocolVersion p_protocolVersion := c_protocolVersionDenm,
            template (value) ItsPduHeader.messageID p_messageID := c_messageId
tepelmann's avatar
tepelmann committed
            protocolVersion := p_protocolVersion,
            messageID := p_messageID,
            stationID := p_stationID
tepelmann's avatar
tepelmann committed
         * @desc    Default receive template for ITS PDU header
tepelmann's avatar
tepelmann committed
        template ItsPduHeader mw_itsPduHeader(
            template (present) StationID p_stationID := ?,
            template (present) ItsPduHeader.protocolVersion p_protocolVersion := c_protocolVersionDenm,
            template (present) ItsPduHeader.messageID p_messageID := c_messageId
tepelmann's avatar
tepelmann committed
            protocolVersion := p_protocolVersion,
            messageID := p_messageID,
            stationID := p_stationID
        }
        
berge's avatar
berge committed
        template (present) StationID mw_anyStationId := ?;
tepelmann's avatar
tepelmann committed
    } // end headerTemplates
    
    group positionTemplates {
tepelmann's avatar
tepelmann committed
        
        template (value) ReferencePosition m_tsPosition(
            template (value) Longitude p_longitude := f_getTsLongitude(),
            template (value) Latitude p_latitude := f_getTsLatitude()
        ) := {
            longitude := p_longitude,
            latitude := p_latitude,
            positionConfidenceEllipse := m_posConfidenceEllipse,
            elevation := m_elevation
        }
        
        template (value) PosConfidenceEllipse m_posConfidenceEllipse(
            template (value) SemiAxisLength p_semiMajorConfidence := c_semiAxisLengthOneCentimeter,
            template (value) SemiAxisLength p_semiMinorConfidence := c_semiAxisLengthOneCentimeter,
            template (value) Direction p_semiMajorOrientation := m_direction
        ) := {
            semiMajorConfidence := p_semiMajorConfidence,
            semiMinorConfidence := p_semiMinorConfidence,
            semiMajorOrientation := p_semiMajorOrientation
        }
        
        template (value) Direction m_direction := {
            directionValue := c_directionValueNorth,
            directionConfidence := c_directConfidenceWithinZeroPointOneDegree
        }
          
        template (value) Elevation m_elevation(
            template (value) ElevationValue p_elevationValue := c_seaLevel,
            template (value) ElevationConfidence p_elevationConfidence := c_withinOneMeter
        ) := {
            elevationValue := p_elevationValue,
            elevationConfidence := p_elevationConfidence
        }
        
    } // end positionTemplates
    
berge's avatar
berge committed
    group decentralizedEnvironmentalNotificationMessageTemplates {
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Send template for DEN Message
         * @param   p_mgmt  Decentralized Situation Management  
         * @param   p_sit   Decentralized Situation
         * @param   p_loc   Decentralized Situation Location
         */
        template (value) DecentralizedEnvironmentalNotificationMessage m_denm(
tepelmann's avatar
tepelmann committed
            template (value) ManagementContainer p_mgmt,
            template (omit) SituationContainer p_sit,
            template (omit) LocationContainer p_loc,
            template (omit) AlacarteContainer p_alacarte := omit
tepelmann's avatar
tepelmann committed
            ) := {
            management := p_mgmt, 
            situation := p_sit, 
tepelmann's avatar
tepelmann committed
            location := p_loc,
            alacarte := p_alacarte
tepelmann's avatar
tepelmann committed
        }
        /**
         * @desc    Default receive template for DEN Message
berge's avatar
berge committed
        template DecentralizedEnvironmentalNotificationMessage mw_anyDenm := {
            management := ?, 
tepelmann's avatar
tepelmann committed
            situation := *, 
            location := *,
            alacarte := *
        }
        
        /**
         * @desc    Receive template for DEN Message
         * @param   p_mgmt  Decentralized Situation Management 
         * @param   p_sit   Decentralized Situation
         * @see     mw_anyDenm    
tepelmann's avatar
tepelmann committed
        template DecentralizedEnvironmentalNotificationMessage mw_denm(
tepelmann's avatar
tepelmann committed
            template (present) ManagementContainer p_mgmt := ?,
            template SituationContainer p_sit := *,
berge's avatar
berge committed
            template LocationContainer p_loc := *,
            template AlacarteContainer p_alacarte := *
berge's avatar
berge committed
            ) modifies mw_anyDenm := {
tepelmann's avatar
tepelmann committed
            management := p_mgmt, 
            situation := p_sit, 
berge's avatar
berge committed
            location := p_loc,
            alacarte := p_alacarte
tepelmann's avatar
tepelmann committed
        }
tepelmann's avatar
tepelmann committed
         * @desc    Send template for DEN Message for event termination.
tepelmann's avatar
tepelmann committed
        template (value) DecentralizedEnvironmentalNotificationMessage m_denmCancellation(
            template (value) ActionID p_actionID
tepelmann's avatar
tepelmann committed
            ) := {
tepelmann's avatar
tepelmann committed
            management := m_denmMgmtCon(p_actionID, c_dataVersionCancellation), 
            situation := omit, 
            location := omit,
            alacarte := omit
tepelmann's avatar
tepelmann committed
        }
tepelmann's avatar
tepelmann committed
         * @desc    Send template for DEN Message for event termination.
tepelmann's avatar
tepelmann committed
        template (value) DecentralizedEnvironmentalNotificationMessage m_denmNegation(
            template (value) ActionID p_actionID,
            template (value) DataVersion p_dataVersion
            ) := {
            management := m_denmMgmtCon(p_actionID, p_dataVersion, true), 
            situation := omit, 
            location := omit,
            alacarte := omit
tepelmann's avatar
tepelmann committed
        }
berge's avatar
berge committed
    } // end group decentralizedEnvironmentalNotificationMessageTemplates
tepelmann's avatar
tepelmann committed
    
    group decentralizedManagementTemplates {
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Send template for Decentralized Situation Management
         * @param   p_dataVersion   Data version
         * @param   p_stationId     Station ID of the source
tepelmann's avatar
tepelmann committed
        template (value) ManagementContainer m_denmMgmtCon(
            template (value) ActionID p_actionID,
berge's avatar
berge committed
            template (value) DataVersion p_dataVersion,
berge's avatar
berge committed
            template (value) boolean p_isNegation := false,
            template (omit) ValidityDuration p_validityDuration := omit,
            template (omit) TransmissionInterval p_transmissionInterval := omit
tepelmann's avatar
tepelmann committed
            ) := {
tepelmann's avatar
tepelmann committed
            actionID := p_actionID,
tepelmann's avatar
tepelmann committed
            dataVersion := p_dataVersion,
tepelmann's avatar
tepelmann committed
            detectionTime := f_getCurrentTime(),
            isNegation := p_isNegation,
            eventPosition := m_tsPosition,
            relevanceDistance := lessThan50m,
            relevanceTrafficDirection := allTrafficDirection,
berge's avatar
berge committed
            validityDuration := p_validityDuration,
            transmissionInterval := p_transmissionInterval
        }

berge's avatar
berge committed
        /**
         * @desc    Reception template for Decentralized Situation Management
         * @param   p_dataVersion   Data version
         * @param   p_stationId     Station ID of the source
         */
        template ManagementContainer mw_denmMgmtCon(
            template (present) ActionID p_actionID,
            template (present) DataVersion p_dataVersion := ?,
            template (present) boolean p_isNegation := false,
            template ValidityDuration p_validityDuration := *,
            template TransmissionInterval p_transmissionInterval := *
            ) := {
            actionID := p_actionID,
            dataVersion := p_dataVersion,
            detectionTime := ?,
            isNegation := p_isNegation,
            eventPosition := ?,
            relevanceDistance := ?,
            relevanceTrafficDirection := allTrafficDirection,
            validityDuration := p_validityDuration,
            transmissionInterval := p_transmissionInterval
        }

berge's avatar
berge committed
        /**
         * @desc    Send template for Test system ActionID
         */        
tepelmann's avatar
tepelmann committed
        template (value) ActionID m_tsActionId(
            in template (value) SequenceNumber p_sequenceNumber := 0
        ) := {
tepelmann's avatar
tepelmann committed
        	originatorStationID := f_getTsStationId(),
tepelmann's avatar
tepelmann committed
            sequenceNumber := p_sequenceNumber
        /**
         * @desc    Receive template for Management Container
         */
        template ManagementContainer mw_anyDenmMgmtCon := {
            actionID := ?,
            dataVersion := ?,
            detectionTime := ?,
            isNegation := ?,
            eventPosition := ?,
            relevanceDistance := ?,
            relevanceTrafficDirection := ?,
tepelmann's avatar
tepelmann committed
            validityDuration := *,
            transmissionInterval := *
        }
        
        /**
         * @desc    Receive template for Management Container
         */
        template ManagementContainer mw_denmMgmtConWithActionID(
            in template (present) ActionID p_actionId := ?
        ) modifies mw_anyDenmMgmtCon := {
            actionID := p_actionId
        }
        
        /**
         * @desc    Receive template for Management Container
         */
        template ManagementContainer mw_denmMgmtConWithDataVersion(
            in template (present) DataVersion p_dataVersion := ?
        ) modifies mw_anyDenmMgmtCon := {
            dataVersion := p_dataVersion
        }
        
        /**
         * @desc    Receive template for ActionID
         */
        template (value) ActionID m_actionId(
            in template (value) SequenceNumber p_sequenceNumber,
            in template (value) ITS_Container.StationID p_originatorStationID := f_getIutStationId()
        ) := {
            originatorStationID := p_originatorStationID,
            sequenceNumber := p_sequenceNumber
        }
        
        /**
         * @desc    Receive template for ActionID
         */
berge's avatar
berge committed
        template (present) ActionID mw_actionId(
            in template (present) ITS_Container.StationID p_originatorStationID := ?,
            in template (present) SequenceNumber p_sequenceNumber := ?
        ) := {
            originatorStationID := p_originatorStationID,
            sequenceNumber := p_sequenceNumber
        }
        
berge's avatar
berge committed
        /**
         * @desc    Receive template for any ActionID
         */
        template (present) ActionID mw_anyActionId := ?;
        
    } // end group decentralizedManagementTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationTemplates {
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
        group situationTemplates {
tepelmann's avatar
tepelmann committed
            
            /**
             * @desc    Send template for situation
             * @param   p_cause     Cause code
             * @param   p_subCause  Sub-cause code
tepelmann's avatar
tepelmann committed
            template (value) SituationContainer m_situation(
                template (value) CauseCodeType p_cause, 
                template (value) SubCauseCodeType p_subCause,
                template (value) InformationQuality p_informationQuality := 0 //TODO what value here???
tepelmann's avatar
tepelmann committed
                ) := {
tepelmann's avatar
tepelmann committed
                informationQuality := p_informationQuality,
                eventType := {
                    causeCode := p_cause,
                    subCauseCode := p_subCause
                },
                linkedCause := omit
tepelmann's avatar
tepelmann committed
            }
            
            /**
             * @desc    Receive template for situation
             * @param   p_cause     Cause code
             * @param   p_subCause  Sub-cause code
             * @param   p_informationQuality Information quality
             */
            template (present) SituationContainer mw_situation(
                template (present) CauseCodeType p_cause, 
                template (present) SubCauseCodeType p_subCause,
                template (present) InformationQuality p_informationQuality := ?
                ) := {
                informationQuality := p_informationQuality,
                eventType := {
                    causeCode := p_cause,
                    subCauseCode := p_subCause
                },
                linkedCause := *
            }
            
tepelmann's avatar
tepelmann committed
            /**
             * @desc    Default receive template for any decentralized situation
             */    
            template SituationContainer mw_anySitutation := ?;
            
berge's avatar
berge committed
        } // end group situationTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
    } // end group decentralizedSituationTemplates
tepelmann's avatar
tepelmann committed
    
    group decentralizedLocationTemplates {
tepelmann's avatar
tepelmann committed
        
tepelmann's avatar
tepelmann committed
         * @desc    Send template for location
tepelmann's avatar
tepelmann committed
        template (value) LocationContainer m_denmLocation_zeroDelta := {
            eventSpeed := omit,
            eventPositionHeading := omit,
            traces := {
                {
                    {
                        pathPosition := {
                            deltaLatitude := 0,
                            deltaLongitude := 0,
                            deltaElevation := 0
                        },
                        pathDeltaTime := 0
                    }
tepelmann's avatar
tepelmann committed
            roadClass := omit 
tepelmann's avatar
tepelmann committed
        }
        
        /**
         * @desc    Receive template for location
         */
        template (present) LocationContainer mw_anyDenmLocation := {
            eventSpeed := *,
            eventPositionHeading := *,
            traces := ?,
            roadClass := *
        }
        
        /**
         * @desc    Receive template for location
         */
        template (present) LocationContainer mw_denmLocationWithTrace(
            in template (present) Traces p_traces
        ) := {
            eventSpeed := *,
            eventPositionHeading := *,
            traces := p_traces,
            roadClass := *
        }
        
    } // end group decentralizedLocationTemplates
berge's avatar
berge committed
    group alacateTemplates {
tepelmann's avatar
tepelmann committed
        
        template AlacarteContainer m_alacarteConLaneCount := {
            laneCount := {
                laneNumber := 2,
                laneNumberConfidence := 100
            },
            impactReduction := omit,
            externalTemperature := omit,
            roadWorks := omit,
            positioningSolution := omit,
            stationaryVehicle := omit
        }
        
berge's avatar
berge committed
    } // end alacateTemplates
    
} // end LibItsDenmTemplates