Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventPorts without EventOut not regarded #86

Open
kperun opened this issue Dec 9, 2016 · 2 comments
Open

EventPorts without EventOut not regarded #86

kperun opened this issue Dec 9, 2016 · 2 comments

Comments

@kperun
Copy link

kperun commented Dec 9, 2016

I am not quite sure if it is a bug or intended behavior, but whenever we utilize an out EventPort in our model without the corresponding EventOut directive, this port seems not to be further regarded during the simulation. For example, if we define an explicit input (e.g. ), it is required to have an output port in the target model. If this model provides an out-port, but without a corresponding eventout directive, this port can not be further used. By debugging jLEMS I somehow tried to locate the problem: In core/run/WithBuilder, there is a method called postBuild() which is used to retrieve the source and target by the path. However, the component returned as source/target does not contain any output ports (if no out directive is stated), therefore the overall process stops with an nullpoint exception given the fact, that no output port can be found.

I am fully aware that we can avoid this problem by simply stating an event-out directive, but this can result in other problems, e.g. when components communicate between each other.

@pgleeson
Copy link
Member

Thanks for that @kosti1992. I think this error is related to these issues in Inputs.xml: https://github.com/NeuroML/NeuroML2/blob/development/NeuroML2CoreTypes/Inputs.xml#L321, where an <EventPort> is required on a non event based input ComponentType. Again here it's not preventing correct behaviour having these extra statements here, bu may cause trouble for others wishing to use LEMS.

Do you have some example code that can help to see what the underlying issue is?

@kperun
Copy link
Author

kperun commented Dec 19, 2016

Hello Padraig,
sorry for the quite delayed response. I have tried to debug it once more to identify the problem. The parsing and building of the model seems to work fine, however, somehow the attribute "firstOut"
located in the StateInstance class is never assigned if no EventOut directive is located in the model, which results from the fact that the "newInstance()" method of the StateType class, where a
for-each loop iterates over an array of "outPorts", does not have any out ports. This, again, results from the fact that in the "fix()" method of the StateType class, in lines 685-688, a loop iterates
over all conditional blocks. If no EventOut directive is found in some of these blocks, no out-port is added, which consequently leads to problems in "postBuild()" method of the EventConnectionBuilder class (35-141),
where in lines 86-94 the routine tries to find an output port. However, since no port is set, it is not possible to determine the target, which results in an exception.

A possible fix can be to use all out-eventports regardless if there is a event out directive or not, i.e. by not only iterating over the action blocks, but also inspect ports defined in the model. However,
I do not have a in-depth understanding of the system, therefore this fix is just a guess.

I tried to create a fix on model level (i.e. by modifying the explicitInput connection type , link ) but nothing
came out of it, therefore I think this problem can only be solved in the interpreter implementation.

Greetings,

Konstantin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants