- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » inner/outer warning messages
inner/outer warning messages
inner/outer warning messages
Hi guys,
I try to simulate an oilcircuit that consists several bearings each of which needs the same rotational speed input.
For this reason, I wanted to introduce the keywords "inner" and "outer". Here is what I did:
- I added a model "EngineSpeed":
model EngineSpeed
parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm = 2000;
annotation(...);
- I added the following code lines to my bearing-model:
parameter SI.Conversions.NonSIunits.AngularVelocity_rpm speed = DefEngineSpeed.rpm;
protected
outer OilCircuit.Components.Engine.Bearings.EngineSpeed DefEngineSpeed;
My circuit-model now consits of several bearing-models (and a pump, pipes etc...) AND an EngineSpeed-model.
Nevertheless, OMEdit plots the following warning message:
[OilCircuit.Components.Engine.Bearings.MainBearing: 25:3-25:73]: No corresponding 'inner' declaration found for component .OilCircuit.Components.Engine.Bearings.EngineSpeed HL5.DefEngineSpeed declared as 'outer '.
The existing 'inner' components are:
There are no 'inner' components defined in the model in any of the parent scopes of 'outer' component's scope: OilCircuit.Components.Engine.Bearings.MainBearing$HL5.
Check if you have not misspelled the 'outer' component name.
Please declare an 'inner' component with the same name in the top scope.
Continuing flattening by only considering the 'outer' component declaration.
Replacing the EngineSpeed-model by
model EngineSpeed
inner parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm = 2000;
annotation(...);
makes no difference.
The simulation runs without any problems, but I would like to eliminate the warning messages. Any ideas?
Thanks a lot.
Re: inner/outer warning messages
Hi,
It should be something like this:
Code:
model EngineSpeed
inner parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm = 2000;
end EngineSpeed;
// in your bearing model you should add:
outer parameter SI.Conversions.NonSIunits.AngularVelocity_rpm rpm;
Note that inner / outer variables need to have *the same* name!
In your case the inner is rpm and the outer is DefEngineSpeed which is not correct.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: inner/outer warning messages
Thanks a lot for the quick answer.
I just agree to an extent:
In my case, my outer variable was "DefEngineSpeed.rpm". This Approach is similar to the one used in the OpenHydraulics-library
Code:
partial model PartialFluidComponent "Base model for any component involving fluid"
outer OpenHydraulics.Fluids.BaseClasses.PartialFluid oil "This model must be defined in each circuit; the type must be a subtype of PartialFluid";
parameter SI.AbsolutePressure p_init = environment.p_ambient "Initial temperature of the component" annotation(Dialog(tab = "Initialization", group = "Fluid"));
protected
outer OpenHydraulics.Circuits.Environment environment;
annotation(Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics));
end PartialFluidComponent;
But I now changed my code as you suggested.
Code:
// EngineSpeed model
model EngineSpeed
inner parameter SI.Conversions.NonSIunits.AngularVelocity_rpm speed = 2000;
end EngineSpeed;
// bearing model
outer parameter SI.Conversions.NonSIunits.AngularVelocity_rpm speed;
Unfortunately, the warning message still appears (one for every bearing)
Re: inner/outer warning messages
The question is how does it look hierarchically. The inner should be defined somewhere at the top level and the outer somewhere inside the model.
Code:
// the test model
model M
inner A a; // note that it should be at the top level not in another variable (model) at the top level.
Y y;
end ;
model Y
// or somewhere even deeper here
Z z:
outer A a;
end Y;
model Z
// or somewhere even deeper here
outer A a;
end Z;
- adrpo
- 885 Posts
Re: inner/outer warning messages
oh............
Thank you very much - that was my mistake.
I first created an instance of the EngineSpeed-Model... I now replaced that by "extends EngineSpeed" and it works fine.
One more litte detail: I'd like to have a quick access to engine's speed. Therefore, I also create an instance of it so that I can change the speed-parameter quite easily. No problem so far. But the EngineSpeed-model has a nice icon to represend the combustion engine. By extending this model, my top-level model (oilcircuit) inherits not just the code but also this icon. Is there a way to suppress this behaviour?
Cheers, Jan
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » inner/outer warning messages