在Cooja /半自助旅游旅行社模拟不同温度 [英] Simulating different temperatures on Cooja/Contiki

查看:178
本文介绍了在Cooja /半自助旅游旅行社模拟不同温度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在遇到麻烦的Cooja阅读不同的温度读数。我已经做了以下内容:

I'm having trouble reading different temperature readings on Cooja. I've done the following:


  • 创建初始化轻型和温度传感器的源文件。

  • 使用遥控天空创建一个模拟。

  • 8微尘网络冉模拟。

每个微尘读取这是无用的我想要的相同的温度。我花了过去8小时内通过线程,文件(包括半自助旅游旅行社维基)的目光,一直没能拿出任何东西。

Each mote reads the same temperature which is useless for what I want. I've spent the last 8 hours looking through threads, documentation (including the Contiki wiki) and haven't been able to come up with anything.

如果我误解的方式Cooja /半自助旅游旅行社的工作我也AP preciate一些帮助的,但底线,我怎么模仿,可以通过微尘传感器模拟环境中读取不同的温度?

If I'm misunderstanding the way Cooja/Contiki works I'd also appreciate some help with that but, bottom line, how do I simulate different temperatures that can be read by the mote sensors within the simulation environment?

推荐答案

Cooja / MSPsim不会尝试在默认情况下,以模拟真实的传感器读数。要做到这一点,你需要扩展MSPsim在Java code。

Cooja/MSPsim does not attempt to simulate realistic sensor readings by default. To do that, you'll need to extend the Java code of MSPsim.

阅读天空中的温度传感器仅仅意味着读取ADC端口。
这意味着,模拟定制的读数在该端口上,你需要建立一个自定义的 ADCInput 在该端口上。

Reading the temperature sensor on sky simply means reading an ADC port. This means that to simulate custom readings on that port, you need to set up a custom ADCInput on that port.

<一个href=\"http://sourceforge.net/p/contikiprojects/$c$c/HEAD/tree/uni-erlangen.de/COOJA_SKY_LightSlider/\"相对=nofollow>这里是一个简单的例子,<一个href=\"https://$c$c.google.com/p/kth-gisoo/wiki/Samples#ADC_data_transmission_in_GISOO_-_Using_Contiki\"相对=nofollow>这里是一种先进的例子(这也显示了如何模拟DAC)。

Here is a simple example, and here is an advanced example (that also shows how to simulate DAC).

code改编自第一个链接:

Code adapted from the first link:

private SkyMote skyMote;

private final int MY_VALUE = 123;

protected class MyADC implements ADCInput {
   private int fixedValue;

   public MyADC(int value) {
       fixedValue = value;
   }
   public int nextData() {
       return fixedValue;
   }
}

// temperature sensor on sky is on ADC port 10
IOUnit temperatureADC = skyMote.getCPU().getIOUnit("ADC10");
if (temperatureADC instanceof ADC12) {
   ((ADC12) temperatureADC).setADCInput(4, new MyADC(MY_VALUE));
}

这篇关于在Cooja /半自助旅游旅行社模拟不同温度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆