izs
izs

Reputation: 1

OpenModelica "Change" block does not work properly. [Beginner]

I am really new on Modelica in general but I have a project I need to finish really soon. I apologize if something that I say is really basic. I have tried a few tweaks and searched over the internet but I cannot seem to figure out how to do this to work.

I have created a model. Inside there is a block with a boolean output, lets call this output boolean variable Y1.

Connected to that block I use the Modelica.Blocks.Logical.Change or the Modelica.Blocks.MathBoolean.ChangingEdge blocks. I have tried both since if I understand correctly they do the same thing. Y1 is the input of this block.

So basically the moment when Y1 changes from true to false or from false to true the output of the Change block (lets call it Y2) should be true just for that timestep.

This does not happen. Y2 is constantly on false. I have checked and Y1 is changing over time.

I have also tried to run the example Modelica.Blocks.Examples.BooleanNetwork1 but I see the same thing in there also. The desired output does not change to the example either.

For reference I use the OpenModelica 1.17 with Modelica Standard Library 3.2.3. These are the versions I am obligated to use and I cannot use newer or older ones.

Any tip would be highly appreciated! Thank you.


PS If this does not work I would like to use something different. Is there a way I can access all the previous values (history) of Y1 inside an another block and find these changes with an algorithm there? So lets say I am on timestep N and inside a block I want to access Y1 from 0 to N-1 and find the last timestep that Y1 has changed.

Upvotes: 0

Views: 187

Answers (1)

Rene Just Nielsen
Rene Just Nielsen

Reputation: 3413

How did you check that the output of the change block doesn't fire at the events? You may not be able to see it on a plot since the impulse is 'infinitely' short (at least, that's my experience with Dymola).

You could latch the impulse from the change block by connecting it's output to an SR flipflop.

Upvotes: 2

Related Questions