Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> terminal equation or algorithm exist in Modelica with Dymola
Carsten
post Oct 11 2007, 03:48 PM
Post #1


Advanced Member
***

Group: Members
Posts: 53
Joined: 5-July 06
From: Germany
Member No.: 18



at least in Dymola there is no difference between initial equation and when initial() block.

if there would be any difference (initial equation before start and when initial() at the begin of the simulation), the following model should work, but it does not wink.gif

QUELLTEXT
model Unnamed
  Real a;
initial equation
  a=3;
equation
  when initial() then
    a=5;
  end when;
  der(a)=2;
end Unnamed;


Removing one of both parts turns the model in a valid one...

regards
Carsten
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
wagner
post Sep 12 2007, 08:53 PM
Post #2


Administrator
***

Group: Root Admin
Posts: 121
Joined: 13-March 06
Member No.: 1



Hello Laurent,

I looked it up in literature a few days, cause there was a discussion about this in another thread. But I found two different descriptions about this matter.

In the book by Fritzson it's said that there is no difference between "initial equation" and "when initial". In both cases the equations are part of the initialization before simulation starts.

In the book by Tiller it's described that there is a difference (Chapter 13):

"initial equation" is evaluated before simulation starts, whereas "when initial" is evaluated when simulation just started. Using "when initial" means that there are two initialization problems to be solved. One before simulation starts and another when simulation just started.

Maybe someone else knows the "truth" about this.

Regards

Florian
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
laurent
post Sep 12 2007, 05:14 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 11-September 07
Member No.: 2,305



Thanks it works,

For my information, somebody know difference between:
intial equation and when initial() then ... end when;

Laurent
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
wagner
post Sep 12 2007, 04:39 PM
Post #4


Administrator
***

Group: Root Admin
Posts: 121
Joined: 13-March 06
Member No.: 1



Hello Laurent,

you can detect the last step of your simulation by using terminal().

Using terminal() as condition of a when block, you can make actions at the end of a successful simulation.

CODE

when terminal() then
   DisconnectOPC();
end when;


Regards

Florian
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
laurent
post Sep 12 2007, 04:06 PM
Post #5


Newbie
*

Group: Members
Posts: 4
Joined: 11-September 07
Member No.: 2,305



Hello,

I try to connect a Modelica Simulation with Dymola to my "DCS Simulator" by OPC.

In initial equation, I call my C function ConnectOPC().

But I don't found how or where call my function DisconnectOPC()?
I want to disconnect at the last cycle or better after the last cycle.

My final objective is to use option Real Time of Dymola, so I don't know how many time my simulation works.

Thanks for your idea.

Laurent
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 8th December 2019 - 01:00 AM