Opened 14 years ago

Closed 12 years ago

#1329 closed defect (fixed)

Wrong prefixing of array indexes in the DAE.

Reported by: Adrian Pop Owned by: Adrian Pop
Priority: critical Milestone: Red October
Component: Instantiation Version: 1.6.0
Keywords: Cc: Adrian Pop, Frenkel, TUD, Per Östlund

Description

This model cannot be simulated. It was reported here: https://openmodelica.org/index.php/forum/topic?id=91

model jktest 
  annotation(Diagram(coordinateSystem(extent = {{ -100, -100},{100,100}}))); 
  annotation(uses(Modelica(version = "3.1")), Diagram(graphics)); 
  Modelica.Electrical.Digital.Examples.Utilities.JKFF jKFF annotation(Placement(transformation(origin = { -36.0,44.0}, extent = {{ -46.0,34.0},{ -26.0,54.0}}), iconTransformation(origin = { -36.0,44.0}, extent = {{ -46.0,34.0},{ -26.0,54.0}}))); 
  Modelica.Electrical.Digital.Sources.Set set(x = Modelica.Electrical.Digital.Interfaces.Logic.'1') annotation(Placement(transformation(origin = { -96.0,50.0}, extent = {{ -106.0,40.0},{ -86.0,60.0}}), iconTransformation(origin = { -96.0,50.0}, extent = {{ -106.0,40.0},{ -86.0,60.0}}))); 
  Modelica.Electrical.Digital.Sources.Clock clock(period = 0.4) annotation(Placement(transformation(origin = { -96.0,20.0}, extent = {{ -106.0,10.0},{ -86.0,30.0}}), iconTransformation(origin = { -96.0,20.0}, extent = {{ -106.0,10.0},{ -86.0,30.0}}))); 

equation 
  connect(jKFF.j,set.y) annotation(Line(points = {{ -46.0,51.0},{ -70.0,51.0},{ -70.0,50.0},{ -86.0,50.0}}, color = {127,0,127})); 
  connect(jKFF.k,set.y) annotation(Line(points = {{ -46.0,37.0},{ -70.0,37.0},{ -70.0,50.0},{ -86.0,50.0}}, color = {127,0,127})); 
  connect(clock.y,jKFF.clk) annotation(Line(points = {{ -86.0,20.0},{ -68.0,20.0},{ -68.0,44.0},{ -46.0,44.0}}, color = {127,0,127})); 
end jktest; 

The flattening and checking works fine:

Class jktest has 70 equation(s) and 70 variable(s).
66 of these are trivial equation(s).

But the code generation fails with:

Too few equations, underdetermined system. The model has 4 equation(s) and 12 variable(s)

The problem is that the prefixing of array indexes is not correct. Equation:

  jKFF.And2.auxiliary[2] = D.Tables.AndTable[auxiliary[1],x[2]];

uses array indexes auxiliary[1],x[2] that DO NOT EXIST in the model (they exist, but have an extra prefix).
See in the flatten model below:

class jktest
  parameter Real jKFF.delayTime(quantity = "Time", unit = "s") = 0.001 "delay time";
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.q0 = Modelica.Electrical.Digital.Interfaces.Logic.'0' "initial value";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.j;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.q;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.qn "not Q";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.clk;
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.k;
  parameter Real jKFF.RS1.delayTime(quantity = "Time", unit = "s") = jKFF.delayTime "delay time";
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.q0 = jKFF.q0 "initial value of output";
  parameter Integer jKFF.RS1.Nor1.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor1.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor1.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor1.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor1.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor1.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  parameter Integer jKFF.RS1.Nor2.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor2.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor2.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor2.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor2.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.Nor2.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.s;
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.r;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.q;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.qn;
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.TD1.x(start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true) "Connector of Digital input signal";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.TD1.y "Connector of Digital output signal";
  parameter Real jKFF.RS1.TD1.delayTime(quantity = "Time", unit = "s", start = 0.0) = jKFF.RS1.delayTime "delay time";
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.TD1.y0 = jKFF.RS1.q0 "initial value of output";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS1.TD1.x_delayed;
  parameter Real jKFF.RS2.delayTime(quantity = "Time", unit = "s") = jKFF.delayTime "delay time";
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.q0 = jKFF.q0 "initial value of output";
  parameter Integer jKFF.RS2.Nor1.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor1.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor1.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor1.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor1.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor1.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  parameter Integer jKFF.RS2.Nor2.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor2.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor2.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor2.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor2.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.Nor2.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.s;
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.r;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.q;
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.qn;
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.TD1.x(start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true) "Connector of Digital input signal";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.TD1.y "Connector of Digital output signal";
  parameter Real jKFF.RS2.TD1.delayTime(quantity = "Time", unit = "s", start = 0.0) = jKFF.RS2.delayTime "delay time";
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.TD1.y0 = jKFF.RS2.q0 "initial value of output";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.RS2.TD1.x_delayed;
  parameter Integer jKFF.And1.n(min = 2) = 3 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.x[2] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.x[3] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And1.auxiliary[3](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  parameter Integer jKFF.And2.n(min = 2) = 3 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.x[2] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.x[3] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And2.auxiliary[3](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  parameter Integer jKFF.And3.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And3.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And3.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And3.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And3.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And3.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  parameter Integer jKFF.And4.n(min = 2) = 2 "Number of inputs";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And4.x[1] "Connector of Digital input signal vector";
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And4.x[2] "Connector of Digital input signal vector";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And4.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And4.auxiliary[1](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.And4.auxiliary[2](start = Modelica.Electrical.Digital.Interfaces.Logic.'U', fixed = true);
  input enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.Not1.x "Connector of Digital input signal";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.Not1.y "Connector of Digital output signal";
  protected enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') jKFF.Not1.auxiliary(start = Modelica.Electrical.Digital.Interfaces.Logic.'0', fixed = true);
  parameter enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') set.x(start = Modelica.Electrical.Digital.Interfaces.Logic.'1') = Modelica.Electrical.Digital.Interfaces.Logic.'1' "Logic value to be set";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') set.y;
  parameter Real clock.startTime(quantity = "Time", unit = "s", start = 0.0) "Output = offset for time < startTime";
  parameter Real clock.period(quantity = "Time", unit = "s", min = 1e-60, start = 1.0) = 0.4 "Time for one period";
  parameter Real clock.width(min = 1e-60, max = 100.0, start = 50.0) "Width of pulses in % of period";
  output enumeration('U', 'X', '0', '1', 'Z', 'W', 'L', 'H', '-') clock.y "Connector of Digital output signal";
  protected Real clock.t_i(quantity = "Time", unit = "s", start = clock.startTime) "Start time of current period";
  protected Real clock.t_width(quantity = "Time", unit = "s") = clock.period * clock.width / 100.0;
equation
  jKFF.RS1.Nor1.auxiliary[1] = jKFF.RS1.Nor1.x[1];
  jKFF.RS1.Nor1.auxiliary[2] = D.Tables.OrTable[auxiliary[1],x[2]];
  jKFF.RS1.Nor1.y = pre(D.Tables.NotTable[auxiliary[2]]);
  jKFF.RS1.Nor2.auxiliary[1] = jKFF.RS1.Nor2.x[1];
  jKFF.RS1.Nor2.auxiliary[2] = D.Tables.OrTable[auxiliary[1],x[2]];
  jKFF.RS1.Nor2.y = pre(D.Tables.NotTable[auxiliary[2]]);
  jKFF.RS1.TD1.x_delayed = DAE.CAST(ENUM TYPE, integer(delay(Real(jKFF.RS1.TD1.x),jKFF.RS1.TD1.delayTime,jKFF.RS1.TD1.delayTime)));
  jKFF.RS1.TD1.y = if jKFF.RS1.TD1.delayTime > 0.0 then if time >= jKFF.RS1.TD1.delayTime then jKFF.RS1.TD1.x_delayed else jKFF.RS1.TD1.y0 else pre(jKFF.RS1.TD1.x);
  jKFF.RS2.Nor1.auxiliary[1] = jKFF.RS2.Nor1.x[1];
  jKFF.RS2.Nor1.auxiliary[2] = D.Tables.OrTable[auxiliary[1],x[2]];
  jKFF.RS2.Nor1.y = pre(D.Tables.NotTable[auxiliary[2]]);
  jKFF.RS2.Nor2.auxiliary[1] = jKFF.RS2.Nor2.x[1];
  jKFF.RS2.Nor2.auxiliary[2] = D.Tables.OrTable[auxiliary[1],x[2]];
  jKFF.RS2.Nor2.y = pre(D.Tables.NotTable[auxiliary[2]]);
  jKFF.RS2.TD1.x_delayed = DAE.CAST(ENUM TYPE, integer(delay(Real(jKFF.RS2.TD1.x),jKFF.RS2.TD1.delayTime,jKFF.RS2.TD1.delayTime)));
  jKFF.RS2.TD1.y = if jKFF.RS2.TD1.delayTime > 0.0 then if time >= jKFF.RS2.TD1.delayTime then jKFF.RS2.TD1.x_delayed else jKFF.RS2.TD1.y0 else pre(jKFF.RS2.TD1.x);
  jKFF.And1.auxiliary[1] = jKFF.And1.x[1];
  jKFF.And1.auxiliary[2] = D.Tables.AndTable[auxiliary[1],x[2]];
  jKFF.And1.auxiliary[3] = D.Tables.AndTable[auxiliary[2],x[3]];
  jKFF.And1.y = pre(jKFF.And1.auxiliary[3]);
  jKFF.And2.auxiliary[1] = jKFF.And2.x[1];
  jKFF.And2.auxiliary[2] = D.Tables.AndTable[auxiliary[1],x[2]];
  jKFF.And2.auxiliary[3] = D.Tables.AndTable[auxiliary[2],x[3]];
  jKFF.And2.y = pre(jKFF.And2.auxiliary[3]);
  jKFF.And3.auxiliary[1] = jKFF.And3.x[1];
  jKFF.And3.auxiliary[2] = D.Tables.AndTable[auxiliary[1],x[2]];
  jKFF.And3.y = pre(jKFF.And3.auxiliary[2]);
  jKFF.And4.auxiliary[1] = jKFF.And4.x[1];
  jKFF.And4.auxiliary[2] = D.Tables.AndTable[auxiliary[1],x[2]];
  jKFF.And4.y = pre(jKFF.And4.auxiliary[2]);
  jKFF.Not1.auxiliary = D.Tables.NotTable[x];
  jKFF.Not1.y = pre(jKFF.Not1.auxiliary);
  clock.y = jKFF.And1.x[1];
  clock.y = jKFF.And2.x[3];
  clock.y = jKFF.Not1.x;
  clock.y = jKFF.clk;
  jKFF.And1.x[2] = jKFF.And2.x[2];
  jKFF.And1.x[2] = jKFF.j;
  jKFF.And1.x[2] = jKFF.k;
  jKFF.And1.x[2] = set.y;
  jKFF.And2.x[1] = jKFF.RS1.Nor1.x[1];
  jKFF.And2.x[1] = jKFF.RS1.Nor2.y;
  jKFF.And2.x[1] = jKFF.RS1.q;
  jKFF.And2.x[1] = jKFF.qn;
  jKFF.And1.x[3] = jKFF.RS1.Nor1.y;
  jKFF.And1.x[3] = jKFF.RS1.TD1.x;
  jKFF.And1.x[3] = jKFF.RS1.qn;
  jKFF.And1.x[3] = jKFF.q;
  jKFF.And3.x[1] = jKFF.And4.x[1];
  jKFF.And3.x[1] = jKFF.Not1.y;
  jKFF.And3.x[2] = jKFF.RS2.Nor1.x[1];
  jKFF.And3.x[2] = jKFF.RS2.Nor2.y;
  jKFF.And3.x[2] = jKFF.RS2.q;
  jKFF.And4.x[2] = jKFF.RS2.Nor1.y;
  jKFF.And4.x[2] = jKFF.RS2.TD1.x;
  jKFF.And4.x[2] = jKFF.RS2.qn;
  jKFF.And3.y = jKFF.RS1.Nor1.x[2];
  jKFF.And3.y = jKFF.RS1.s;
  jKFF.And4.y = jKFF.RS1.Nor2.x[1];
  jKFF.And4.y = jKFF.RS1.r;
  jKFF.And1.y = jKFF.RS2.Nor1.x[2];
  jKFF.And1.y = jKFF.RS2.s;
  jKFF.And2.y = jKFF.RS2.Nor2.x[1];
  jKFF.And2.y = jKFF.RS2.r;
  jKFF.RS2.Nor2.x[2] = jKFF.RS2.TD1.y;
  jKFF.RS1.Nor2.x[2] = jKFF.RS1.TD1.y;
algorithm
  set.y := set.x;
  when sample(clock.startTime,clock.period) then
    clock.t_i := time;
  end when;
  clock.y := if  NOT time >= clock.startTime OR time >= clock.t_i + clock.t_width then Modelica.Electrical.Digital.Interfaces.Logic.'0' else Modelica.Electrical.Digital.Interfaces.Logic.'1';
end jktest;

Change History (9)

comment:1 by Jens Frenkel, 14 years ago

The bug is because of DAELow.removesimpleEquations
the simple equation
jKFF.RS2.Nor1.y := jKFF.RS2.qn
is two times present.

comment:2 by Adrian Pop, 14 years ago

Jens, I don't get your comment. The bug is in DAELow or in the DAE generation in Inst?

comment:3 by Adrian Pop, 14 years ago

Maybe Inst and remove DAELow.removesimpleequations are wrong because flat model has equations like:

jKFF.RS1.Nor1.auxiliary[2] = D.Tables.OrTable[auxiliary[1],x[2]];

but auxiliary and x are unkown. I guess there is missing the prefix.
The redundante equations only in the dumped DAELow object.

comment:4 by Per Östlund, 14 years ago

The prefixes are now correct as of revision 6522. Unfortunately this does not fix the balance problem.

comment:5 by Adrian Pop, 14 years ago

Jens, can you take another look at the balancing problem now that the prefixing is ok?

comment:6 by Martin Sjölund, 14 years ago

  • partial solved with revision 6529 now codewriter fails for expressions like:

pre(D.Tables.NotTable[jKFF.Not1.x])

and generate code like:

pre($PD$PTables$PNotTable$lB$PjKFF$PNot1$Px$rB)

comment:7 by Jens Frenkel, 14 years ago

to solve the problem we have to do some work for pre and for enumeration array datatypes. For pre(exp) the codewriter fails. Somewhere in the backend pre(exp) has to transformed (if exp is a[b] to a[pre(b)] or if exp is a+b to pre(a)+pre(b)). For enumeration array datatypes (like constant D.Interfaces.Logic NotTable[L]={L.'U',L.'X',L.'1',L.'0',L.'X',L.'X',L.'1',L.'0',L.'X'}) we need the datatype somewhere in SIMCODE.

comment:8 by Per Östlund, 14 years ago

The problem is not with pre, but that the cref should have been converted to an asub when it was elaborated. I have fixed this in commit 6534. But there is still the issue that we need to export constant arrays to the simulation code (it's not strictly an enumeration problem, it's a problem for all constant lookup tables), which should not be hard to do, but will require some work.

comment:9 by Per Östlund, 12 years ago

Cc: Frenkel TUD added; Jens Frenkel removed
Resolution: fixed
Status: acceptedclosed

I think this ticket can be closed, since the reported issue has been fixed and the remaining issues are covered by ticket #1367.

Note: See TracTickets for help on using tickets.