LibItsDenm_Templates.ttcn 26.4 KB
Newer Older
/**
 *	@author 	ETSI / STF405
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
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibIts_Interface all;
    import from LibItsDenm_TypesAndValues all;
    import from LibItsCommon_TypesAndValues 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(
            template (value) DenmPdu 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(
            template (present) DenmPdu 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 := {
                utDenmInitialize := {
                }
            }
            
            /**
             * @desc    Send template for Upper Tester event
             * @param   p_situation Situation
             */
            template (value) UtEvent m_utEvent(in template (value) Situation p_situation) := {
                utDenmEvent := {
                    situation := p_situation,
                    eventOption := omit
                }
            /**
             * @desc    Send template for Upper Tester event cancellation
             * @param   p_situation     Situation
             * @param   p_actionId      Action ID of the event to be cancelled
            template (value) UtEvent m_utEventCancellation(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) ActionID p_actionId
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                      eventCancellation := p_actionId
            /**
             * @desc    Send template for Upper Tester event negation
             * @param   p_situation Situation
             * @param   p_actionId      Action ID of the event to be negated
             * @see     m_utEvent
             */
            template (value) UtEvent m_utEventNegation(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) ActionID p_actionId
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                      eventNegation := p_actionId
            /**
             * @desc    Send template for Upper Tester event with Traffic flow effect
             * @param   p_situation         Situation
             * @param   p_trafficFlowEffect Traffic flow effect
             */
berge's avatar
berge committed
            template (value) UtEvent m_utEventTrafficFlowEffect(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) TrafficFlowEffect p_trafficFlowEffect
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                      eventTrafficFlowEffect := p_trafficFlowEffect
                    }
            /**
             * @desc    Send template for Upper Tester event with linked cause
             * @param   p_situation     Situation
             * @param   p_linkedCause   Linked situation
             */
            template (value) UtEvent m_utEventLinkedCause(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) Situation p_linkedCause
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                      eventLinkedCause := p_linkedCause
                    }
            /**
             * @desc    Send template for Upper Tester event update of expiration time
             * @param   p_situation         Situation
             * @param   p_actionId          ActionID of the event
             * @param   p_expirationTime    Expiration time    
             */
            template (value) UtEvent m_utUpdateEventExpirationTime(
                in template (value) Situation p_situation,
                in template (value) ActionID p_actionId,  
                in template (value) TimeStamp p_expirationTime
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        updateEventExpiry := {
                            eventActionId := p_actionId,
                            expiryTime := p_expirationTime
            /**
             * @desc    Send template for Upper Tester event with expiration time
             * @param   p_situation         Situation
             * @param   p_expirationTime    Expiration time    
             */
            template (value) UtEvent m_utEventExpirationTime(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) TimeStamp p_expirationTime
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        eventExpirationTime := p_expirationTime
                    }
            /**
             * @desc    Send template for Upper Tester event with expiration time and frequency
             * @param   p_situation         Situation
             * @param   p_expirationTime    Expiration time 
             * @param   p_frequency         Frequency
             */
            template (value) UtEvent m_utEventExpirationTimeFrequency(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) TimeStamp p_expirationTime,
                in template (value) DecentralizedSituationManagement.frequency p_frequency
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        eventExpirationTimeFrequency := {
                            p_expirationTime,
                            p_frequency
                        }
            /**
             * @desc    Send template for Upper Tester event with characteristics
             * @param   p_situation     Situation
             * @param   p_eventCharact  Event characteristics
             */
            template (value) UtEvent m_utEventCharact(
berge's avatar
berge committed
                in template (value) Situation p_situation, 
                in template (value) DecentralizedSituation.eventCharact p_eventCharact
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        eventCharact := p_eventCharact
                    }
            /**
             * @desc    Send template for Upper Tester event with reliability
             * @param   p_situation         Situation
             * @param   p_eventReliability  Event reliability
             */
            template (value) UtEvent m_utEventReliability(
                in template (value) Situation p_situation, 
                in template (value) DecentralizedSituationManagement.reliability p_eventReliability
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        eventReliability := p_eventReliability
                    }
                }
            }
            
            /**
             * @desc    Send template for Upper Tester event with severity
             * @param   p_situation     Situation
             * @param   p_eventSeverity Event severity
             */
            template (value) UtEvent m_utEventSeverity(
                in template (value) Situation p_situation, 
                in template (value) Severity p_eventSeverity
            ) modifies m_utEvent := {
                utDenmEvent := {
                    eventOption := {
                        eventSeverity := p_eventSeverity
                    }
                }
            }
            
        } // end utPrimitives
      
tepelmann's avatar
tepelmann committed
    } // end primitives
    
    group denmPduTemplates {
        
        /**
         * @desc    Default send template for ITS PDU header
         * @remark  generationTime 0 indicates that the lower layer should add the time while sending
         */
        template (value) ItsPduHeader m_itsPduHeader := {
berge's avatar
berge committed
            protocolVersion := c_protocolVersionDenm,
			messageID := c_messageId,
            generationTime := 0 
         * @desc    Default receive template for ITS PDU header
         */
        template ItsPduHeader mw_itsPduHeader := {
            protocolVersion := c_protocolVersionDenm,
            messageID := c_messageId,
            generationTime := ?
        }
                
        /**
         * @desc    Send template for DENM PDU
         * @param   p_denm  DEN Message
         */
        template (value) DenmPdu 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 DenmPdu mw_denmPdu(
            in template (present) DecentralizedEnvironmentalNotificationMessage p_denm
        ) := {
        	header := mw_itsPduHeader,
        	denm := p_denm            
        }     
                
    } // end denmPduTemplates
        
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) DecentralizedSituationManagement p_mgmt,
            template (value) DecentralizedSituation p_sit,
            template (value) DecentralizedSituationLocation p_loc
            ) := {
            management := p_mgmt, 
            situation := p_sit, 
            location := p_loc
        }
    
        /**
         * @desc    Default receive template for DEN Message
         */
berge's avatar
berge committed
        template DecentralizedEnvironmentalNotificationMessage mw_anyDenm := {
            management := ?, 
            situation := ?, 
            location := ?            
        }    
    
        /**
         * @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(
            template (present) DecentralizedSituationManagement p_mgmt,
berge's avatar
berge committed
            template (present) DecentralizedSituation p_sit
            ) modifies mw_anyDenm := {
tepelmann's avatar
tepelmann committed
            management := p_mgmt, 
berge's avatar
berge committed
            situation := p_sit
tepelmann's avatar
tepelmann committed
        }
    
        /**
         * @desc    Send template for DENM with cause
         * @param   p_dataVersion   Data version
         * @param   p_sit           Situation
         * @param   p_eventPosition Event Position
         * @param   p_stationId     Source station ID
         */
        template (value) DecentralizedEnvironmentalNotificationMessage m_denmWithCause(
tepelmann's avatar
tepelmann committed
            template (value) DataVersion p_dataVersion,
berge's avatar
berge committed
            template (value) Situation p_sit,
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,            
            template (value) StationID p_stationId
tepelmann's avatar
tepelmann committed
            ) := {
berge's avatar
berge committed
            management := m_denmMgmtCon(p_dataVersion, p_stationId), 
tepelmann's avatar
tepelmann committed
            situation := m_denmSitCon(p_sit, informative),
            location := m_denmSitLoc(
berge's avatar
berge committed
                            p_eventPosition,
tepelmann's avatar
tepelmann committed
                            m_locationRef
                        )
        }
        
        /**
         * @desc    Send template for DENM with cause and negation
         * @param   p_dataVersion   Data version
         * @param   p_sit           Situation
         * @param   p_eventPosition Event Position
         * @param   p_stationId     Source station ID
         * @param   p_isNeg         Is it a negation
         * @see     m_denmWithCause
         */
        template (value) DecentralizedEnvironmentalNotificationMessage m_denmWithCauseIsNeg(
tepelmann's avatar
tepelmann committed
            template (value) DataVersion p_dataVersion,
            template (value) Situation p_sit,
berge's avatar
berge committed
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,            
            template (value) StationID p_stationId,
tepelmann's avatar
tepelmann committed
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
        ) modifies m_denmWithCause := {
            management := m_denmMgmtCon_isNeg(p_dataVersion, p_stationId, p_isNeg)
tepelmann's avatar
tepelmann committed
        }
         * @desc    Default receive template for any decentralized situation
berge's avatar
berge committed
        template DecentralizedSituation mw_anySitutation := ?;
        
berge's avatar
berge committed
    } // end group decentralizedEnvironmentalNotificationMessageTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationManagementTemplates {
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
         */
        template (value) DecentralizedSituationManagement m_denmMgmtCon(
berge's avatar
berge committed
            template (value) DataVersion p_dataVersion,
            template (value) StationID p_stationId
tepelmann's avatar
tepelmann committed
            ) := {
            actionID := {
berge's avatar
berge committed
                stationID := p_stationId, 
tepelmann's avatar
tepelmann committed
                sequenceNo := 0
            },
            dataVersion := p_dataVersion,
            expiryTime := omit,
            frequency := omit,
            reliability := 0,
            isNegation := false
        }

        /**
         * @desc    Send template for Decentralized Situation Management with negation
         * @param   p_dataVersion   Data version
         * @param   p_stationId     Station ID of the source
         * @param   p_isNeg         Is it a negation
         * @see     m_denmMgmtCon
         */
        template (value) DecentralizedSituationManagement m_denmMgmtCon_isNeg(
            template (value) DataVersion p_dataVersion,            
            template (value) StationID p_stationId,
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies m_denmMgmtCon := {
            isNegation := p_isNeg
        }
                
        /**
         * @desc    Receive template for Decentralized Situation Management
         * @param   p_dataVersion   Data version
         */
tepelmann's avatar
tepelmann committed
        template DecentralizedSituationManagement mw_denmMgmtCon (
            template (present) DataVersion p_dataVersion
            ):= {
            actionID := {
                stationID := ?, 
                sequenceNo := ?
            },
            dataVersion := p_dataVersion,
            expiryTime := *,
            frequency := *,
            reliability := ?,
            isNegation := ?
        }
      
        /**
         * @desc    Receive template for Decentralized Situation Management with negation
         * @param   p_dataVersion   Data version
         * @param   p_isNeg         Is it a negation
         * @see     mw_denmMgmtCon
         */
        template DecentralizedSituationManagement mw_denmMgmtCon_isNeg(
            template (present) DataVersion p_dataVersion,  
tepelmann's avatar
tepelmann committed
            template (present) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies mw_denmMgmtCon := {
            isNegation := p_isNeg
        }
        
        /**
         * @desc    Receive template for Decentralized Situation Management with expiry time
         * @param   p_dataVersion   Data version  
         * @param   p_expiryTime    Expiry time
         * @see     mw_denmMgmtCon
         */
berge's avatar
berge committed
        template DecentralizedSituationManagement mw_denmMgmtConWithExpiryTime(
            template (present) DataVersion p_dataVersion,  
berge's avatar
berge committed
            template (present) DecentralizedSituationManagement.expiryTime p_expiryTime        
        	) modifies mw_denmMgmtCon := {
            expiryTime := p_expiryTime
        }
        
        /**
         * @desc    Receive template for Decentralized Situation Management with expiry time
         * @param   p_dataVersion   Data version  
         * @param   p_reliability   Reliability
         * @param   p_isNeg         Is it a negation
         * @see     mw_denmMgmtCon
         */
        template DecentralizedSituationManagement mw_denmMgmtConWithReliability_isNeg(
            template (present) DataVersion p_dataVersion,  
            template (present) DecentralizedSituationManagement.reliability p_reliability,
            template (present) DecentralizedSituationManagement.isNegation p_isNeg       
            ) modifies mw_denmMgmtCon := {
            reliability := p_reliability,
            isNegation := p_isNeg
        }
        
        /**
         * @desc    Default receive template for expiry time
         */
berge's avatar
berge committed
        template DecentralizedSituationManagement.expiryTime mw_anyExpiryTime := ?;
        
berge's avatar
berge committed
    } // end group decentralizedSituationManagementTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationTemplates {
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Send template for decentralized situation 
         * @param   p_sit   Situation 
         * @param   p_sev   Severity
         */
        template (value) DecentralizedSituation m_denmSitCon(
tepelmann's avatar
tepelmann committed
            template (value) Situation p_sit,
            template (value) Severity p_sev
            ) := {
            trafficFlowEffect := omit,
            situation := p_sit,
            linkedCause := omit,
            severity := p_sev,
            eventCharact := omit,
berge's avatar
berge committed
            vehicleCommonParameters := omit,
tepelmann's avatar
tepelmann committed
            profile := omit
        }
        
        /**
         * @desc    Default receive template for decentralized situation 
         */
tepelmann's avatar
tepelmann committed
        template DecentralizedSituation mw_denmSitCon := {
            trafficFlowEffect := *,
            situation := ?,
            linkedCause := *,
            severity := ?,
            eventCharact := *,
berge's avatar
berge committed
            vehicleCommonParameters := *,
tepelmann's avatar
tepelmann committed
            profile := *
        }
        
        /**
         * @desc    Receive template for decentralized situation with specific situation
         * @param   p_sit   Situation
         * @see     mw_denmSitCon
         */
        template DecentralizedSituation mw_denmSitCon_sit(
tepelmann's avatar
tepelmann committed
            template (present) Situation p_sit
            ) modifies mw_denmSitCon := {
            situation := p_sit
        }
        
        /**
         * @desc    Receive template for decentralized situation with specific situation 
         *          and traffic flow effect 
         * @param   p_sit   Situation
         * @param   p_tfe   Traffic flow effect
         * @see     mw_denmSitCon_sit
        template DecentralizedSituation mw_denmSitCon_sitTfe(
tepelmann's avatar
tepelmann committed
            template (present) Situation p_sit,
            template (present) TrafficFlowEffect p_tfe
            ) modifies mw_denmSitCon_sit := {
tepelmann's avatar
tepelmann committed
                trafficFlowEffect := p_tfe
        }
        
        /**
         * @desc    Receive template for decentrelized situation with specific situation 
         *          and linked cause
         * @param   p_sit   Situation
         * @param   p_lc    Linked Situation
         * @see     mw_denmSitCon_sit
        template DecentralizedSituation mw_denmSitCon_sitLc(
tepelmann's avatar
tepelmann committed
            template (present) Situation p_sit,
            template (present) Situation p_lc
            ) modifies mw_denmSitCon_sit := {
tepelmann's avatar
tepelmann committed
                linkedCause := p_lc
        }
        
        /**
         * @desc    Receive template for decentrelized situation with specific situation 
         *          and event characteristics
         * @param   p_sit   Situtation
         * @param   p_ec    Event characteristics
         * @see     mw_denmSitCon_sit
        template DecentralizedSituation mw_denmSitCon_sitEc(
tepelmann's avatar
tepelmann committed
            template (present) Situation p_sit,
            template (present) DecentralizedSituation.eventCharact p_ec
            ) modifies mw_denmSitCon_sit := {
tepelmann's avatar
tepelmann committed
                eventCharact := p_ec
        }
        
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
             */
            template (value) Situation m_situation(
tepelmann's avatar
tepelmann committed
                template (value) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (value) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
            /**
             * @desc    Receive template for situation
             * @param   p_cause     Cause code
             * @param   p_subCause  Sub-cause code
             */
tepelmann's avatar
tepelmann committed
            template Situation mw_situation(
                template (present) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (present) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
             * @desc    Default receive template for ant sub-cause
berge's avatar
berge committed
            template SubCauseCode mw_anySubCause := ?;
            
berge's avatar
berge committed
        } // end group situationTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
        group eventCharactTemplates {
tepelmann's avatar
tepelmann committed
            
            /**
             * @desc    Default send template for event characteristics
             */
            template (value) DecentralizedSituation.eventCharact m_eventCharact := {
tepelmann's avatar
tepelmann committed
                eventmobility := true,
                causeType := geographicalRegion,
                relevance := difficultDrivingConditions,
                timeCriticality := false
tepelmann's avatar
tepelmann committed
            }
            
berge's avatar
berge committed
        } // end eventCharactTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
    } // end group decentralizedSituationTemplates
tepelmann's avatar
tepelmann committed
    
berge's avatar
berge committed
    group decentralizedSituationLocationTemplates {
tepelmann's avatar
tepelmann committed
        
        /**
         * @desc    Send template for relevance area
         * @param   p_refPosition   Reference position of event
         */
        template (value) RelevanceArea m_denmRelevanceArea(
            ReferencePosition p_refPosition
            ) := {
            geoAreaCenterLatitude := p_refPosition.latitude,
            geoAreaCenterLongitude := p_refPosition.longitude,
            shape := {
                circle := {
                    radius := 1000 /* FIXME hard-coded value */
                }
            },
            directionalityFilter := omit,
            disseminationAreaSize := same
        }

        /**
         * @desc    Receive template for relevance area
         */
        template RelevanceArea mw_denmRelevanceArea := {
            geoAreaCenterLatitude := ?,
            geoAreaCenterLongitude := ?,
            shape := ?,
            directionalityFilter := *,
            disseminationAreaSize := ?
        }
        
        /**
         * @desc    Send template for situation location
         * @param   p_eventPosition Event position
         * @param   p_locationRef   Location reference
         */
        template (value) DecentralizedSituationLocation m_denmSitLoc(
tepelmann's avatar
tepelmann committed
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (value) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition, 
            locationRef := p_locationRef,
            relevanceArea := m_denmRelevanceArea(p_eventPosition.eventPositionCurrentDefinition.refPosition)
tepelmann's avatar
tepelmann committed
        }
        
        /**
         * @desc    Receive template for situation location
         * @param   p_eventPosition Event position
         * @param   p_locationRef   Location reference
         */
tepelmann's avatar
tepelmann committed
        template DecentralizedSituationLocation mw_denmSitLoc (
            template (present) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (present) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition,
            locationRef := p_locationRef,
            relevanceArea := mw_denmRelevanceArea
tepelmann's avatar
tepelmann committed
        }
        
berge's avatar
berge committed
        /**
         * @desc    Send template for event position
         * @param   p_referencePosition Reference position of the event
         */
        template (value) DecentralizedSituationLocation.eventPosition m_eventPosition (
            template (value) ReferencePosition p_referencePosition
        ) := {
            eventPositionCurrentDefinition := {
                refPosition := p_referencePosition,
                eventSpeed := omit
            }
        }       
                           
        group locationRefTemplates {
tepelmann's avatar
tepelmann committed
            
            /**
             * @desc    Default send template for location reference
             */
            template (value) DecentralizedSituationLocation.locationRef m_locationRef := {
tepelmann's avatar
tepelmann committed
                trace := {
                    traceID := 0,
                    waypoints := {}
                }
            }
            
        } // end group locationRefTemplates
tepelmann's avatar
tepelmann committed
        
berge's avatar
berge committed
    } // end group decentralizedSituationLocationTemplates
} // end LibItsDenmTemplates