MATLAB仿真高速目标检测-基于keystone变换的微弱目标检测

MATLAB仿真高速目标检测-基于keystone变换的微弱目标检测

高速目标检测具有跨距离走动,不易相参积累,而相参积累时间内,目标的距离走动不能超过半个距离单元,对于高距离分辨雷达或观测高速目标的雷达系统,这种限制是很难满足的。于keystone 变换的运动补偿方案,可以在没有目标运动速度信息条件下校正距离走动,从而使积累时间不再受目标运动的限制。 怎样仿真 在没有用keystone变化 和变化后的 雷达回波波形?回波横坐标是:相对距离,纵坐标是幅度;比如:例如,若雷达发射的信号带宽为150MHz ,脉冲重复周期为100μs ,发射的脉冲数目为63 个,目标的径向速度为1000m/ s ,则相参积累的时间为613ms ,在此期间目标运动了6. 3m,跨越了6 个距离分辨单元。

文件:590m.com/f/25127180-499945892-143927(访问密码:551685)

以下内容无关:

-------------------------------------------分割线---------------------------------------------

Netty+最朴素的阻塞的方式来实现一版客户端和服务端通信的代码,然后再重构成Netty官方推荐的写法。

第一步,引入netty依赖包。

io.netty netty-all 4.1.65.Final 准备发送端

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

import java.net.InetSocketAddress;

import static java.nio.charset.StandardCharsets.UTF_8;

/**

  • @author Grey

  • @since
    */
    public class NettyClientSync {
    public static void main(String[] args) throws Exception {
    NioEventLoopGroup thread = new NioEventLoopGroup(1);
    NioSocketChannel client = new NioSocketChannel();
    thread.register(client);
    ChannelPipeline p = client.pipeline();
    p.addLast(new MyInHandler());
    ChannelFuture connect = client.connect(new InetSocketAddress(“192.168.205.138”, 9090));
    ChannelFuture sync = connect.sync();
    ByteBuf buf = Unpooled.copiedBuffer(“hello server”.getBytes());
    ChannelFuture send = client.writeAndFlush(buf);
    send.sync();
    sync.channel().closeFuture().sync();
    System.out.println(“client over…”);
    }

    static class MyInHandler extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRegistered(ChannelHandlerContext ctx) {
    System.out.println(“client register…”);
    }

     @Override
     public void channelActive(ChannelHandlerContext ctx) {
         System.out.println("client active...");
     }
    
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) {
         ByteBuf buf = (ByteBuf) msg;
         CharSequence str = buf.getCharSequence(0, buf.readableBytes(), UTF_8);
         System.out.println(str);
         ctx.writeAndFlush(buf);
     }
    

    }
    }
    这个客户端主要就是给服务端(192.168.205.138:9090)发送数据, 启动一个服务端:

[root@io ~]# nc -l 192.168.205.138 9090
然后启动客户端,服务端可以接收到客户端发来的数据:

[root@io ~]# nc -l 192.168.205.138 9090
hello server

这就是netty实现的一个客户端,再来看服务端的写法:

import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;

import java.net.InetSocketAddress;

/**

  • @author Grey

  • @since
    */
    public class NettyServerSync {
    public static void main(String[] args) throws Exception {
    NioEventLoopGroup thread = new NioEventLoopGroup(1);
    NioServerSocketChannel server = new NioServerSocketChannel();
    thread.register(server);
    ChannelPipeline p = server.pipeline();
    p.addLast(new MyAcceptHandler(thread, new NettyClientSync.MyInHandler()));
    ChannelFuture bind = server.bind(new InetSocketAddress(“192.168.205.1”,9090));
    bind.sync().channel().closeFuture().sync();
    System.out.println(“server close…”);
    }

    static class MyAcceptHandler extends ChannelInboundHandlerAdapter {

     private final EventLoopGroup selector;
     private final ChannelHandler handler;
    
     public MyAcceptHandler(EventLoopGroup thread, ChannelHandler myInHandler) {
         this.selector = thread;
         this.handler = myInHandler;
     }
    
     @Override
     public void channelRegistered(ChannelHandlerContext ctx) {
         System.out.println("server registered...");
     }
    
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) {
         SocketChannel client = (SocketChannel) msg;
         ChannelPipeline p = client.pipeline();
         p.addLast(handler);
         selector.register(client);
     }
    

    }
    }
    启动这个服务端,然后通过一个客户端来连接这个服务端,并且向这个服务端发送一些数据

[root@io ~]# nc 192.168.205.1 9090
hello
hello
服务端可以感知到客户端连接并接收到客户端发来的数据

client register…
client active…
hello
但是,这样的服务端如果再接收一个客户端连接,客户端继续发送一些数据进来,服务端就会报一个错误:

An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.channel.ChannelPipelineException: git.snippets.io.netty.NettyClientSync$MyInHandler is not a @Sharable handler, so can’t be added or removed multiple times.
原因在这个博客里面说的比较清楚:Netty ChannelHandler使用报错

我们可以发现每当有新的数据可读时都会往这个channel的pipeline里加入handler,这里加的是childHander。值得注意的是,我们初始化的时候这个childHandler都是同一个实例,也就说会导致不同的channel用了同一个handler,这个从netty的设计角度来说是要避免的。因为netty的一大好处就是每一个channel都有自己绑定的eventloop和channelHandler,这样可以保证代码串行执行,不必考虑并发同步的问题。所以才会有checkMultiplicity这个方法来检查这个问题。那该怎么办呢?netty的这段代码:child.pipeline().addLast(childHandler)就是用了同一个handler啊,怎么才能为每一个channel创建不同的handler呢?
很简单,只要写个类继承ChannelInitializer就行了,ChannelInitializer这个类比较特殊,你可以把它想象成是很多channelhandler的集合体,而且这个类就是@Shareable的,继承了这个类之后你可以为每一个channel单独创建handler,甚至是多个handler。