Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » shilu
  • » Profile

Posts

Posts

Hi Adeel,

I could only see the 'variable browser" in plotting view not in modeling view . I could not edit the value column.

model A
  Integer aValue1(start=1);
  Integer aValue2(start=2);
equation
  aValue1 = B(2);
  aValue2 = aValue1 + 10;
end A;

In this model,variables(aValue1,aValue2) are changeable i guess but i could not modify them in "value column".

About using function, can we call chains of functions from a model. For eg, i have function A calling B , B calls C and C calls D. I do not know what are the good and bad things if i model in such a way. One might think why do i have chains of functions instead of one block of function but then individually A, B,C, D can be used somewhere else.  current/sad

Hi Adeel,

I installed the revision 18219 . But can u tell me how to change the values in variables browser and simulate again.
Thanks !

Where do i run the code you have shown ? m using OMEdit

model A
Integer aValue1(start=1);
Integer aValue2(start=2);
equation
aValue1 = 2;
aValue2 = aValue1 + 10;
end A;

model B
Integer bValue1(start=1);
Integer bValue2(start=2);
A a;
equation
bValue1 = bValue2 + 1;
a.aValue1 = bValue1;
end B;

I want to set the value calculated in model B (bValue1) to model A(a.aValue1). I cannot do it during instantiation
as i have to calculate the value and then set the value.

Thanks !

Nov-15-13 17:30:55
Category: Programming

but when i call like this (add,sub):= add (3,4) ; then it works........doesnt need the third argument.

Nov-15-13 15:17:05
Category: Programming

function add
input Integer a;
input Integer b;
output Integer sum;
output Integer subtract;
output Integer multiply;
algorithm
sum:= a+b;
if (a>b) then
subtract:= a-b;
else
subtract:= b-a;
multiply:= a*b;
end if;
end add;

if i want to get just the multiplication part of the result then i did

(,,mult) := add (3,4);

which works fine but when i want only subtraction part then it doesnt work
(,sub):= add (3.4);

current/sad

  • Index
  • » Users
  • » shilu
  • » Profile
You are here: