Opened 14 years ago

Last modified 14 years ago

#1501 closed defect (fixed)

sample call does not work correctly in version 1.7.0

Reported by: fh77 Owned by: fh77
Priority: high Milestone:
Component: Version:
Keywords: Cc: fh77, Willi Braun

Description

I have a sample two sample calls with different intervals (0.1 and 0.001)

when I simulate the block, it behaves as if there are two sample calls with (0.001 and 0.001)
the 0.1 sample call has no effect.

When I put the (0.001) sample call in comments, the 0.1 sample call works correctly.

In 1.6.0 everything was ok.

Here is my small sample:

block tst2B
 output ct i1;
 output ct i2;
 output ct i3;
 Boolean clock1,  clock2;
 Integer cntr;
 Integer cntr2;
 initial equation
 cntr=0;
  cntr2=2;  
  equation
  clock1=sample(0,0.1);
  clock2=sample(0,0.001);
  i1.el.val=cntr+1;
  i2.el.val=cntr+40;
  i3.el.val=cntr2;
  algorithm
     when clock1  then
        cntr:=pre(cntr)+1;
      end when;
      when clock2  then
           cntr2:=pre(cntr2)+1;
      end when;  
end tst2B;

type Int16 = Integer;

record tstR
     Int16 val;
end tstR;

connector ct
  tstR el;
end ct

Change History (2)

comment:1 by Martin Sjölund, 14 years ago

It seems to work better if sample is called in the when-condition; but it still is not correct...

comment:2 by Willi Braun, 14 years ago

The sample calls are fixed in r8770.
But the initial equation are not considered in this example since there are no states in the model.
-> Therefore I create a new Bug ticket.
Suggested work-around:

 Integer cntr (start=0);
 Integer cntr2(start=2);
/* initial equation
 cntr=0;
  cntr2=2;  */
Note: See TracTickets for help on using tickets.