GNSS-SDR学习笔记1--1.5 Control plane

GNSS-SDR_manual.pdf (v0.0.9) 下载地址: https://download.csdn.net/download/wmyan/10632255

目录

GNSS-SDR's main 函数:

GNSSFlowgraph 类 -> flowgraph对象

Control Plane基本工作思想

1.5.1 Configuration

1.5.2 GNSS block factory


GNSS-SDR's main 函数:

GNSS-SDR's main method initializes the logging library, processes the command line flags, if any, provided by the user and instantiates a ControlThread object. Its constructor reads the configuration file, creates a control queue and creates a flowgraph according to the configuration. Then, the program's main method calls the run() method of the instantiated object, an action that connects the flowgraph and starts running it. After that, and until a stop message is received, it reads control messages sent by the receiver's modules through a safe-thread queue and processes them. Finally, when a stop message is received, the main method executes the destructor of the ControlThread object, which deallocates memory, does other cleanup and exits the program.

总结如下:

  1. 初始化logging库(主要用到google开源工具glog);
  2. 处理命令行参数(主要用到google开源工具gflags);
  3. 创建ControlThread对象:ControlThread的构造函数通过调用init()函数:

    (1)创建控制队列control_queue_ ;

    (2)并根据配置文件创建流程图flowgraph_(GNSSFlowgraph),(其构造函数调用了初始化函数init());

    (3)创建控制信息control_message_factory_;

  4. 运行ControlThread对象的成员函数run():

         (1)连接流程图flowgraph_->connect();

         (2)启动流程图flowgraph_->start();

         (3)启动GNSS辅助assist_GNSS();

         (4)启动两个线程:keyboard_thread_, sysv_queue_thread_;

         (5)检测enable_FPGA,如果true,执行捕获辅助flowgraph_->start_acquisition_helper();

         (6)while (flowgraph_->running() && !stop_):

             读取控制信息并根据信息做相应处理read_control_messages(); process_control_messages();

         (7)直到收到停止信息,执行flowgraph_->stop(); flowgraph_->disconnect();主函数执行ControlThread对象的析构函数,释放内存,清除残余信息,并退出程序.

GNSSFlowgraph 类 -> flowgraph对象

The GNSSFlowgraph class is responsible for preparing the graph of blocks according to the configuration, running it, modifying it during run-time and stopping it. Blocks are identified by its role. This class knows which roles it has to instantiate and how to connect them. It relies on the configuration to get the correct instances of the roles it needs and then it applies the connections between GNU Radio blocks to make the graph ready to be started. The complexity related to managing the blocks and the data stream is handled by GNU Radio's gr::top_block class. GNSSFlowgraph wraps the gr::top_block instance so we can take advantage of the GNSS block factory, the configuration system and the processing blocks. This class is also responsible for applying changes to the configuration of the flowgraph during run-time, dynamically reconfiguring channels: it selects the strategy for selecting satellites. This can range from a sequential search over all the satellites' ID to smarter approaches that determine what are the satellites most likely in-view based on rough estimations of the receiver position in order to avoid searching satellites in the other side of the Earth.

总结如下:

  1. GNSSFlowgraph类的作用:根据配置文件准备各个模块图,运行,在线修改和停止这些模块;
  2. GNSSFlowgraph类通过配置文件正确执行例化和连接各个GNU Radio模块;
  3. GNSSFlowgraph类包含了GNU Radio's gr::top_block类,所以可以充分利用GNSS block factory,配置系统和处理模块;

(1)GNSSFlowgraph->init(): 例化接收机模块

  • 创建block_factory_(GNSSBlockFactory)
  • read the number of RF front-ends available (one file_source per RF front-end):读取sources_count_,设置RF_Channels, sig_conditioner_, signal_conditioner_ID
  • 初始化observables_, pvt_, channels_
  • 创建top_block_
  • 初始化mapStringValues_
  • 设置要捕获的信号set_signals_list();
  • 设置通道状态set_channels_state();
  • 设置状态机初始状态applied_actions_ = 0;
  • 例化接收机监测模块(可选) enable_monitor_:通过UDP把数据发上来

(2)GNSSFlowgraph->start(): 创建一个或多个线程来执行流程图;

(3)GNSSFlowgraph->connect():连接各个模块: Signal Source > Signal conditioner >> Channels >> Observables >> PVT;

  • Signal Source (i) >  Signal conditioner (i) >
  • connect the signal source to sample counter
  • connect the sample counter to Observables
  • Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID)
  • Signal Source > Signal conditioner >> Channels >> Observables
  • Put channels fixed to a given satellite at the beginning of the vector, then the rest
  • Assign satellites to channels in the initialization
  • Connect the observables output of each channel to the PVT block
  • GNSS SYNCHRO MONITOR
  • Activate acquisition in enabled channels

Control Plane基本工作思想

The Control Plane is in charge of creating a flowgraph according to the configuration and then managing the modules. Configuration allows users to define in an easy way their own custom receiver by specifying the flowgraph (type of signal source, number of channels, algorithms to be used for each channel and each module, strategies for satellite selection, type of output format, etc.). Since it is difficult to foresee what future module implementations will be needed in terms of configuration, we used a very simple approach that can be extended without a major impact in the code. This can be achieved by simply mapping the names of the variables in the modules with the names of the parameters in the configuration.

总结如下:

  1. Control Plane 根据配置文件生成流程图并管理各个模块;
  2. 配置文件作用:配置信号源类型,通道数量,各个通道和模块的算法,选星策略和输出格式等;
  3. 通过映射配置文件参数到模块的变量,来简化代码的维护工作,便于后期维护和扩展;

1.5.1 Configuration

Properties are passed around within the program using the ConfigurationInterface class. There are two implementations of this interface: FileConfiguration and InMemoryConfiguration. FileConfiguration reads the properties (pairs of property name and value) from a file and stores them internally. InMemoryConfiguration does not read from a file; it remains empty after instantiation and property values and names are set using the set property method. FileConfiguration is intended to be used in the actual GNSS-SDR application whereas InMemoryConfiguration is intended to be used in tests to avoid file-dependency in the file system. Classes that need to read configuration parameters will receive instances of ConfigurationInterface from where they will fetch the values.

ConfigurationInterface类: FileConfiguration  InMemoryConfiguration两种实现方式

  1. FileConfiguration: 从文件中读取配置信息,通常用于实际的GNSS-SDR应用中;
  2. InMemoryConfiguration: 例化后保持空,通过the set property method来设置参数;通常用于避免依赖文件的应用中;

由于配置只是一组没有任何含义或语法的属性名称和值,因此该系统非常通用且易于扩展。

1.5.2 GNSS block factory

Hence, the application defines a simple accessor class to fetch the configuration pairs of values and passes them to a factory class called GNSSBlockFactory. This factory decides, according to the configuration, which class needs to be instantiated and which parameters should be passed to the constructor. Hence, the factory encapsulates the complexity of blocks' instantiation. With that approach, adding a new block that requires new parameters will be as simple as adding the block class and modifying the factory to be able to instantiate it. This loose coupling between the blocks' implementations and the syntax of the configuration enables extending the application capacities in a high degree. It also allows to produce fully customized receivers, for instance a testbed for acquisition algorithms, and to place observers at any point of the receiver chain.

通过简单的访问类就可以将配置的值传递给GNSSBlockFactory类, 该factory根据配置文件决定哪些类需要被例化,哪些参数需要传递给构造函数, 简化了各个block模块的例化的复杂性; 添加需要新参数的新的block将变得很简单.

猜你喜欢

转载自blog.csdn.net/wmyan/article/details/82154054