Opened 4 years ago

Last modified 4 years ago

#6181 new defect

Boolean incorrectly evaluated and asserts, implying negative time? — at Version 1

Reported by: craig.fletcher@… Owned by: Andreas Heuermann
Priority: high Milestone:
Component: Run-time Version: v1.17.0-dev
Keywords: Cc: Karim Adbdelhak

Description (last modified by Per Östlund)

The following asserts time is less than zero. Did not assert in previous versions of OMC

model DebugInitialValue
  
  model BooleanPulse
    input Real width(start=0.5);
    output Boolean y;
  equation
    y = time < width;
  end BooleanPulse;

  class DayNightCycle
    parameter Real earth_day_period=24;
    Real daylight_ratio;
    BooleanPulse daylight(width=daylight_ratio);
  end DayNightCycle;

  parameter Real ratio_start=0;
  Real _ratio;
  DayNightCycle cycle(daylight_ratio=_ratio); //FAILS.  Will work if changed to daylight_ratio=0 here.

algorithm
  _ratio := ratio_start;
  if not initial() then 
    assert(cycle.daylight.y==false,"oops",level=AssertionLevel.warning);
  end if;

end DebugInitialValue;

Change History (1)

comment:1 by Per Östlund, 4 years ago

Component: *unknown*Run-time
Description: modified (diff)
Owner: changed from somebody to Andreas Heuermann
Note: See TracTickets for help on using tickets.