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

mux / demux signal

mux / demux signal

Hi,
I'm studying OpenModelica software. So, I would to do a mux signal (time and a costant signal) and demuxing same signal.
I have this code:

Code:


model test3
  Modelica.Blocks.Sources.Clock clock1 annotation(Placement(visible = true, transformation(origin = {-62.6324,64.1452}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Routing.Multiplex2 multiplex21 annotation(Placement(visible = true, transformation(origin = {9.0772,52.0423}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Routing.DeMultiplex2 demultiplex21 annotation(Placement(visible = true, transformation(origin = {59.3041,50.8321}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 1) annotation(Placement(visible = true, transformation(origin = {-64.1453,19.6671}, extent = {{-12,-12},{12,12}}, rotation = 0)));
equation
  connect(const.y,multiplex21.u2[1]) annotation(Line(points = {{-50.9453,19.6671},{-10.2874,19.6671},{-10.2874,44.8423},{-5.3228,44.8423}}));
  connect(demultiplex21.u[1],multiplex21.y[1]) annotation(Line(points = {{44.9041,50.8321},{30.2572,50.8321},{30.2572,52.0423},{22.2772,52.0423}}));
  connect(multiplex21.u1[1],clock1.y[1]) annotation(Line(points = {{-5.3228,59.2423},{-47.8064,59.2423},{-47.8064,64.1452},{-49.4324,64.1452}}));
  connect(multiplex21.u1[1],clock1.y) annotation(Line(points = {{2.24145,58.6372},{-47.8064,58.6372},{-47.8064,64.1452},{-49.4324,64.1452}}));
end test3;

but not work; error is:

Code:

Translation    12:42:30        0:0-0:0    Error occurred while flattening model test3

Translation    12:42:30        0:0-0:0    Variable clock1.y[1] not found in scope test3
Translation    12:42:30        0:0-0:0    Illegal subscript [1] for dimensions  in component clock1

The screenshoot of diagram view is:

http://i46.tinypic.com/2hmqa6w.jpg
Where am I wrong?

Edited by: man_car - Feb-25-13 14:57:29

Re: mux / demux signal

You are subscripting a scalar. Use clock1.y instead of clock1.y[1].

Re: mux / demux signal

don't work:

Code:

model test3

  Modelica.Blocks.Sources.Clock clock1 annotation(Placement(visible = true, transformation(origin = {-62.6324,64.1452}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Routing.Multiplex2 multiplex21 annotation(Placement(visible = true, transformation(origin = {9.0772,52.0423}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Routing.DeMultiplex2 demultiplex21 annotation(Placement(visible = true, transformation(origin = {59.3041,50.8321}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Blocks.Sources.Constant const(k = 1) annotation(Placement(visible = true, transformation(origin = {-64.1453,19.6671}, extent = {{-12,-12},{12,12}}, rotation = 0)));
equation
  connect(const.y,multiplex21.u2[1]) annotation(Line(points = {{-50.9453,19.6671},{-10.2874,19.6671},{-10.2874,44.8423},{-5.3228,44.8423}}));
  connect(demultiplex21.u[1],multiplex21.y[1]) annotation(Line(points = {{44.9041,50.8321},{30.2572,50.8321},{30.2572,52.0423},{22.2772,52.0423}}));
  connect(multiplex21.u1[1],clock1.y) annotation(Line(points = {{-5.3228,59.2423},{-47.8064,59.2423},{-47.8064,64.1452},{-49.4324,64.1452}}));
  connect(multiplex21.u1[1],clock1.y) annotation(Line(points = {{2.24145,58.6372},{-47.8064,58.6372},{-47.8064,64.1452},{-49.4324,64.1452}}));
end test3;

the error is:

Code:

Symbolic    14:12:27        0:0-0:0    Too few equations, underdetermined system. The model has 9 equation(s) and 10 variable(s)

Re: mux / demux signal

any ideas ?

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