Skip to content

Completely wrong results in system with conditional equations #103

@casella

Description

@casella

Please check Modelica.Electrical.Analog.Examples.DemonstrateLightning.bmo. After the event at time = 1e-5 s, the results of the MTK simulation differ wildly from the reference result.

@AnHeuermann simulated the Base Modelica code with OMC and got results consistent with the reference results, so it seem that the flattening and Base Modelic exporting process is OK.

The issue is likely due to the two conditional equations

    if time < 1e-5 then
      'lightning1.signalSource.y' = 0.0;
    else
      'lightning1.signalSource.y' = 1e5 / 'lightning1.signalSource.eta' * (exp(-(time - 1e-5) / 'lightning1.signalSource.tau1') - exp(-(time - 1e-5) / 'lightning1.signalSource.tau2'));
    end if;

and

    if time < 1e-5 then
      'lightning2.signalSource.y' = 0.0;
    else
      'lightning2.signalSource.y' = 1e5 / 'lightning2.signalSource.eta' * ((time - 1e-5) / 'lightning2.signalSource.tau1') ^ 5.0 / (1.0 + ((time - 1e-5) / 'lightning2.signalSource.tau1') ^ 5.0) * exp(-(time - 1e-5) / 'lightning2.signalSource.tau2');
    end if;

as all other equation are simple linear DAEs.

Possibly related to #99.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions