Commit 15c9c0e7 authored by berge's avatar berge
Browse files

Fixed Mantis #5892, #5895

parent 0bca7992
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ module LibItsCam_Functions {
    
            [] camPort.receive(mw_camInd ( mw_camMsg_any )){ 
                log("*** a_default: INFO: CAM message received in default ***");
                vc_camReceived := true;
                repeat;
            }
            [] camPort.receive {
@@ -121,9 +122,13 @@ module LibItsCam_Functions {
        function f_bitPositionRandom( in integer p_length )
        return bitstring {
            //Variables            
            var bitstring v_random := '00000000'B;
            var bitstring v_random := '1'B;
            var integer i := 0;
            
            v_random := '000000000000001'B << f_random (0, p_length);
            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;
    
+418 −182
Original line number Diff line number Diff line
@@ -247,6 +247,34 @@ module LibItsCam_Templates {
        }
    }

    /**
     * @desc    Send template for CAM PDU
     * @param   p_generationTime Timestamp of the generated message
     * @param   p_stationId Station ID of the source
     * @param   p_stationCharacteristics Characteristics of the sending station
     * @param   p_referencePosition Position of the sending station
     */
    template (value) CamPdu m_camMsg_valid(
        TimeStamp p_generationTime, 
        StationID p_stationId,
        CoopAwareness.stationCharacteristics p_stationCharacteristics,
        template (value) ReferencePosition p_referencePosition
    ) := {
        header := {
            protocolVersion := 0,
            messageID := 0,
            generationTime := p_generationTime
        },
        cam := {
            stationID := p_stationId,
            stationCharacteristics := p_stationCharacteristics,
            referencePosition := p_referencePosition,
            camParameters := omit
        }
    };
    
    group camAnyVehicle {
        
        /**
         * @desc    Receive template for CAM PDU for any vehicle  
         * @see     mw_camMsg_any
@@ -287,6 +315,162 @@ module LibItsCam_Templates {
            }
        }

        template CamPdu mw_camMsg_anyVehicleReferencePosition(in template (present) ReferencePosition p_referencePosition)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                referencePosition := p_referencePosition
            }
        };

        template CamPdu mw_camMsg_withCrashStatus
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        crashStatus := true
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withoutCrashStatus
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        crashStatus := false ifpresent
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withDangerousGoods(in template (present) DangerousGoods p_dangerousGoods)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        dangerousGoods := p_dangerousGoods
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withoutDangerousGoods
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        dangerousGoods := omit
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withLengthWidthConfidence
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        stationLengthConfidence := ?,
                        stationWidthConfidence := ?
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withoutLengthWidthConfidence
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        stationLengthConfidence := omit,
                        stationWidthConfidence := omit
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withDoorOpen(in template (present) DoorOpen p_doorOpen)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        doorOpen := p_doorOpen
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withoutDoorOpen
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        doorOpen := omit
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withDistanceToStopLine(in template (present) Distance p_distance)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        distanceToStopLine := p_distance
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withTurnAdvice(in template (present) TurnAdvice p_turnAdvice)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        turnAdvice := p_turnAdvice
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withCurvatureChange(in template (present) CurvatureChange p_curvatureChange)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        curvatureChange := p_curvatureChange
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_withOccupancy(in template (present) Occupancy p_occupancy)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        occupancy := p_occupancy
                    }
                }
            }
        };

        template CamPdu mw_camMsg_withExteriorLights(in template (present) ExteriorLights p_exteriorLights)
        modifies mw_camMsg_anyVehicle := {
            cam := {
                camParameters := {
                    vehicleCommonParameters := {
                        exteriorLights := p_exteriorLights
                    }
                }
            }
        };
    
    } // end camAnyVehicle
    
    group camBasicIrs {
    
        /**
         * @desc    Receive template for CAM PDU for road-side unit
         * @see     mw_camMsg_any
@@ -304,35 +488,14 @@ module LibItsCam_Templates {
                    positionConfidence := omit,
                    elevationConfidence := omit,
                    roadSegmentID := *
            }
        }
    }

    /**
     * @desc    Send template for CAM PDU
     * @param   p_generationTime Timestamp of the generated message
     * @param   p_stationId Station ID of the source
     * @param   p_stationCharacteristics Characteristics of the sending station
     * @param   p_referencePosition Position of the sending station
     */
    template (value) CamPdu m_camMsg_valid(
        TimeStamp p_generationTime, 
        StationID p_stationId,
        CoopAwareness.stationCharacteristics p_stationCharacteristics,
        template (value) ReferencePosition p_referencePosition
    ) := {
        header := {
            protocolVersion := 0,
            messageID := 0,
            generationTime := p_generationTime
                },
        cam := {
            stationID := p_stationId,
            stationCharacteristics := p_stationCharacteristics,
            referencePosition := p_referencePosition,
                camParameters := omit
            }
    };
        }

    } // end camBasicIrs

    group camBasicVehicle {
        
    /**
     * @desc    Receive template for CAM PDU for basic vehicle
@@ -348,6 +511,10 @@ module LibItsCam_Templates {
        }
    }
    
    } // end camBasicVehicle

    group camEmergencyVehicle {
        
        /**
         * @desc    Receive template for CAM PDU for emergency vehicle
         * @see     mw_camMsg_anyVehicle
@@ -368,6 +535,36 @@ module LibItsCam_Templates {
            }
        };
        
        template CamPdu mw_camMsg_emergencyVehicle_withLightBar(in template (present) LightBarInUse p_status)
        modifies mw_camMsg_emergencyVehicle := {
        	cam := {
        		camParameters := {
                    profileDependent := {
                        emergencyVehicle := {
                            lightBarInUse := p_status
                        }
                    }
        		}
        	}
        }

        template CamPdu mw_camMsg_emergencyVehicle_withSirene(in template (present) SireneInUse p_status)
        modifies mw_camMsg_emergencyVehicle := {
            cam := {
                camParameters := {
                    profileDependent := {
                        emergencyVehicle := {
                            sireneInUse := p_status
                        }
                    }
                }
            }
        }
        
    } // end camEmergencyVehicle
    
    group camPublicTransportVehicle {
    
        /**
         * @desc    Receive template for CAM PDU for public transport vehicle
         * @see     mw_camMsg_anyVehicle
@@ -389,80 +586,121 @@ module LibItsCam_Templates {
            }
        };
    
        template CamPdu mw_camMsg_publicTransportVehicle_withTrafficLightPriority(in template (present) TrafficLightPriority p_trafficLightPriority)
        modifies mw_camMsg_publicTransportVehicle := {
            cam := {
                camParameters := {
                    profileDependent := {
                        publicTransportVehicle := {
                            trafficLightPriority := p_trafficLightPriority
                        }
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_publicTransportVehicle_withPTLineDescription(in template (present) PTLineDescription p_pTLineDescription)
        modifies mw_camMsg_publicTransportVehicle := {
            cam := {
                camParameters := {
                    profileDependent := {
                        publicTransportVehicle := {
                            pTLineDescription := p_pTLineDescription
                        }
                    }
                }
            }
        };
        
        template CamPdu mw_camMsg_publicTransportVehicle_withScheduleDeviation(in template (present) ScheduleDeviation p_scheduleDeviation)
        modifies mw_camMsg_publicTransportVehicle := {
            cam := {
                camParameters := {
                    profileDependent := {
                        publicTransportVehicle := {
                            scheduleDeviation := p_scheduleDeviation
                        }
                    }
                }
            }
        };
        
    } // end camPublicTransportVehicle
        
    group camExteriorLightsTemplates {
      
        /**
         * @desc  Receive template for exterior lights with low beam lights off  
         */
      template ExteriorLights mw_lowBeamLightsOff := '0???????'B ; 
        template ExteriorLights mw_lowBeamLightsOff := complement(mw_lowBeamLightsOn) ; 
      
        /**
         * @desc  Receive template for exterior lights with low beam lights on 
         */
      template ExteriorLights mw_lowBeamLightsOn := '1???????'B ; 
        template ExteriorLights mw_lowBeamLightsOn := '1*'B ; 
      
        /**
         * @desc  Receive template for exterior lights with high beam lights off 
         */
      template ExteriorLights mw_highBeamLightsOff := '?0??????'B ; 
        template ExteriorLights mw_highBeamLightsOff := complement(mw_highBeamLightsOn);
      
        /**
         * @desc  Receive template for exterior lights with high beam lights on 
         */
      template ExteriorLights mw_highBeamLightsOn := '?1??????'B ; 
        template ExteriorLights mw_highBeamLightsOn := '?1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with left turn signal off 
         */
      template ExteriorLights mw_leftTurnSignalOff := '??0?????'B ; 
        template ExteriorLights mw_leftTurnSignalOff := complement(mw_leftTurnSignalOn);
      
        /**
         * @desc  Receive template for exterior lights with left turn signal on 
         */
      template ExteriorLights mw_leftTurnSignalOn := '??1?????'B ; 
        template ExteriorLights mw_leftTurnSignalOn := '??1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with right turn signal off 
         */
      template ExteriorLights mw_rightTurnSignalOff := '???0????'B ; 
        template ExteriorLights mw_rightTurnSignalOff := complement(mw_rightTurnSignalOn);
        /**
         * @desc  Receive template for exterior lights with right turn signal on 
         */
      template ExteriorLights mw_rightTurnSignalOn := '???1????'B ; 
        template ExteriorLights mw_rightTurnSignalOn := '???1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with automatic light control off 
         */
      template ExteriorLights mw_automaticLightControlOff := '????0???'B ; 
        template ExteriorLights mw_automaticLightControlOff := complement(mw_automaticLightControlOn); 
        /**
         * @desc  Receive template for exterior lights with automatic light control on 
         */
      template ExteriorLights mw_automaticLightControlOn := '????1???'B ; 
        template ExteriorLights mw_automaticLightControlOn := '????1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with day time running lights off 
         */
      template ExteriorLights mw_daytimeRunningLightOff := '?????0??'B ; 
        template ExteriorLights mw_daytimeRunningLightOff := complement(mw_daytimeRunningLightOn);
        
        /**
         * @desc  Receive template for exterior lights with day time running lights on 
         */
      template ExteriorLights mw_daytimeRunningLightOn := '?????1??'B ; 
        template ExteriorLights mw_daytimeRunningLightOn := '?????1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with fog lights off 
         */
      template ExteriorLights mw_fogLightOff := '??????0?'B ; 
        template ExteriorLights mw_fogLightOff := complement(mw_fogLightOn); 
        
        /**
         * @desc  Receive template for exterior lights with fog lights on 
         */
      template ExteriorLights mw_fogLightOn := '??????1?'B ; 
        template ExteriorLights mw_fogLightOn := '??????1*'B ; 
        
        /**
         * @desc  Receive template for exterior lights with parking lights off 
         */
      template ExteriorLights mw_parkingLightsOff := '???????0'B ;
        template ExteriorLights mw_parkingLightsOff := complement(mw_parkingLightsOn);
         
        /**
         * @desc  Receive template for exterior lights with parking lights on 
@@ -472,10 +710,8 @@ module LibItsCam_Templates {
        /**
         * @desc  Receive template for exterior lights with hazard lights on 
         */
      template ExteriorLights mw_hazardConditionOn := '??11????'B ; 
        template ExteriorLights mw_hazardConditionOn := '??11*'B ; 
        
    } // end group exteriorLights



} // end LibItsCam_Templates
 No newline at end of file
+16 −0
Original line number Diff line number Diff line
@@ -125,6 +125,22 @@ module LibItsCommon_Functions {
    
        } // end function f_random

        /** 
         * @desc    Removes unsignificant right-most 0 bits of a bitstring
         *            
         * @param     p_bitstring Bitstring to be reduced
         * @return    Reduced bitstring
         *
        */    
        function f_removeUnsignificantBits(in bitstring p_bitstring)
        return bitstring {
        	var integer i, len;
        	
        	len := lengthof(p_bitstring);
        	for(i:=len-1; i >=0 and p_bitstring[i] == '0'B; i:=i-1) {}
        	return substr(p_bitstring, 0, i + 1);
        } 
    
        /**
         * @desc    Gets the current time
         * @return  Timestamp - current time in Epoch format
+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ module LibIts_Interface {
            
            //global variables
            var SequenceNo vc_sequenceNo := 0;
            var boolean vc_camReceived := false;
            
        } // end ItsFa