Changeset 12122


Ignore:
Timestamp:
Dec 10, 2018 11:49:23 AM (12 months ago)
Author:
Jonathan Kämpe
Message:

#5714 Workaround for some problem in r12092

Location:
branches/dev-jk-alias/Compiler/ModelicaMiddleEnd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-jk-alias/Compiler/ModelicaMiddleEnd/src/jastadd/optimizations/AliasVariables.jadd

    r12092 r12122  
    924924        long score = 0;
    925925       
    926         score += getVisibilityType().ordinal();
     926        VisibilityType t = getVisibilityType();
     927        if (t.isProtected()) {
     928            // Some models fail to simulate without this
     929            t = VisibilityType.PUBLIC;
     930        }
     931        score += t.ordinal();
    927932       
    928933        // Parameter
  • branches/dev-jk-alias/Compiler/ModelicaMiddleEnd/test/modelica/IndexReduction.mo

    r12092 r12122  
    137137 eval parameter Boolean torque.useSupport = true \"= true, if support flange enabled, otherwise implicitly grounded\" /* true */;
    138138 parameter Modelica.SIunits.MomentOfInertia inertia1.J(min = 0,start = 1) \"Moment of inertia\";
     139 parameter Real idealGear.ratio(start = 1) \"Transmission ratio (flange_a.phi/flange_b.phi)\";
    139140 parameter StateSelect inertia1.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
    140141 Modelica.SIunits.Angle inertia1.phi(stateSelect = inertia1.stateSelect) \"Absolute rotation angle of component\";
    141142 Modelica.SIunits.AngularVelocity inertia1.w(stateSelect = inertia1.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
    142143 Modelica.SIunits.AngularAcceleration inertia1.a \"Absolute angular acceleration of component (= der(w))\";
    143  parameter Real idealGear.ratio(start = 1) \"Transmission ratio (flange_a.phi/flange_b.phi)\";
     144 parameter Modelica.SIunits.MomentOfInertia inertia3.J(min = 0,start = 1) \"Moment of inertia\";
    144145 Modelica.SIunits.Angle idealGear.phi_a \"Angle between left shaft flange and support\";
    145146 Modelica.SIunits.Torque idealGear.flange_a.tau \"Cut torque in the flange\";
     
    157158 Modelica.SIunits.Torque spring.tau \"Torque between flanges (= flange_b.tau)\";
    158159 constant Modelica.SIunits.Torque inertia3.flange_b.tau = 0.0 \"Cut torque in the flange\";
    159  parameter Modelica.SIunits.MomentOfInertia inertia3.J(min = 0,start = 1) \"Moment of inertia\";
     160 parameter Modelica.SIunits.RotationalDampingConstant damper.d(final min = 0,start = 0) \"Damping constant\";
    160161 parameter StateSelect inertia3.stateSelect = StateSelect.default \"Priority to use phi and w as states\" /* StateSelect.default */;
    161162 Modelica.SIunits.Angle inertia3.phi(stateSelect = inertia3.stateSelect) \"Absolute rotation angle of component\";
    162163 Modelica.SIunits.AngularVelocity inertia3.w(fixed = true,start = 0,stateSelect = inertia3.stateSelect) \"Absolute angular velocity of component (= der(phi))\";
    163164 Modelica.SIunits.AngularAcceleration inertia3.a \"Absolute angular acceleration of component (= der(w))\";
    164  parameter Modelica.SIunits.RotationalDampingConstant damper.d(final min = 0,start = 0) \"Damping constant\";
     165 parameter Real sine.amplitude \"Amplitude of sine wave\";
    165166 Modelica.SIunits.Angle damper.phi_rel(stateSelect = StateSelect.always,start = 0,nominal = if damper.phi_nominal >= 1.0E-15 then damper.phi_nominal else 1) \"Relative rotation angle (= flange_b.phi - flange_a.phi)\";
    166167 Modelica.SIunits.AngularVelocity damper.w_rel(stateSelect = StateSelect.always,start = 0) \"Relative angular velocity (= der(phi_rel))\";
    167168 Modelica.SIunits.AngularAcceleration damper.a_rel(start = 0) \"Relative angular acceleration (= der(w_rel))\";
    168169 Modelica.SIunits.Torque damper.tau \"Torque between flanges (= flange_b.tau)\";
    169  parameter Real sine.amplitude \"Amplitude of sine wave\";
    170170 parameter Modelica.SIunits.Angle damper.phi_nominal(displayUnit = \"rad\",min = 0.0) = 1.0E-4 \"Nominal value of phi_rel (used for scaling)\" /* 1.0E-4 */;
    171171 parameter StateSelect damper.stateSelect = StateSelect.prefer \"Priority to use phi_rel and w_rel as states\" /* StateSelect.prefer */;
     
    173173 Modelica.SIunits.Power damper.lossPower \"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)\";
    174174 parameter Modelica.SIunits.Frequency sine.freqHz(start = 1) \"Frequency of sine wave\";
    175  parameter Modelica.SIunits.Angle damper.flange_b.phi \"Absolute rotation angle of flange\";
    176175 parameter Modelica.SIunits.Angle sine.phase = 0 \"Phase of sine wave\" /* 0 */;
    177176 parameter Real sine.offset = 0 \"Offset of output signal\" /* 0 */;
    178177 parameter Modelica.SIunits.Time sine.startTime = 0 \"Output = offset for time < startTime\" /* 0 */;
     178 parameter Modelica.SIunits.Angle damper.flange_b.phi \"Absolute rotation angle of flange\";
    179179 parameter Modelica.SIunits.Angle fixed.flange.phi \"Absolute rotation angle of flange\";
    180180 parameter Modelica.SIunits.Angle idealGear.support.phi \"Absolute rotation angle of the support/housing\";
     
    198198 sine.amplitude = amplitude;
    199199 sine.freqHz = freqHz;
    200  damper.flange_b.phi = fixed.phi0;
    201  fixed.flange.phi = damper.flange_b.phi;
    202  idealGear.support.phi = damper.flange_b.phi;
    203  torque.support.phi = damper.flange_b.phi;
    204  torque.phi_support = damper.flange_b.phi;
    205  idealGear.phi_support = damper.flange_b.phi;
     200 torque.phi_support = fixed.phi0;
     201 damper.flange_b.phi = torque.phi_support;
     202 fixed.flange.phi = torque.phi_support;
     203 idealGear.support.phi = torque.phi_support;
     204 torque.support.phi = torque.phi_support;
     205 idealGear.phi_support = torque.phi_support;
    206206equation
    207207 inertia1.w = inertia1._der_phi;
    208208 inertia1.J * inertia1.a = torque.tau + (- idealGear.flange_a.tau);
    209  idealGear.phi_a = inertia1.phi - damper.flange_b.phi;
    210  - damper.phi_rel = inertia2.phi - damper.flange_b.phi;
     209 idealGear.phi_a = inertia1.phi - torque.phi_support;
     210 - damper.phi_rel = inertia2.phi - torque.phi_support;
    211211 idealGear.phi_a = idealGear.ratio * (- damper.phi_rel);
    212212 0 = idealGear.ratio * idealGear.flange_a.tau + idealGear.flange_b.tau;
  • branches/dev-jk-alias/Compiler/ModelicaMiddleEnd/test/modelica/TransformCanonicalTests.mo

    r12092 r12122  
    14181418         flatModel="
    14191419fclass TransformCanonicalTests.AliasVisibility1
    1420  Real a(start = 1);
    1421 equation
    1422  a = time;
     1420protected
     1421 Real b(start = 1);
     1422equation
     1423 b = time;
    14231424end TransformCanonicalTests.AliasVisibility1;
    14241425")})));
Note: See TracChangeset for help on using the changeset viewer.