Spinroot

A forum for Spin users

You are not logged in.

#1 Re: General » Model is too large » 2019-03-08 02:24:43

I see, so probably it is the channels. I have 5 processes and 10 channels, four of which has size 7, two has size 3, and four has size 1. There is only one counter that is either 0 or 1.

I guess one solution to decrease the model size is using arrays instead of channels and implement send and receive for them as d_steps. I appreciate if you have a better suggestion?

#2 General » Model is too large » 2019-03-07 18:31:24

maryam
Replies: 4

Hi,

I am modeling a quasi-synchronous system, which consists of several processes, and processes communicate through channels. I have modeled each process similar to the controller process in the following. Every process is activated periodically, reads all messages in its inbox channels atomically, do local computation, and publishes messages. Publishing messages to different channels can be interleaved by other processes execution. To model the interleaving between a message publish and its delivery, I am using two separate channels. commchan_topicname maintains messages published but not delivered yet, and ch_topicname shows the inbox of a process for that topic. There is also a process called deliver, which nondeterministically delivers a message to a process inbox (removes a message from commchan_topicname and sends it to ch_topicname). The model has four such processes plus the deliver process, and it consumes a lot of memory, while it seems simpler than that, as I have wrapped most sequences in a d_step block. Any idea what is wrong in my model, which causes significant memory consumption?

proctype ControllerP()
{
  bool indngr = false;
  short pwr = 10;

  do
  :: len(ch_danger) >= cont_danger_min && len(ch_speed) >= cont_speed_min && len(ch_go) >= cont_go_min ->
    d_step {
      read_chan(ch_danger, local_bfr_danger, cont_danger_size);
      read_chan(ch_speed, local_bfr_speed, cont_speed_size);
      read_chan(ch_go, local_bfr_go, cont_go_size) };
    d_step { step_controller(); };

    len(ch_power) + len(commchan_power) < act_power_size ->
      d_step { publish(tpcPowerId, pwr); };
    len(ch_indanger) + len(commchan_indanger) < opt_indanger_size ->
      d_step { publish(tpcIndangerId, indngr); };
  od;
}

#3 Re: General » Confused about the result of using atomic sequence » 2014-04-18 11:05:06

Thank you very much for the explanation. I have a better understanding of an atomic sequence now.

#4 General » Confused about the result of using atomic sequence » 2014-04-17 16:13:01

maryam
Replies: 2

Hi,

I have two following statements in the model (the program model is the self-composed model of a program with parallel composition):

   c_code{};
   (!lock);

The first statement is always followed by the second one. So, I wrapped these two statements as an atomic sequence as follows:

   atomic{
        c_code{};
        (!lock);
   }

As expected, the number of states were decreased for concurrent programs (when lock is zero, the sequence is executed indivisibly).
But, the result for sequential programs was surprising, where the number of states were increased a bit little! I cannot understand why?!

many thanks in advance

#5 General » The number of states while using inline macros or c_code fragments » 2014-04-14 18:19:19

maryam
Replies: 1

my program model uses a few inline macros, which are called in most parts of the model (all those inline calls are in d_step sequences).
Thus, I think using embedded c_code, and implementing those inline macros as C functions would decrease the number of states in the model. please correct me, if I am wrong?

Thank you very much

#6 Re: General » Difference between states stored and matched » 2014-04-13 17:57:35

thank you very much for your helpful response.

#7 Re: General » Difference between states stored and matched » 2014-04-13 17:00:12

newer versions have the number of visited too, which is different from stored and matched. I cannot understand what does "visited" indicate? for example, (335 visited) in the following.
      197 states, stored (335 visited)
      448 states, matched
      783 transitions (= visited+matched)

many thanks in advance

#8 Re: General » Dynamic allocation using embedded C code » 2014-03-18 06:46:43

Thank you very much for the reply.

With my own realloc() routine:

1. As the array is a NULL pointer at first, second argument of c_track is zero indeed. Then, since c_track is a global primitive, I cannot understand how can I track the array whenever I change its size (in a d_step block)?

2. Does SPIN have an automatic garbage collection?

#9 General » Dynamic allocation using embedded C code » 2014-03-16 21:08:29

maryam
Replies: 3

Is dynamic allocation allowed in embedded c code?

I have used realloc() (for an array with dynamic length) in my model, but there is a "core dumped" error. If I change the code as the array's length is static, everything works fine.

I know that when the lenght of array is one, realloc() free it. But then it points to a place of memory which is not initialized, and I don't know how it is created!!!

Is there a way to debug the code to locate exactly the line that results in error?

Thanks a lot,
Maryam

#11 General » variable's value in the previous state » 2012-11-12 10:50:34

maryam
Replies: 2

I was wondering if there is a ready function to get the value of a variable in the previous state? Or just a prefix (e.g. 'pre') or somewhat like 'now'?

#12 Re: General » access to execution trace » 2012-10-09 20:40:49

yes, in fact spin is a tremendous tool and working with that is realy interesting. Ok, definitely I'll ask him for advice, and I realy appreciate your help, it was so helpful.

#13 Re: General » access to execution trace » 2012-10-09 16:57:44

I should say that ,yes there is an option named "track data values" in iSpin that does the same work. But as you said, this will just <i>print</i> the value of a variable each time it changes, and what I need is to have these changes, may be as an array (or what ever) and use them at the end of execution. may be I could do this using embedded c code? or... find some other way.

#14 Re: General » access to execution trace » 2012-10-09 15:49:42

thanks for reply. I think I didn't ask the right question, actually I need to access to some variables traces, or their variation while simulation or verification. So, I cant access to the trace through promela model while simulation or verification, can I?

#15 Re: General » access to execution trace » 2012-10-08 17:17:33

forgot to say that I use spin version 6.2.2 and ispin version 1.1.0.

#16 General » access to execution trace » 2012-10-08 17:10:56

maryam
Replies: 8

Can anyone tell me if there is a straightforward way to gain a trace of an execution or not?

Board footer

Powered by FluxBB