ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Clocked.Sampler.SuperSampleInterpolated possibly unwanted behaviour

Open julius-frenzel opened this issue 3 years ago • 0 comments

Hi there, (I hope, this is the right place to post this) I have stumbled across some strange behavior in said class when trying to implement a time-discrete simulation. It seems like the integer variable "ticks" constantly is 1 greater than its intended value. This leads to a misalignment between the fraction used to calculate the interpolated output and the input. The interpolated output is therefore not as "smooth" as it should be. I tried solvers DASSL and CVODE in OpenModelica. Attached is a picture of the issue, where "Ueberabtastung_s_set" is an instance of the class.

I haven't found a proper fix for the issue. However, if I let "ticks" start at -1, I get nearly the desired behavior (the output should be offset by one step vertically). I.e.change line "Integer ticks(start=0);" to "Integer ticks(start=-1);" I attached a picture of this as well.

The proposed solution works well enough for me right now, but I wanted to report this anyway...

Best Julius

Screenshot from 2022-07-30 10-31-22 Screenshot from 2022-07-30 10-42-11

julius-frenzel avatar Jul 30 '22 08:07 julius-frenzel