主要内容

Python集成GPS短信解析算法在仿真软件金宝app

这个例子展示了如何解析短信使用仿真软件在n mea GPS格式字符串块和Python®®。金宝appn mea句子用于海洋之间的通信设备,和模型的示例中解码元n mea和RMC句子。元是推荐的句子为GPS导航数据。RMC是推荐的最低数据GPS的句子句子。

元模型中,您可以选择解码和RMC的句子使用仿真软件或包含Python代码。金宝app这个例子解释了将Python解码的细节。更多的信息模型,利用仿真软件®块解码,明白了金宝app金宝app仿真软件的字符串。在MATLAB®使用Python,明白了从MATLAB -开始访问Python模块

MATLAB支金宝app持Python的参考实现,通常称为CPython的。如果你是Mac或Linux®平台,你已经安装了Python。如果您使用的是Windows®,您需要安装一个分布,如发现https://www.python.org/downloads。有关更多信息,请参见配置您的系统使用Python

探索模型

在模型中,子系统命名n mea数据生成器生成数据,并将数据发送到子系统命名数据分类器。的数据分类器把句子人民币,RMC,或不受支持的。金宝app句子然后送到元译码器,RMC译码器,或不支金宝app持的,这取决于他们的类型。

元模型和RMC解码器使用Python或模型字符串块金宝app

如果你双击块命名元译码器模型,您可以选择使用仿真软件解码器字符串或Python代码块。金宝app

看下面具。注意到,当您选择Python译码器是利用MATLAB建模系统。

开放源代码。观察者的Python代码解码信息纳入setupImplstepImpl功能。

函数setupImpl (obj) py.importlib.import_module (“RMBDecode”);结束
函数y = stepImpl (obj,句子)%的句子转换为python字符串pstr = py.str(句子);
%调用python模块进行字符串处理plist = py.RMBDecode.parseRMBSentence (pstr);
%为仿真软件总线分配python列表元素金宝appy。状态=字符串(plist {1});y。错误= str2double (string (plist {2}));y。ErrorDirection =字符串(plist {3});y。OriginWaypointID = uint16 (str2double(字符串(plist {4})));y。DestinationWaypointID = uint16 (str2double(字符串(plist {5}))); y.DestinationWaypointLatitudeDegree = uint16(str2double(string(plist{6}))); y.DestinationWaypointLatitudeMinute = str2double(string(plist{7})); y.DestinationWaypointNS = string(plist{8}); y.DestinationWaypointLongitudeDegree = uint16(str2double(string(plist{9}))); y.DestinationWaypointLongitudeMinute = str2double(string(plist{10})); y.DestinationWaypointEW = string(plist{11}); y.RangeToDestination = str2double(string(plist{12})); y.TrueBearing = str2double(string(plist{13})); y.Velocity = str2double(string(plist{14})); y.ArrivalAlarm = string(plist{15}); y.Checksum = string(plist{16});结束

模拟模型和评估结果

模拟模型并观察元解码和RMC的句子。

相关的话题