Hi,
Sorry for the delay, I took a short
holiday after my PhD defense :)
--------
Can you send me an entire model?
It would be easier to explain.
In general you write a function
and then use that directly in an
equation. Check the attached model.
function while_func
input Real x;
input Real y;
output Real out;
algorithm
while x>100 loop
if y>0 then
....
end if;
end while;
end while_func;
Cheers,
Adrian Pop/
HADJ AMOR HASSEN wrote:
Hi,
I think that OpenModelica developpers can answer me. No?
--- En date de : *Jeu 12.6.08, HADJ AMOR HASSEN /<[EMAIL PROTECTED]>/*
a écrit :
De: HADJ AMOR HASSEN <[EMAIL PROTECTED]>
Objet: Internal error While statements in algorithms not supported yet
À: [email protected]
Date: Jeudi 12 Juin 2008, 14h48
Hi,
The while statement isn't implemented yet in the last openmodelica
nightly build. I have this error message:
----------------
Internal error While statements in algorithms not supported yet.
Suggested workaround: place while statement in a Modelica function
--------------
how can i transform this for example?
algorithm
while x>100 loop
if y>0 then
....
end if;
end while;
I had to put all the while loop in a modelica function?
Regards,
Hassen
__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure
protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail
------------------------------------------------------------------------
Envoyé avec Yahoo! Mail
<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html>.
Une boite mail plus intelligente.
function bubbleSort
input Real [:] unordElem;
output Real [size(unordElem, 1)] ordElem;
protected
Real tempVal;
Boolean isOver = false;
algorithm
ordElem := unordElem;
while not isOver loop
isOver := true;
for i in 1:size(ordElem, 1)-1 loop
if ordElem[i] > ordElem[i+1]
then
tempVal := ordElem[i];
ordElem[i] := ordElem[i+1];
ordElem[i+1] := tempVal;
isOver := false;
end if;
end for;
end while;
end bubbleSort;
model BubbleSort
Real x[5];
equation
x = bubbleSort({5, 3, 7, 4, 1});
end BubbleSort;