i want to allot a value of 1 or 0 to the digital output y in the following text view
model aaa2
Modelica.Blocks.Interfaces.RealInput u
Modelica.Electrical.Digital.Interfaces.DigitalOutput y
algorithm
if u > 2 ^ 2 then
y := logic ('1');
elseif u < 2 ^ 2 then
y := logic ('0');
end if
end aaa2;
In the pasted Modelica text you are using a DigitalOutput. If this is what you want the Modelica.Electrical.Digital.Converters.RealToLogic converts between a real valued signal and a digital interface.
In the attached model you are using RealInput and BooleanOutput that seems to be constructed to switch between true and false depending on a threshold value (2^2) Is that the type of component you want? If so, I’d recommend to use the Modelica.Blocks.Logical.GreaterEqualThreshold component instead, which does that.
no john, if you will see this is not a block, but the modelica language script. the question is how in script i can allot a logic value ‘1’ to a digital signal