modelica-deprecated / Modelica_Synchronous

Free (standard conforming) library to precisely define and synchronize sampled data systems with different sampling rates. It provides convenient to use blocks to utilize the new synchronous language elements introduced in Modelica 3.3.
11 stars 7 forks source link

Issue with ShiftSample #6

Closed modelica-trac-importer closed 5 years ago

modelica-trac-importer commented 7 years ago

Reported by eashan.liyana on 24 Jun 2015 15:40 UTC Hi, I have an issue with ShiftSample. You can find an example attached to do this ticket. I have a model Counter which add 1 to an integer I every second. In my second model I use ShiftSample to shift I from Counter.

For that I did two different models:

1- I is store in an intermediate variable **W** and it's shifted

2-I from Counter is directly shifted.

In the first model I don't need to give the value of resolution.

In the second model I have to give the value of resolution, otherwise the simulation fail.

Am I not using shiftSample the right way ?

Thank you in advance for you anwsers,

Eashan


Migrated-From: https://trac.modelica.org/Modelica/ticket/1739

modelica-trac-importer commented 7 years ago

Modified by dietmarw on 23 Jul 2015 07:36 UTC

modelica-trac-importer commented 7 years ago

Modified by otter on 18 May 2016 08:23 UTC

modelica-trac-importer commented 7 years ago

Modified by otter on 5 Aug 2016 05:59 UTC

HansOlsson commented 5 years ago

The previously attached model is as follows:

package Issue

  block Counter
    output Integer c(start=0);
  equation
    c = 1 + previous(c);
  end Counter;

  model Top_ok1
    Counter cpt(c(start=7));
    Integer w, x, y, z;

  equation
    w = cpt.c;
    x = subSample(cpt.c, 2);
    y = shiftSample(
        cpt.c,
        1,
        1);
    z = subSample(w, 2);
  end Top_ok1;

  block Top_ok2
    Counter cpt(c(start=7));
    Integer w, x, y, z;
  equation
    w = cpt.c;
    x = subSample(w, 2);
    y = shiftSample(w, 1);
    z = subSample(y, 2);
  end Top_ok2;

  annotation (uses(Modelica_Synchronous(version="0.92"), Modelica(version=
            "3.2.1")));
end Issue;

My conclusions are:

Thus it seems like a modeling issue - unrelated to Modelica_Synchronous. (Actually making graphical models with Modelica_Synchronous might have avoided this.) There might also be a tool-issue, but that should be reported to the corresponding tool-vendor.

Therefore I close this.