ModelicaStandardLibrary
ModelicaStandardLibrary copied to clipboard
Clocked noise example modifying something not in constraining class
Modelica.Clocked.Examples.SimpleControlledDrive.ClockedWith_AD_DA_Effects has:
Clocked.RealSignals.Sampler.SampleWithADeffects sample1(noisy=true, noise(
noiseMax=0.01))
annotation (Placement(transformation(extent={{38,-36},{26,-24}})));
where noise is declared as:
replaceable Clocked.RealSignals.Sampler.Utilities.Internal.UniformNoise noise if noisy
constrainedby Clocked.RealSignals.Interfaces.PartialNoise ...
But noiseMax is not part of the constraining class Clocked.RealSignals.Interfaces.PartialNoise, which means that the following will give an error even if it is correct in itself:
package Broken
model NoNoise
extends Modelica.Clocked.RealSignals.Interfaces.PartialNoise;
equation
y=u;
end NoNoise;
model BrokenModel
extends
Modelica.Clocked.Examples.SimpleControlledDrive.ClockedWith_AD_DA_Effects(
sample1(redeclare NoNoise noise));
end BrokenModel;
end Broken;
If you don't like randomly building such models to find errors and have Dymola (standalone or as part of 3DExperience platform) you can use checkModel("Modelica.Clocked.Examples.SimpleControlledDrive.ClockedWith_AD_DA_Effects", constraint=true); for finding it.
The possible corrections are:
- Extend interface of
PartialNoiseto include the common parameters likenoiseMax. - Redeclare the noise to the given default-component-class - possibly keeping it as replaceable
- More?