- Index
- » Users
- » lumaxo
- » Profile
Posts
Posts
Then I am doing it wrong.
For example: I created a simple circuit with 2 parallel resistors, a constant voltage and a ground.
I'm not interested in the current in each resistor. The only thing I would like to see in the variables browser
is the total resistance and the current from the constant voltage.
Declaring the ground and the resistors as protected doesn't change anything.
Code:
model SimpleCircuit
Modelica.Electrical.Analog.Sources.ConstantVoltage constantvoltage(V = 10);
Modelica.SIunits.Resistance R_Total;
protected
Modelica.Electrical.Analog.Basic.Ground ground;
Modelica.Electrical.Analog.Basic.Resistor resistor2(R = 10);
Modelica.Electrical.Analog.Basic.Resistor resistor1(R = 20);
equation
R_Total = resistor1.R * resistor2.R / (resistor1.R + resistor2.R);
connect(constantvoltage.n,ground.p);
connect(constantvoltage.p,resistor1.p);
connect(constantvoltage.p,resistor2.p);
connect(resistor1.n,ground.p);
connect(resistor2.n,ground.p);
end SimpleCircuit;
Hello,
How can I change/overwrite an icon when extending a model with an existing icon.
For example the icon of model A is "A". Model B extends model A and should have the icon "B". The code below will logically put one on top of the other.
Is there a way to inhibit the inheritance of the icon, or to overwrite it? (instead of adding a white rectangle to "cover" the old icon)
Code:
model A
parameter Real a = 1;
parameter Real b = 2;
Real c;
equation
c = a + b;
annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2}), graphics = {Text(extent = {{-50,-40},{50,40}}, textString = "A")}));
end A;
model B
extends A(a = d);
parameter Real d = 3;
annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2}), graphics = {Text(extent = {{-50,-40},{50,40}}, textString = "B")}));
end B;
Thanks!
Thanks, now I know how to hide variables in my own models.
But the MSL models I'm using are declared as public. So I have to use the filter option, right?
Is it possible to define the filter as an annotation?
How would you create a "black box" like model consisting of MSL models?
Hello,
I am new to Modelica and OMedit and not sure if this is the right place to post so I apologize in advance if it isn't.
I want to create my own package based on the MSL.
A lot of my models are nested models. I would like to hide the results for specific parameters and variables in the variables browser.
(The user will use them as black boxes and is only interested in the in- and output)
But it seems I don't understand the usage of protected and HideResult.
For example:
Code:
model HideResult
parameter Real param = 1;
Real var annotation(HideResult = true);
equation
var = param;
end HideResult;
Despite "HideResult = true", "var" shows up in the variables browser.
I tried to declare the parameter and variable as "protected"
Code:
model HideResult
protected
parameter Real param = 1;
Real var;
equation
var = param;
end HideResult;
But this doesn't change the visibilty either.
The only way to hide at least the variable "var" is to further add an initial equation.
In this case "var" doesn't show up in the variable browser.
Code:
model HideResult
protected
parameter Real param = 1;
Real var;
initial equation
var = param;
equation
var = param;
end HideResult;
Also the filter option in the simulation settings has no effect.
Can somebody explain this to me?
I am afraid "HideResult" or the variable filter doesn't apply to the variable browser in OMedit, but rather to the created file.
In this case is it possible to hide specific parameters and variables in OMedit?
Thanks!
- Index
- » Users
- » lumaxo
- » Profile