1

ispin is generating this message on the progress window (the mid bottom screen on the simulate tab): Error: sending to an uninitialized chan

The weird thing is that the error message starts to appear in the middle of the simulation (I set the maximum step number to 10000 and the it starts to appear around 6000 steps).

How can this be? does spin somehow lose the chan initialization in the middle of the simulation?

this is initialization of one of the channel I use:

chan VP = [1] of {byte};

and this is the error message during the simulation:

enter image description here

Community
  • 1
  • 1
Moon
  • 31
  • 2

1 Answers1

0

This is a mcve for the the error you are experiencing:

chan c;

init {
    c!10;
}

which yields

~$ spin test.pml 
Error: sending to an uninitialized chan
      timeout
Error: sending to an uninitialized chan
#processes: 1
  0:    proc  0 (:init::1) test.pml:4 (state 1)
1 process created

It is possible that you forgot to state whether the channel is synchronous or asynchronous, and what kind of messages it should contain. A proper channel declaration should look like this:

chan c = [N] of { type_1, ..., type_M };

where N is larger or equal 1 for any asynchronous channel and 0 otherwise, and type_1, ..., type_M is the list of types (i.e. int, bool) of the fields contained in one message.

For more details, read the documentation.

Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
  • thanks for your answer but my channel initialization was done correctly. All my channels have a length of 1 with data type of byte ie: chan C = [1] of {byte};. As I said the error message doesn't appear at the start of the simulation. It starts to appear as the simulation progresses. – Moon Apr 02 '19 at 14:33
  • @Moon well, that's why *stackoverflow* invites every person to include a **mcve** in their question. Please edit your question with your code. – Patrick Trentin Apr 02 '19 at 14:35
  • I have edited the question with the channel initialization and the screenshot of the error – Moon Apr 02 '19 at 14:47
  • @Moon **mvce** means *minimal, complete, verifiable example*, that is a piece of code that generates the error you are experiencing. – Patrick Trentin Apr 02 '19 at 14:49
  • well. the code is too long to add here. My point is that come ispin complains about the uninitialized channel when the channel initialization was done correctly? The receiving code is just simple statement of if::VP?[VP_input] -> VP?VP_input; ::else-> VP_input = 0; fi. Sending statement is also simpl VP!VP_out; with VP_out and VP_input all declared as byte. Those are only relevant part regarding the error message right? – Moon Apr 02 '19 at 14:58
  • @Moon when it happens something unexpected, it is better to not make any assumption. This might be a bug, a flaw in your model or something else. If you can't share the code, I don't think that I can help you any further. Good luck! :) – Patrick Trentin Apr 02 '19 at 15:13