Error in module during network setup: - omnet++

Class not found perhaps it 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().

As suggested you should use
Define_Module(yourModule)
in your .cc file.
If this gives error, check that all the functions listed in yourModule.h have been also declared in yourModule.cc

Related

Phpstan Class_parent not found

I am trying to get static PHP code analysis to work on my OXID 6 eshop.
I am, however, hitting a brick wall when it comes to this:
When I run vendor/bin/phpstan analyse --configuration phpstan.neon source/modules/myvendor/mymodule I always get errors like Class mynamespace\Article_parent not found.
This is probably because in Oxid, the eshop classes are not directly overwritten, but instead declared like this
<?php
namespace mynamespace;
class Article extends Article_parent
{
...
and in a metadata.php the overwritten class is defined:
'extend' => [
\OxidEsales\Eshop\Application\Model\Article::class => \mynamespace\Article::class,
],
Phpstan does not seem to be able to resolve this, I've tried many different configuration files, like this one
parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
autoload_files:
- vendor/oxid-esales/oxideshop-ce/source/oxfunctions.php
- vendor/oxid-esales/oxideshop-ce/source/overridablefunctions.php
or this one
parameters:
level: 7
autoload_files:
- vendor/oxid-esales/testing-library/base.php
- vendor/oxid-esales/oxideshop-ce/source/oxfunctions.php
- vendor/autoload.php
but to no avail.
How can I get phpstan to work?
Please upgrade to the latest PHPStan version 0.12.33.
In version 0.12.26 a lot has been reworked that's described in this article. The main takeaway is that you should no longer get "class not found" for classes that clearly exist without any need for additional configuration.
Also, autoload_files has been deprecated. Please follow Discovering Symbols guide to see what to do instead (you can most likely just delete this section from your configuration).
The \mynamespace\Article_parent class does not exist and will be created at runtime as an alias. This is because it depends on your configuration / other modules installed where this alias points to.
My colleague Alfred Bez created the oxid-dump-autoload tool, what will dump out the module chain based on your current configuration and setup, so that PHPStan / Psalm can find the classes:
https://github.com/alfredbez/oxid-dump-autoload
Hope I could help

OMNET++: error in module cModule during network setup

I'm trying to run my first Castalia/WSN simulation (testRouting) in Omnet++ including folders with .ned and c++/h files (TestRouting.h , TestRouting.cc and TestRouting.ned) and the .ini file and I have fixed errors that appears at the omnet IDE.
When I start a simulation I receive the error:
Error in module (cModule) SN.node[0].Communication (id=10) during network setup: Submodule Routing: no module type named 'TestRouting' found that implements module interface node.communication.routing.iRouting(not in the loaded NED files ?), at omnetpp-4.6/samples/castalia/src/node/communication/CommunicationModule.ned:32.
I already tried to rebuild OMNeT++ with Castalia as I have read in other proposed solutions, but it didn’t help.
Can you help me?
The error happens because your TestRouting module in TestRouting.ned does not properly implement the node.communication.routing.iRouting module interface.
Your code in the TestRouting.ned file should at least look something like this:
simple TestRouting like node.communication.routing.iRouting
or something similar.
In short: your model code is incorrect...

Error during initialization of TrafficLight node in Veins 4.7.1

How can I use the TrafficLight node in Veins 4.7.1 with a custom app?
I tried to add a trafficlight node the same way we add RSU nodes, i.e.:
import org.car2x.veins.nodes.Scenario;
import org.car2x.veins.nodes.TrafficLight;
network EV_Scenario3 extends Scenario
{
#display("bgb=844,629");
submodules:
tl[2]: TrafficLight {
#display("p=150,140;i=veins/node/trafficlight;is=s");
}
}
and define its app in the omnetpp.ini file i.e. *.tl[*].applType = "TrafficLightApp"
This method does not work and I got the following error:
submodule appl: No module type named 'TrafficLightApp' found that
implements module interface
org.car2x.veins.base.modules.ITrafficlightApplLayer (Not in the loaded
NED files?), at
C:\Veins\veins-5.7.1\src\veins\nodes\TrafficLight.ned: 35 -- in module
(omnetpp::cModule) EV_Scenario3.tl[0] (id-7), during network setup
Any Idea how to use this node, and How can I generate it dynamically like the car nodes?
OMNeT++ does not know a module called TrafficLightApp or this module does not implement the ITrafficlightApplLayer interface.
If you have created the module TrafficLightApp already, make sure that it also implements the aforementioned interface.
If you have not created this module already, you need to create (and register) it first.
Please note that Veins 4.7 introduces traffic lights but does not provide an application layer for them. You have to build one yourself, implementing the ITrafficlightApplLayer interface.

Functions needed to be overwritten for own scheduler inheriting cscheduler

I want to create a scheduler inheriting cScheduler. Can someone please tell me which are the functions to be written which must override the functions of cscheduler? Currently, I have written the constructor, destructor, startRun, endRun, guessNextEvent, takeNextEvent, putBackEvent. I have also mentioned the class in the initialization file and able to successfully build my project but when I run the simulation I get the error: Class TraCIConnection" not found -- perhaps it's 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().
The mentioned error has absolutely nothing to do with the custom scheduler you are trying to implement. Omnet complains because you are using the TraCIConnection simple module in the simulation while its C++ code is not linked into the simulation. You may need to add the C++ code to the project or link with an external model that provides that.

SwiftAutomation custom record compiler error

I'm using the SwiftAutomation framework to drive a scriptable app that searches for lyrics and returns a AS record. Everything was working correctly, until...
I mapped the AppleScript record to a custom Swift structure according to the SwiftAutomation documentation. The code in the xxxGlue.swift file looks correct, but the compiler complains about SwiftAutomation.SelfUnpacking, with several follow-on errors, when building the MacOSGlues framework.
public struct LFBLyricsInfoRecord: SwiftAutomation.SelfPacking, SwiftAutomation.SelfUnpacking { ... }
--> .../MacOSGlues/LyricsFBAGlue.swift:700:81: No type named 'SelfUnpacking' in module 'SwiftAutomation'
The SelfPacking public protocol is defined in SwiftAutomation, and SelfUnpacking protocol is defined right under it, but without the public keyword. Is that the cause of the compiler error, and if so, how do I fix it?
OK, I finally found a resolution. Seems you have to use different options for the aeglue utility when generating the glue file for the MacOSGlues framework and for the swift file where you actually use your automation, such as in the test project. In my case, where my scriptable app is named LyricsFBA.app, these were:
aeglue -S LyricsFBA.app
for MacOSGlues (generates a LyricsFBAGlue.swift that references SwiftAutomation, but does not include the custom record structure definition), and
aeglue -D -s 'LyricsInfo:lyricsInfo=score:Int+title:String+artist:String+composer:String+link:String+lyrics:String' LyricsFBA.app
for the test program (generatea a LyricsFBAGlue.swift that does not reference SwiftAutomation, but does include the custom record structure definition).

Resources