Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

logictoboolean

logictoboolean

Hi,
I want to use logic to boolean converter. For logic source  i am using Electrical.Digital.Source.Step object. Also i use Electrical.Digital.Converter.LogicToBoolean component. When i try to connect two pin  i saw Connect Array message (Enter Index ). I try enter1 but i got:

"[C:/OpenModelica1.9.1/lib/omlibrary/oki/test.mo:7:50-7:60:writable] Error: Type mismatch in binding before = 1, expected subtype of enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-'), got type Integer.
Error: Error occurred while flattening model test

What i suppose to enter?

Re: logictoboolean

You need to use the enumeration '1'. Probably something like:

Code:

import L = Modelica.Electrical.Digital.Interfaces.Logic;

L.'1'

Re: logictoboolean

I did the connection giving as index 1, and got the following code that checks well. I did this using OMEdit and OM r23777.

Code:

model a

  Modelica.Electrical.Digital.Sources.Step step1 annotation(Placement(visible = true, transformation(origin = {-74, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Digital.Converters.LogicToBoolean logictoboolean1 annotation(Placement(visible = true, transformation(origin = {-32, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
  connect(step1.y, logictoboolean1.x[1]) annotation(Line(points = {{-64, 0}, {-38, 0}, {-38, 0}, {-38, 0}}, color = {127, 0, 127}));
  annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})));
end a;

There are 0 guests and 0 other users also viewing this topic