

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用数据流端点的公共广播卫星（解调和解码）
<a name="examples.pbs-dataflow-endpoint-demod-decode"></a>

 此示例建立在用户指南[JPSS-1-公共广播卫星 (PBS)-评估](examples.md#examples.pbs-definition)部分所做的分析的基础上。

 要完成此示例，您需要假设一个场景，即要使用数据流端点将 HRD 通信路径捕获为解调和解码的直接广播数据。如果您计划使用美国宇航局直接读取实验室软件（RT-STPS和IPOPP）处理数据，则此示例是一个不错的起点。

## 通信路径
<a name="examples.pbs-dataflow-endpoint-demod-decode.communication-paths"></a>

 本节介绍[规划您的数据流通信路径](getting-started.step2.md)入门。在本示例中，您将在 CloudFormation 模板中创建两个部分：“参数” 和 “资源” 部分。

**注意**  
 有关 CloudFormation 模板内容的更多信息，请参阅[模板部分](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html)。

 在 “参数” 部分，您将添加以下参数。在通过 CloudFormation 控制台创建堆栈时，您将为这些值指定值。

```
Parameters:
  EC2Key:
    Description: The SSH key used to access the EC2 receiver instance. Choose any SSH key if you are not creating an EC2 receiver instance. For instructions on how to create an SSH key see [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html)
    Type: AWS::EC2::KeyPair::KeyName
    ConstraintDescription: must be the name of an existing EC2 KeyPair.

  ReceiverAMI:
    Description: The Ground Station DDX AMI ID you want to use. Please note that AMIs are region specific. For instructions on how to retrieve an AMI see [https://docs.aws.amazon.com/ground-station/latest/ug/dataflows.ec2-configuration.html#dataflows.ec2-configuration.amis](https://docs.aws.amazon.com/ground-station/latest/ug/dataflows.ec2-configuration.html#dataflows.ec2-configuration.amis)
    Type: AWS::EC2::Image::Id
```

**注意**  
 **您需要**创建密钥对，并提供 Amazon EC2 `EC2Key` 参数的名称。请参阅[为您的 Amazon EC2 实例创建密钥对](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-key-pairs.html)。  
 此外，在创建 CloudFormation 堆栈时，**您需要**提供正确的**特定于区域**的 AMI ID。请参阅 [AWS Ground Station Amazon 机器映像 (AMIs)](dataflows.ec2-configuration.md#dataflows.ec2-configuration.amis)。

 其余模板片段属于 CloudFormation 模板的 “资源” 部分。

```
Resources:
  # Resources that you would like to create should be placed within the resource section.
```

 考虑到我们为 EC2 实例提供单一通信路径的场景，您将拥有一条同步传输路径。根据本[同步数据传输](getting-started.step2.md#getting-started.step2.sync-data-delivery)节，您必须使用数据流终端节点应用程序设置和配置一个 Amazon EC2 实例，并创建一个或多个数据流终端节点组。

```
  # The EC2 instance that will send/receive data to/from your satellite using AWS Ground Station.
  ReceiverInstance:
    Type: AWS::EC2::Instance
    Properties:
      DisableApiTermination: false
      IamInstanceProfile: !Ref GeneralInstanceProfile
      ImageId: !Ref ReceiverAMI
      InstanceType: m5.4xlarge
      KeyName: !Ref EC2Key
      Monitoring: true
      PlacementGroupName: !Ref ClusterPlacementGroup
      SecurityGroupIds:
        - Ref: InstanceSecurityGroup
      SubnetId: !Ref ReceiverSubnet
      BlockDeviceMappings:
        - DeviceName: /dev/xvda
          Ebs:
            VolumeType: gp2
            VolumeSize: 40
      Tags:
        - Key: Name
          Value: !Join [ "-" , [ "Receiver" , !Ref "AWS::StackName" ] ]
      UserData:
        Fn::Base64:
          |
          #!/bin/bash
          exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
          echo `date +'%F %R:%S'` "INFO: Logging Setup" >&2

          GROUND_STATION_DIR="/opt/aws/groundstation"
          GROUND_STATION_BIN_DIR="${GROUND_STATION_DIR}/bin"
          STREAM_CONFIG_PATH="${GROUND_STATION_DIR}/customer_stream_config.json"

          echo "Creating ${STREAM_CONFIG_PATH}"
          cat << STREAM_CONFIG > "${STREAM_CONFIG_PATH}"
          {
            "ddx_streams": [
              {
                "streamName": "Downlink",
                "maximumWanRate": 4000000000,
                "lanConfigDevice": "lo",
                "lanConfigPort": 50000,
                "wanConfigDevice": "eth1",
                "wanConfigPort": 55888,
                "isUplink": false
              }
            ]
          }
          STREAM_CONFIG

          echo "Waiting for dataflow endpoint application to start"
          while netstat -lnt | awk '$4 ~ /:80$/ {exit 1}'; do sleep 10; done

          echo "Configuring dataflow endpoint application streams"
          python "${GROUND_STATION_BIN_DIR}/configure_streams.py" --configFileName "${STREAM_CONFIG_PATH}"
          sleep 2
          python "${GROUND_STATION_BIN_DIR}/save_default_config.py"

          exit 0
```

```
  # The AWS Ground Station Dataflow Endpoint Group that defines the endpoints that AWS Ground
  # Station will use to send/receive data to/from your satellite.
  DataflowEndpointGroup:
    Type: AWS::GroundStation::DataflowEndpointGroup
    Properties:
      ContactPostPassDurationSeconds: 180
      ContactPrePassDurationSeconds: 120
      EndpointDetails:
        - Endpoint:
            Name: !Join [ "-" , [ !Ref "AWS::StackName" , "Downlink" ] ] # needs to match DataflowEndpointConfig name
            Address:
              Name: !GetAtt ReceiverInstanceNetworkInterface.PrimaryPrivateIpAddress
              Port: 55888
          SecurityDetails:
            SecurityGroupIds:
              - Ref: "DataflowEndpointSecurityGroup"
            SubnetIds:
              - !Ref ReceiverSubnet
            RoleArn: !GetAtt DataDeliveryServiceRole.Arn

  # The security group that the ENI created by AWS Ground Station belongs to.
  DataflowEndpointSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: Security Group for AWS Ground Station registration of Dataflow Endpoint Groups
      VpcId: !Ref ReceiverVPC
      SecurityGroupEgress:
        - IpProtocol: udp
          FromPort: 55888
          ToPort: 55888
          CidrIp: 10.0.0.0/8
          Description: "AWS Ground Station Downlink Stream To 10/8"
        - IpProtocol: udp
          FromPort: 55888
          ToPort: 55888
          CidrIp: 172.16.0.0/12
          Description: "AWS Ground Station Downlink Stream To 172.16/12"
        - IpProtocol: udp
          FromPort: 55888
          ToPort: 55888
          CidrIp: 192.168.0.0/16
          Description: "AWS Ground Station Downlink Stream To 192.168/16"

  # The placement group in which your EC2 instance is placed.
  ClusterPlacementGroup:
    Type: AWS::EC2::PlacementGroup
    Properties:
      Strategy: cluster

  # The security group for your EC2 instance.
  InstanceSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: AWS Ground Station receiver instance security group.
      VpcId: !Ref ReceiverVPC
      SecurityGroupIngress:
        # To allow SSH access to the instance, add another rule allowing tcp port 22 from your CidrIp
        - IpProtocol: udp
          FromPort: 55888
          ToPort: 55888
          SourceSecurityGroupId: !Ref DataflowEndpointSecurityGroup
          Description: "AWS Ground Station Downlink Stream"

  ReceiverVPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: {{"10.0.0.0/16"}}
      Tags:
        - Key: "Name"
          Value: "AWS Ground Station - PBS to dataflow endpoint Demod Decode Example VPC"
        - Key: "Description"
          Value: "VPC for EC2 instance receiving AWS Ground Station data"

  ReceiverSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      CidrBlock: {{"10.0.0.0/24"}}
      Tags:
        - Key: "Name"
          Value: "AWS Ground Station - PBS to dataflow endpoint Demod Decode Example Subnet"
        - Key: "Description"
          Value: "Subnet for EC2 instance receiving AWS Ground Station data"
      VpcId: !Ref ReceiverVPC

  # An ENI providing a fixed IP address for AWS Ground Station to connect to.
  ReceiverInstanceNetworkInterface:
    Type: AWS::EC2::NetworkInterface
    Properties:
      Description: Floating network interface providing a fixed IP address for AWS Ground Station to connect to.
      GroupSet:
        - !Ref InstanceSecurityGroup
      SubnetId: !Ref ReceiverSubnet

  # Attach the ENI to the EC2 instance.
  ReceiverInstanceInterfaceAttachment:
    Type: AWS::EC2::NetworkInterfaceAttachment
    Properties:
      DeleteOnTermination: false
      DeviceIndex: "1"
      InstanceId: !Ref ReceiverInstance
      NetworkInterfaceId: !Ref ReceiverInstanceNetworkInterface

  # The instance profile for your EC2 instance.
  GeneralInstanceProfile:
    Type: AWS::IAM::InstanceProfile
    Properties:
      Roles:
        - !Ref InstanceRole
```

 您还需要相应的策略、角色和配置文件， AWS Ground Station 以便在您的账户中创建弹性网络接口 (ENI)。

```
  # AWS Ground Station assumes this role to create/delete ENIs in your account in order to stream data.
  DataDeliveryServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Policies:
        - PolicyDocument:
            Statement:
              - Action:
                  - ec2:CreateNetworkInterface
                  - ec2:DeleteNetworkInterface
                  - ec2:CreateNetworkInterfacePermission
                  - ec2:DeleteNetworkInterfacePermission
                  - ec2:DescribeSubnets
                  - ec2:DescribeVpcs
                  - ec2:DescribeSecurityGroups
                Effect: Allow
                Resource: '*'
            Version: '2012-10-17'
          PolicyName: DataDeliveryServicePolicy
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
              - groundstation.amazonaws.com
            Action:
            - sts:AssumeRole

  # The EC2 instance assumes this role.
  InstanceRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: "2012-10-17"
        Statement:
          - Effect: "Allow"
            Principal:
              Service:
                - "ec2.amazonaws.com"
            Action:
              - "sts:AssumeRole"
      Path: "/"
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess
        - arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role
        - arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy
        - arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM
```

## AWS Ground Station 配置
<a name="examples.pbs-dataflow-endpoint-demod-decode.configs"></a>

 本节[创建配置](getting-started.step3.md)代表用户指南。

 你需要一个*跟踪配置*来设置你使用自动追踪的偏好。选择 *P* REFERRED 作为自动跟踪可以提高信号质量，但由于 JPSS-1 星历质量足够，因此不需要满足信号质量。

```
  TrackingConfig:
    Type: AWS::GroundStation::Config
    Properties:
      Name: "JPSS Tracking Config"
      ConfigData:
        TrackingConfig:
          Autotrack: "PREFERRED"
```

 根据通信路径，您需要定义一个*antenna-downlink-demod-decode*配置来表示卫星部分，以及一个*数据流端点配置来引用定义端点*详细信息的数据流端点组。

**注意**  
 有关如何为和设置值的`DemodulationConfig`详细信息`DecodeConfig`，请参阅[天线下行传输解调解码配置](how-it-works.config.md#how-it-works.config-antenna-downlink-demod-decode)。

```
  # The AWS Ground Station Antenna Downlink Config that defines the frequency spectrum used to
  # downlink data from your satellite.
  JpssDownlinkDemodDecodeAntennaConfig:
    Type: AWS::GroundStation::Config
    Properties:
      Name: "JPSS Downlink Demod Decode Antenna Config"
      ConfigData:
        AntennaDownlinkDemodDecodeConfig:
          SpectrumConfig:
            CenterFrequency:
              Value: 7812
              Units: "MHz"
            Polarization: "RIGHT_HAND"
            Bandwidth:
              Value: 30
              Units: "MHz"
          DemodulationConfig:
            UnvalidatedJSON: '{
              "type":"QPSK",
              "qpsk":{
                "carrierFrequencyRecovery":{
                  "centerFrequency":{
                    "value":7812,
                    "units":"MHz"
                  },
                  "range":{
                    "value":250,
                    "units":"kHz"
                  }
                },
                "symbolTimingRecovery":{
                  "symbolRate":{
                    "value":15,
                    "units":"Msps"
                  },
                  "range":{
                    "value":0.75,
                    "units":"ksps"
                  },
                  "matchedFilter":{
                    "type":"ROOT_RAISED_COSINE",
                    "rolloffFactor":0.5
                  }
                }
              }
            }'
          DecodeConfig:
            UnvalidatedJSON: '{
              "edges":[
                {
                  "from":"I-Ingress",
                  "to":"IQ-Recombiner"
                },
                {
                  "from":"Q-Ingress",
                  "to":"IQ-Recombiner"
                },
                {
                  "from":"IQ-Recombiner",
                  "to":"CcsdsViterbiDecoder"
                },
                {
                  "from":"CcsdsViterbiDecoder",
                  "to":"NrzmDecoder"
                },
                {
                  "from":"NrzmDecoder",
                  "to":"UncodedFramesEgress"
                }
              ],
              "nodeConfigs":{
                "I-Ingress":{
                  "type":"CODED_SYMBOLS_INGRESS",
                  "codedSymbolsIngress":{
                    "source":"I"
                  }
                },
                "Q-Ingress":{
                  "type":"CODED_SYMBOLS_INGRESS",
                  "codedSymbolsIngress":{
                    "source":"Q"
                  }
                },
                "IQ-Recombiner":{
                  "type":"IQ_RECOMBINER"
                },
                "CcsdsViterbiDecoder":{
                  "type":"CCSDS_171_133_VITERBI_DECODER",
                  "ccsds171133ViterbiDecoder":{
                    "codeRate":"ONE_HALF"
                  }
                },
                "NrzmDecoder":{
                  "type":"NRZ_M_DECODER"
                },
                "UncodedFramesEgress":{
                  "type":"UNCODED_FRAMES_EGRESS"
                }
              }
            }'
```

```
  # The AWS Ground Station Dataflow Endpoint Config that defines the endpoint used to downlink data
  # from your satellite.
  DownlinkDemodDecodeEndpointConfig:
    Type: AWS::GroundStation::Config
    Properties:
      Name: "Aqua SNPP JPSS Downlink Demod Decode Endpoint Config"
      ConfigData:
        DataflowEndpointConfig:
          DataflowEndpointName: !Join [ "-" , [ !Ref "AWS::StackName" , "Downlink" ] ]
          DataflowEndpointRegion: !Ref AWS::Region
```

## AWS Ground Station 任务简介
<a name="examples.pbs-dataflow-endpoint-demod-decode.mission-profile"></a>

 本节[创建任务档案](getting-started.step4.md)代表用户指南。

 现在你已经有了相关的配置，你可以用它们来构造数据流。其余参数将使用默认值。

```
  # The AWS Ground Station Mission Profile that groups the above configurations to define how to
  # uplink and downlink data to your satellite.
  SnppJpssMissionProfile:
    Type: AWS::GroundStation::MissionProfile
    Properties:
      Name: "37849 SNPP And 43013 JPSS"
      ContactPrePassDurationSeconds: 120
      ContactPostPassDurationSeconds: 60
      MinimumViableContactDurationSeconds: 180
      TrackingConfigArn: !Ref TrackingConfig
      DataflowEdges:
        - Source: !Join [ "/", [ !Ref JpssDownlinkDemodDecodeAntennaConfig, "UncodedFramesEgress" ] ]
          Destination: !Ref DownlinkDemodDecodeEndpointConfig
```

## 把它放在一起
<a name="examples.pbs-dataflow-endpoint-demod-decode.putting-it-together"></a>

 利用上述资源，您现在可以安排 JPSS-1 联系人，以便从任何已上线人员同步传送数据。 AWS Ground Station [AWS Ground Station 地点](aws-ground-station-antenna-locations.md)

 以下是一个完整的 CloudFormation 模板，其中包括本节中描述的所有资源，这些资源组合成一个可以直接在中使用的模板 CloudFormation。

 名`AquaSnppJpss.yml`为的 CloudFormation 模板旨在让你快速访问开始接收 Aqua、SNPP 和 JPSS-1/NOAA-20 卫星的数据。它包含一个 Amazon EC2 实例和安排联系以及接收解调和解码后的直接广播数据所需的 AWS Ground Station 资源。

 如果你的账户未登录 Aqua、SNPP、JPSS-1/NOAA-20 和 Terra，请参阅。[机载卫星](getting-started.step1.md)

**注意**  
 您可以使用有效 AWS 凭证访问客户登录 Amazon S3 存储桶，从而访问模板。以下链接使用区域性 Amazon S3 存储桶。更改`us-west-2`区域代码以表示要在其中创建 CloudFormation 堆栈的相应区域。  
 此外，以下说明使用 YAML。但是，模板有 YAML 和 JSON 这两种格式。要使用 JSON，请在下载模板`.json`时将`.yml`文件扩展名替换为。

 要使用下载模板 AWS CLI，请使用以下命令：

```
aws s3 cp s3://groundstation-cloudformation-templates-us-west-2/AquaSnppJpss.yml .
```

 在浏览器中导航到以下 URL，可以在控制台中查看和下载此模板：

```
https://s3.console.aws.amazon.com/s3/object/groundstation-cloudformation-templates-us-west-2/AquaSnppJpss.yml
```

 您可以使用以下链接直接在中 CloudFormation 指定模板：

```
https://groundstation-cloudformation-templates-us-west-2.s3.us-west-2.amazonaws.com/AquaSnppJpss.yml
```

**该模板定义了哪些其他资源？**

该`AquaSnppJpss`模板包括以下其他资源：
+ （可选）**CloudWatch 事件触发器**-使用联系 AWS Ground Station 前后发送 CloudWatch 的事件触发的 AWS Lambda 函数。该 AWS Lambda 函数将启动并有选择地停止您的接收器实例。
+ （可选）**联系人EC2 验证-使用 Lambda 为**带有 SNS 通知的联系人设置亚马逊 EC2 实例的验证系统的选项。需要注意的是，这可能会产生费用，具体取决于您当前的使用情况。
+  **Ground Station 亚马逊机器映像检索 Lambda**：用于选择您的实例中安装的软件以及您选择的 AMI 的选项。软件选项包括 `DDX 2.6.2 Only` 和 `DDX 2.6.2 with qRadio 3.6.0`。如果要使用宽带 digiF 数据传输和代理 AWS Ground Station ，请参阅。[使用 AWS Ground Station 代理（宽带）的公共广播卫星](examples.pbs-agent.md)随着更多软件更新和功能的发布，这些选项将继续扩展。
+  **其他任务概况** ——其他公共广播卫星（Aqua、SNPP 和 Terra）的任务概况。
+  **其他天线下行链路配置——其他公共广播卫星（Aqua、SN** PP 和 Terra）的天线下行链路配置。

 已填充此模板中卫星的值和参数。这些参数使您可以轻松地 AWS Ground Station 立即使用这些卫星。使用此模板 AWS Ground Station 时，您无需配置自己的值即可使用。但是，您可以自定义这些值以使模板适用于您的使用案例。

 **我可以在哪里接收我的数据？** 

 数据流终端节点组设置为使用此模板的一部分创建的接收实例网络接口。接收器实例使用数据流端点应用程序从数据流端点定义 AWS Ground Station 的端口接收数据流。接收到数据后，可通过接收实例的环回适配器上的 UDP 端口 50000 使用数据。有关设置数据流终端节点组的更多信息，请参阅。[ AWS::GroundStation::DataflowEndpointGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-groundstation-dataflowendpointgroup.html)