- Index
- » Users
- » maxev5
- » Profile
Posts
Posts
Thank you very much, the inner/outer method works!
Yes, I know I can do it without inheritance when I have only one "Calc" model (block). But if I have e.g. 40 different "Calc" blocks and all of them use the same constant (for example density or constant A in this case), it's not practical to change that constant in 40 dialog windows one by one. That's the reason why I want one block ("Const") that defines that constant which will be used then by all 40 blocks. I know that it can be easily done in .xml file but, as I said, the block would be more elegant to me.
I was thinking to make a block in library so I can drag it to designer window. And when I click on it there I want to change its parameters (e.g. parameter A) in the dialog window.
Hi Koldo,
Yes, I know I can do that in .xml file, but the block seems more elegant way to me. Do you have any ideas?
Thanks
Hi everyone,
I want to create a block which defines some physical constants that can be changed between simulations. Simple example:
model Const
parameter Real A = 2;
end Const;
model Calc
extends Const;
parameter Real B = 3;
Real C;
equation
C = B + A;
end Calc;
So, variable C depends on parameters A and B. When I change parameter B in block Calc, the result (C) changes, but when I change the parameter A in block Const, the result (C) doesn't change. Model Calc always use the default value (2) of parameter A.
Can somebody help?
Thanks
- Index
- » Users
- » maxev5
- » Profile