Skip to content

Conversation

@HansOlsson
Copy link
Contributor

Closes #3548
The idea is that it often makes sense to have continuous input signals, and Sine, Cosine, and Sinc-blocks didn't guarantee that.

That is now possible on a flag.

HansOlsson and others added 2 commits June 13, 2023 17:51
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
Copy link
Contributor

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK now.

I suppose it is intentional to not force continuous to be evaluated?

@beutlich beutlich added the L: Blocks Issue addresses Modelica.Blocks label Jul 2, 2023
@Harisankar-Allimangalath
Copy link
Contributor

By making it continuous we mean it should be differentiable right, but even with the new flag addition and smooth function

  • sine block would only be continuous at a phase of 90 an 270, with any offset and start time not 0.

  • same is the case with cosine also it only works well if the phase is 0 or 180 with any offset and start time not 0

because for both cases at start time (if its not 0) there will be discontinuity, I did the cross checking in Dymola with a Der block (Modelica.Blocks.Continuous.Der) and it failed can you please cross verify the same @henrikt-ma @HansOlsson @beutlich

  • The sinc modification was working fine.

@HansOlsson
Copy link
Contributor Author

By making it continuous we mean it should be differentiable right

Unfortunately not for sine and cosine. (Well, at least not with a continuous derivative.)

The way to make the derivative continuous would be to modify the behavior before startTime to not be a constant signal, and I find that too disruptive.

model Unnamed
  Modelica.Blocks.Sources.Sine sine(
    f=0.1,
    phase=4.2411500823462,
    continuous=true,
    startTime=0.9)
    annotation (Placement(transformation(extent={{-68,-36},{-48,-16}})));
  Modelica.Blocks.Continuous.Der der1
    annotation (Placement(transformation(extent={{-16,-36},{4,-16}})));
  Modelica.Blocks.Sources.Sine sine1(
    f=0.1,
    phase=4.2411500823462,
    continuous=false,
    startTime=0.9)
    annotation (Placement(transformation(extent={{-64,30},{-44,50}})));
equation 
  connect(sine.y, der1.u)
    annotation (Line(points={{-47,-26},{-18,-26}}, color={0,0,127}));
  annotation (uses(Modelica(version="4.0.0")));
end Unnamed;

@Harisankar-Allimangalath
Copy link
Contributor

@MartinOtter and @AHaumer can you please give your suggestion on how to proceed with this ticket .Thankyou

@MartinOtter MartinOtter merged commit d01e768 into modelica:master Nov 14, 2023
@HansOlsson HansOlsson deleted the AvoidDiscontinuities branch November 14, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: Blocks Issue addresses Modelica.Blocks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid unnecessary discontinuities in sources (Cosine, Sinc)?

5 participants