Cannot connect .ned file with its .h and .cc files - omnet++

I have the following simple module
PythonConnection.ned
simple PythonConnection {
#class(PythonConnection);
// my code
}
PythonConnection.h
#include <omnetpp.h>
class PythonConnection : public omnetpp::cSimpleModule {
//my code
}
PythonConnection.cc
#include "PythonConnection.h"
Define_Module(PythonConnection);
void PythonConnection::initialize() {
//my code
}
all of them are located in the same directory.
I am importing this simple module in circles.ned file
package circles;
import PythonConnection;
network circles
{
submodules:
python_connection: PythonConnection;
}
But I do not understand why I keep getting
A runtime error occurred:
Class "PythonConnection" not found -- perhaps its code was not linked in, or the class wasn't registered with Register_Class(), or in the case of modules and channels, with Define_Module()/Define_Channel() -- in module (omnetpp::cModule) circles (id=1), during network setup
when I launch the program. Could somebody help?

My problem was that I have created General project. To make it work, OMNeT++ Project is required.

Related

Run Time Error: perhaps its code was not linked in, or the class wasn't registered with Register_Class()/Define_Module()/Define_Channel()?

I have already declared Define_Module(veins:: TraCIDateDissemination) and go through with various suggestions provided but getting this error again. Any suggestion is welcome. please help.
How to register a new class (new application) in Omnet++
Error in module during network setup:
Class "simpleModule" not found in omnetpp
https://doc.omnetpp.org/omnetpp/manual/
In manual I checked -
7.12.3 Class Registration
You should also use the Register_Class() macro to register the new class. It is used by the createOne() factory function, which can create any object given the class name as a string. createOne() is used by the Envir library to implement omnetpp.ini options such as rng-class="..." or scheduler-class="...". (see Chapter [17])
But not able to understand. pls help.
A runtime error occurred:
Class "TraCIDataDissemination" not found -- perhaps its code was not linked in, or the class wasn't registered with Register_Class(), or in the case of modules and channels, with Define_Module()/Define_Channel() -- in module (omnetpp::cModule) RSUExampleScenario.node[0] (id=13), at t=1s, event #2
Launch a debugger with the following command?
nemiver --attach=20070 &
OMNET.INI
##########################################################
# App Layer #
##########################################################
#*.node[*].applType = "TraCIDemo11p"
*.node[*].applType = "TraCIDataDissemination"
*.node[*].appl.headerLength = 80 bit
TraCIDataDissemination.h
namespace veins {
class TraCIDataDissemination : public DemoBaseApplLayer {
public:
{
//my code
}
}
TraCIDataDissemination.cc
#include "veins/modules/application/traci/TraCIDataDissemination.h"
#include<math.h>
using namespace veins;
Define_Module(veins::TraCIDataDissemination);
//code
TraCIDataDissemination.ned
package org.car2x.veins.modules.application.traci;
import org.car2x.veins.modules.application.ieee80211p.DemoBaseApplLayer;
simple TraCIDataDissemination extends DemoBaseApplLayer
{
#class(TraCIDataDissemination);
#display("i=block/app2");
}
Please Help!!

How to use someClass.android.ts and someClass.ios.ts without errors

I'm using nativescript angular. I have a class called SomeClass that access the native API of iOS and Android separately.
I've written two files:
someclass.android.ts
export class SomeClass {
someFunction() {
if(isAndroid) {
// do some android specific code
}
}
}
someclass.ios.ts
export class SomeClass {
someFunction() {
if(isIOS) {
// do some ios specific code
}
}
}
Now, in app.component.ts, I'm using SomeClass like this:
import { SomeClass } from './../shared-code/someclass';
without .android.ts or .ios.ts, to enable nativescript to pick the right file depending on the running platform.
and then in the code, I user SomeFunction like this:
...
const someClass = new SomeClass();
someClass.someFunction();
...
With this setting, everything works perfectly on both iOS and Android, but I get the following error
error TS2307: Cannot find module './../shared-code/someclass'.
Do you have any idea how to tell nativescript/tslint to take into account the .android and .ios files and not to display this error?
Thanks
Here's the solution:
Alongside 'someclass.ios.ts' and 'someclass.android.ts', create a definitions file and name it 'someclass.d.ts' (Not index.d.ts). No need to put the files in a separate folder.
In someclass.d.ts, export declare the class like this:
export declare class SomeClass {
/**
* someFunction, is a function that does this and that (description)
*/
someFunction(): void;
}
Then, you can use this from another file like this:
In app.component.ts:
import { SomeClass } from './../shared-code/someclass';
Remember to use /someclass without any extensions.
This would solve build and tslint errors.

Omnet++ simple wireless node

Iam trying to create simple wireless node for MANET network which can send messages to other nodes in range. Solutions implemented in INET also contains other layers like IP, transport, application which i dont need.
Iam new to omnet++ so iam struggling a bit. I was thinking of creating whole own node with RadioIn input, but i dont know how to implement only in range communication and i will also need node mobility.
Other solutions would be to use only Radiomedium from INET framework but i dont know how to do it.
Can someone please give me some begginer tips how to achieve my goal? As i said i simply need to create mobile host which can send a defined message to all other hosts in range.
EDIT: I tried to take IdealRadioMedium and create my simple module and connect to it. Here is the NED File.
import inet.physicallayer.common.packetlevel.Radio;
import inet.common.figures.DelegateSignalConfigurator;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.node.inet.INetworkNode;
import inet.node.inet.WirelessHost;
import inet.physicallayer.contract.packetlevel.IRadioMedium;
import inet.visualizer.integrated.IntegratedCanvasVisualizer;
import inet.linklayer.contract.IWirelessNic;
import inet.networklayer.common.InterfaceTable;
simple Txc1
{
gates:
input in;
output out;
}
module Pokusny
{
parameters:
#display("i=device/wifilaptop");
int numRadios = default(1);
#networkNode;
gates:
input radioIn[numRadios] #directIn;
submodules:
mynode: Txc1;
wlan[numRadios]: <default("Ieee80211Nic")> like IWirelessNic {
parameters:
#display("p=216,406,row,60;q=queue");
}
interfaceTable: InterfaceTable {
parameters:
#display("p=53,300;is=s");
}
connections allowunconnected:
for i=0..sizeof(radioIn)-1 {
radioIn[i] --> { #display("m=s"); } --> wlan[i].radioIn;
wlan[i].upperLayerOut --> mynode.in;
wlan[i].upperLayerIn <-- mynode.out;
}
}
network WirelessC
{
parameters:
string hostType = default("WirelessHost");
string mediumType = default("IdealRadioMedium");
#display("bgb=650,500;bgg=100,1,grey95");
#figure[title](type=label; pos=0,-1; anchor=sw; color=darkblue);
#figure[rcvdPkText](type=indicatorText; pos=420,20; anchor=w; font=,20; textFormat="packets received: %g"; initialValue=0);
#statistic[rcvdPk](source=hostB_rcvdPk; record=figure(count); targetFigure=rcvdPkText);
#signal[hostB_rcvdPk];
#delegatesignal[rcvdPk](source=hostB.udpApp[0].rcvdPk; target=hostB_rcvdPk);
submodules:
visualizer: IntegratedCanvasVisualizer {
#display("p=580,125");
}
configurator: IPv4NetworkConfigurator {
#display("p=580,200");
}
radioMedium: <mediumType> like IRadioMedium {
#display("p=580,275");
}
//figureHelper: DelegateSignalConfigurator {
// #display("p=580,350");
//}
hostA: Pokusny {
#display("p=50,325");
}
hostB: Pokusny {
#display("p=450,325");
}
}
Txc1.cc
class Txc1 : public cSimpleModule
{
protected:
// The following redefined virtual function holds the algorithm.
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
};
// The module class needs to be registered with OMNeT++
Define_Module(Txc1);
void Txc1::initialize()
{
cMessage *msg = new cMessage("tictocMsg");
send(msg, "out");
}
void Txc1::handleMessage(cMessage *msg)
{
send(msg, "out"); // send out the message
}
And .ini file
network = WirelessC
sim-time-limit = 25s
*.host*.wlan[0].typename = "IdealWirelessNic"
*.host*.wlan[0].mac.useAck = false
*.host*.wlan[0].mac.fullDuplex = false
*.host*.wlan[0].radio.transmitter.communicationRange = 500m
*.host*.wlan[0].radio.receiver.ignoreInterference = true
*.host*.**.bitrate = 1Mbps
When i run the simulation it asks for Interfacetable parameter which i dont know what to type there becuse i havent found it in traversing functioning code ( I had to add it because it throws error that is missing if its not as submodule). Now iam getting
getCointainingNode() node module not found it should have a property name networkNode for module WirelessC.interfaceTable in module .... durint network initialization
EDIT: I added networknode as parameter and now i got Module not found on path '.mobility' defined by par WirelessC.hostA.wlan[0].radio.antenna.Mobilitymodule in module inte::physicallayer:IsotropicAntenna during network initialization
I'd like to point you to the wireless tutorial for INET: https://omnetpp.org/doc/inet/api-current/tutorials/wireless/
It starts with exactly your problem. The only thing left, is to replace the standard UDP host with a host using no protocol at all, maybe even implementing your own. The whole wireless part is explained in the tutorial.
If you want to check the source files for the used modules you need to walk down the chain of dependency since every compound NED module will (at one point) contain simple modules implemented in C++.
E.g. the module which is responsible for distributing the signals is IdealRadioMedium using RadioMedium. Now you need to find the Node implementation directly communicating with this module.
Starting with the WirelessHost used in the tutorial the underlying modules are
StandardHost -> ApplicationLayerNodeBase -> LinkLayerNodeBase with the later being the first one using actually implemented submodules.
The network adapter used is configured in the omnet.ini with *.host*.wlan[0].typename = "IdealWirelessNic". This module relies on Radio.
With all that found out you just need to look for API calls from Radio.cc made to RadioMedium.cc and you found the actual code responsible for sending data.
Understanding that chain of inheritance you can even hook in with your custom module at a level you find fitting. For example just implementing your own LinklayerNodeBase module.
If you are going for wireless communication and mobility, INET will still be the best framework to use.
Check out the INET Wireless Tutorial. It basically covers all the steps that you need to build a small scenario with moving nodes that communicate wirelessly.

Typescript reference comment for working

I am using Visual Studio 2013 Ultimate Update 4 and Typescript.
I have a class like MyClass.ts:
/// <reference path="interfaces/IMyClass"/>
export = MyModule;
module MyModule {
class MyClass {
constructor(myObject: IMyClass){....}
...
}
}
And another MyInterface.ts:
export = MyModule;
module MyModule {
interface IMyClass {
...
}
}
VS2013 is not acknowledging the IMyClass reference in the MyClass file (no intellisense either), but the reference is acting like VS can see it (no red underlines saying it can't find the file).
If I change the interface filename to MyInterface.d.ts, it does the same thing.
If I change the interface inside MyInterface.d.ts to this:
//export = MyModule ;
declare module MyModule {
interface IMyClass {
...
}
}
it fails as well.
If I change the interface inside MyInterface.d.ts to this:
//export = MyInterfaces ;
declare module MyInterfaces {
interface IMyClass {
...
}
}
it works.
Am I missing something? So we can only use reference comments for .d.ts files and the exported module names can be the same??
I'm finding a lot of the stuff around modules in typescript to be confusing.
Thanks in advance.
VS2013 is not acknowledging the IMyClass reference in the MyClass file (no intellisense either),
The modules MyModule between two TypeScript files that use external modules are distinct. And therefore you don't get interface IMyClass available in the second files MyModule.
Tip: You might want to review internal vs. external modules in TypeScript (hint: don't use internal ones if you are using external modules). https://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1

LINK : fatal error LNK1104: cannot open file 'OrgeMain_d.lib. Trying to set up an ogre3d app

I've searched around and can't find anything that relates to my problem.
#include "Ogre\ExampleApplication.h"
class Example1 : public ExampleApplication
{
public:
void createScene()
{
}
};
int main(void)
{
Example1 app;
app.go();
return 0;
}
Steps I've taken:
added ...\OgreSDK_vc10_v1-7-4\include to the include path of my project.
added ...\OgreSDK_vc10_v1-7-4\boost_1_42 to the include path of my project.
added ...\OgreSDK_vc10_v1-7-4\boost_1_42\lib to my library path.
added ...\OgreSDK_vc10_v1-7-4\lib\debug to my library path.
linked OgreMain_d.lib and OIS_d.lib
I've also tried it the way the Ogre site teaches you. But I get the same errors.
Using Visual Studio 2010.
It seems the library name is misspelled. It should be OgreMain_d.lib, not OrgeMain_d.lib.

Resources