Changeset 662

Show
Ignore:
Timestamp:
10/10/2007 03:38:19 PM (15 months ago)
Author:
otter
Message:

Minor unit errors corrected, reported by Sven Erik
(mostly related to s-parameterization of ideal electrical switches
and friction elements)

Location:
Modelica/trunk/Modelica
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • Modelica/trunk/Modelica/Blocks/Discrete.mo

    r611 r662  
    105105  protected  
    106106    Real ySample; 
    107     Real tSample; 
     107    Modelica.SIunits.Time tSample; 
    108108    Real c; 
    109109    annotation ( 
     
    470470</HTML> 
    471471")); 
    472     Modelica.Blocks.Interfaces.RealInput u  
    473       "Connector with a Real input signal" annotation (extent=[- 
     472    Modelica.Blocks.Interfaces.RealInput u "Connector with a Real input signal" 
     473                                          annotation (extent=[- 
    474474          140, -20; -100, 20]); 
    475475    Modelica.Blocks.Interfaces.RealOutput y  
  • Modelica/trunk/Modelica/Blocks/Math.mo

    r559 r662  
    236236    block To_rpm "Convert from radian per second to revolutions per minute"  
    237237      extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit="rad/s"), 
    238           y(unit="rev/min")); 
     238          y(unit="r/min")); 
    239239      annotation (Icon(Text( 
    240240            extent=[26,82; -98,50], 
     
    243243            extent=[100,-42; -62,-74], 
    244244            style(color=0), 
    245             string="rev/min")), Documentation(info="<html> 
     245            string="r/min")), Documentation(info="<html> 
    246246<p> 
    247247This block converts the input signal from radian per second to revolutions per minute and returns 
     
    255255    block From_rpm "Convert from revolutions per minute to radian per second"  
    256256      extends Modelica.Blocks.Interfaces.PartialConversionBlock(u(unit= 
    257               "rev/min"), y(unit="rad/s")); 
     257              "r/min"), y(unit="rad/s")); 
    258258      annotation (Icon(Text( 
    259259            extent=[50,84; -94,56], 
    260260            style(color=0), 
    261             string="rev/min"), Text( 
     261            string="r/min"), Text( 
    262262            extent=[94,-42; -26,-74], 
    263263            style(color=0), 
  • Modelica/trunk/Modelica/Blocks/Sources.mo

    r572 r662  
    211211</html>")); 
    212212      block Clock "Generate actual time signal "  
    213         parameter Real offset=0 "Offset of output signal"; 
    214         parameter SIunits.Time startTime=0  
     213        parameter Modelica.SIunits.Time offset=0 "Offset of output signal"; 
     214        parameter Modelica.SIunits.Time startTime=0  
    215215      "Output = offset for time < startTime"; 
    216216        extends Interfaces.SO; 
     
    598598      block Ramp "Generate ramp signal"  
    599599        parameter Real height=1 "Height of ramps"; 
    600         parameter Real duration(min=Modelica.Constants.small) = 2  
     600        parameter Modelica.SIunits.Time duration(min=Modelica.Constants.small) = 2  
    601601      "Durations of ramp"; 
    602602        parameter Real offset=0 "Offset of output signal"; 
    603         parameter SIunits.Time startTime=0  
     603        parameter Modelica.SIunits.Time startTime=0  
    604604      "Output = offset for time < startTime"; 
    605605        extends Interfaces.SO; 
  • Modelica/trunk/Modelica/Electrical/Analog/Ideal.mo

    r621 r662  
    178178            Real s(final unit="1")  
    179179      "Auxiliary variable: if on then current, if opened then voltage"; 
    180             constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    181             constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     180            constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     181            constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    182182     
    183183          equation  
    184184            off = s < 0 or pre(off) and not fire; 
    185             v = (s*unitVoltPerOhm)*(if off then 1 else Ron) + Vknee; 
    186             i = (s*unitAmperePerSiemens)*(if off then Goff else 1) + Goff*Vknee; 
     185            v = (s*unitCurrent)*(if off then 1 else Ron) + Vknee; 
     186            i = (s*unitVoltage)*(if off then Goff else 1) + Goff*Vknee; 
    187187          end IdealThyristor; 
    188188   
     
    320320            Real s(final unit="1")  
    321321      "Auxiliary variable: if on then current, if opened then voltage"; 
    322             constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    323             constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     322            constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     323            constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    324324          equation  
    325325            off = s < 0 or not fire; 
    326             v = (s*unitVoltPerOhm)*(if off then 1 else Ron) + Vknee; 
    327             i = (s*unitAmperePerSiemens)*(if off then Goff else 1) + Goff*Vknee; 
     326            v = (s*unitCurrent)*(if off then 1 else Ron) + Vknee; 
     327            i = (s*unitVoltage)*(if off then Goff else 1) + Goff*Vknee; 
    328328          end IdealGTOThyristor; 
    329329   
     
    396396    Real s1(final unit="1"); 
    397397    Real s2(final unit="1") "Auxiliary variables"; 
    398     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    399     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     398    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     399    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    400400     
    401401  equation  
    402402    0 = p.i + n2.i + n1.i; 
    403403     
    404     p.v - n1.v = (s1*unitVoltPerOhm)*(if (control) then 1 else Ron); 
    405     n1.i = -(s1*unitAmperePerSiemens)*(if (control) then Goff else 1); 
    406     p.v - n2.v = (s2*unitVoltPerOhm)*(if (control) then Ron else 1); 
    407     n2.i = -(s2*unitAmperePerSiemens)*(if (control) then 1 else Goff); 
     404    p.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); 
     405    n1.i = -(s1*unitVoltage)*(if (control) then Goff else 1); 
     406    p.v - n2.v = (s2*unitCurrent)*(if (control) then Ron else 1); 
     407    n2.i = -(s2*unitVoltage)*(if (control) then 1 else Goff); 
    408408  end IdealCommutingSwitch; 
    409409   
     
    489489    Real s3(final unit="1"); 
    490490    Real s4(final unit="1") "Auxiliary variables"; 
    491     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    492     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
    493     constant Real unitAmpere(unit="A") = 1 annotation(Hide=true); 
     491    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     492    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    494493  equation  
    495     p1.v - n1.v = (s1*unitVoltPerOhm)*(if (control) then 1 else Ron); 
    496     p2.v - n2.v = (s2*unitVoltPerOhm)*(if (control) then 1 else Ron); 
    497     p1.v - n2.v = (s3*unitVoltPerOhm)*(if (control) then Ron else 1); 
    498     p2.v - n1.v = (s4*unitVoltPerOhm)*(if (control) then Ron else 1); 
    499      
    500     p1.i = if control then s1*unitAmperePerSiemens*Goff + s3*unitAmpere else s1*unitAmpere + s3*unitAmperePerSiemens*Goff; 
    501     p2.i = if control then s2*unitAmperePerSiemens*Goff + s4*unitAmpere else s2*unitAmpere + s4*unitAmperePerSiemens*Goff; 
    502     n1.i = if control then -s1*unitAmperePerSiemens*Goff - s4*unitAmpere else -s1*unitAmpere - s4*unitAmperePerSiemens*Goff; 
    503     n2.i = if control then -s2*unitAmperePerSiemens*Goff - s3*unitAmpere else -s2*unitAmpere - s3*unitAmperePerSiemens*Goff; 
     494    p1.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); 
     495    p2.v - n2.v = (s2*unitCurrent)*(if (control) then 1 else Ron); 
     496    p1.v - n2.v = (s3*unitCurrent)*(if (control) then Ron else 1); 
     497    p2.v - n1.v = (s4*unitCurrent)*(if (control) then Ron else 1); 
     498     
     499    p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else s1*unitCurrent + s3*unitVoltage*Goff; 
     500    p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else s2*unitCurrent + s4*unitVoltage*Goff; 
     501    n1.i = if control then -s1*unitVoltage*Goff - s4*unitCurrent else -s1*unitCurrent - s4*unitVoltage*Goff; 
     502    n2.i = if control then -s2*unitVoltage*Goff - s3*unitCurrent else -s2*unitCurrent - s3*unitVoltage*Goff; 
    504503  end IdealIntermediateSwitch; 
    505504   
     
    574573    Real s1(final unit="1"); 
    575574    Real s2(final unit="1") "Auxiliary variables"; 
    576     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    577     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     575    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     576    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    578577  equation  
    579578    control.i = 0; 
    580579    0 = p.i + n2.i + n1.i; 
    581580     
    582     p.v - n1.v = (s1*unitVoltPerOhm)*(if (control.v > level) then 1 else Ron); 
    583     n1.i = -(s1*unitAmperePerSiemens)*(if (control.v > level) then Goff else 1); 
    584     p.v - n2.v = (s2*unitVoltPerOhm)*(if (control.v > level) then Ron else 1); 
    585     n2.i = -(s2*unitAmperePerSiemens)*(if (control.v > level) then 1 else Goff); 
     581    p.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     582    n1.i = -(s1*unitVoltage)*(if (control.v > level) then Goff else 1); 
     583    p.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then Ron else 1); 
     584    n2.i = -(s2*unitVoltage)*(if (control.v > level) then 1 else Goff); 
    586585  end ControlledIdealCommutingSwitch; 
    587586   
     
    671670    Real s3(final unit="1"); 
    672671    Real s4(final unit="1") "Auxiliary variables"; 
    673     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    674     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
    675     constant Real unitAmpere(unit="A") = 1 annotation(Hide=true); 
     672    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     673    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    676674  equation  
    677675    control.i = 0; 
    678676     
    679     p1.v - n1.v = (s1*unitVoltPerOhm)*(if (control.v > level) then 1 else Ron); 
    680     p2.v - n2.v = (s2*unitVoltPerOhm)*(if (control.v > level) then 1 else Ron); 
    681     p1.v - n2.v = (s3*unitVoltPerOhm)*(if (control.v > level) then Ron else 1); 
    682     p2.v - n1.v = (s4*unitVoltPerOhm)*(if (control.v > level) then Ron else 1); 
    683      
    684     p1.i = if control.v > level then s1*unitAmperePerSiemens*Goff + s3*unitAmpere else s1*unitAmpere + s3*unitAmperePerSiemens*Goff; 
    685     p2.i = if control.v > level then s2*unitAmperePerSiemens*Goff + s4*unitAmpere else s2*unitAmpere + s4*unitAmperePerSiemens*Goff; 
    686     n1.i = if control.v > level then -s1*unitAmperePerSiemens*Goff - s4*unitAmpere else -s1*unitAmpere - s4*unitAmperePerSiemens*Goff; 
    687     n2.i = if control.v > level then -s2*unitAmperePerSiemens*Goff - s3*unitAmpere else -s2*unitAmpere - s3*unitAmperePerSiemens*Goff; 
     677    p1.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     678    p2.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     679    p1.v - n2.v = (s3*unitCurrent)*(if (control.v > level) then Ron else 1); 
     680    p2.v - n1.v = (s4*unitCurrent)*(if (control.v > level) then Ron else 1); 
     681     
     682    p1.i = if control.v > level then s1*unitVoltage*Goff + s3*unitCurrent else s1*unitCurrent + s3*unitVoltage*Goff; 
     683    p2.i = if control.v > level then s2*unitVoltage*Goff + s4*unitCurrent else s2*unitCurrent + s4*unitVoltage*Goff; 
     684    n1.i = if control.v > level then -s1*unitVoltage*Goff - s4*unitCurrent else -s1*unitCurrent - s4*unitVoltage*Goff; 
     685    n2.i = if control.v > level then -s2*unitVoltage*Goff - s3*unitCurrent else -s2*unitCurrent - s3*unitVoltage*Goff; 
    688686  end ControlledIdealIntermediateSwitch; 
    689687   
     
    969967  protected  
    970968    Real s(final unit="1") "Auxiliary variable"; 
    971     constant Real unitVolt(unit="V") = 1    annotation(Hide=true); 
     969    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
    972970  equation  
    973971    in_p.i = 0; 
     
    976974    VMin.i = 0; 
    977975    vin = in_p.v - in_n.v; 
    978     in_p.v - in_n.v = if (s*unitVolt < -1) then s*unitVolt + 1 else if (s*unitVolt > 1) then s*unitVolt - 1 else 0; 
    979     out.v = if (s*unitVolt < -1) then VMin.v else if (s*unitVolt > 1) then VMax.v else (VMax.v - VMin.v)*s/2 + (VMax.v + VMin.v)/2; 
     976    in_p.v - in_n.v = unitVoltage*(if s < -1 then s + 1 else if s > 1 then s - 1 else 0); 
     977    out.v = if s < -1 then VMin.v else if s > 1 then VMax.v else (VMax.v - VMin.v)*s/2 + (VMax.v + VMin.v)/2; 
    980978  end IdealOpAmpLimited; 
    981979   
     
    13931391        Line(points=[40, 20; 40, 0]))); 
    13941392  protected  
    1395     Real s(final unit="1") "Auxiliary variable"; 
    1396     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    1397     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     1393   Real s(final unit="1") "Auxiliary variable"; 
     1394   constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1395   constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    13981396 equation  
    1399     v = (s*unitVoltPerOhm)*(if control then 1 else Ron); 
    1400     i = (s*unitAmperePerSiemens)*(if control then Goff else 1); 
     1397    v = (s*unitCurrent)*(if control then 1 else Ron); 
     1398    i = (s*unitVoltage)*(if control then Goff else 1); 
    14011399 end IdealOpeningSwitch; 
    14021400   
     
    14661464  protected  
    14671465      Real s(final unit="1") "Auxiliary variable"; 
    1468       constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    1469       constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     1466      constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1467      constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    14701468    equation  
    1471       v = (s*unitVoltPerOhm)*(if control then Ron else 1); 
    1472       i = (s*unitAmperePerSiemens)*(if control then 1 else Goff); 
     1469      v = (s*unitCurrent)*(if control then Ron else 1); 
     1470      i = (s*unitVoltage)*(if control then 1 else Goff); 
    14731471    end IdealClosingSwitch; 
    14741472   
     
    15431541  protected  
    15441542    Real s(final unit="1") "Auxiliary variable"; 
    1545     constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    1546     constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     1543    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1544    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    15471545  equation  
    15481546    control.i = 0; 
    15491547    0 = p.i + n.i; 
    1550     p.v - n.v = (s*unitVoltPerOhm)*(if (control.v > level) then 1 else Ron); 
    1551     p.i = (s*unitAmperePerSiemens)*(if (control.v > level) then Goff else 1); 
     1548    p.v - n.v = (s*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     1549    p.i = (s*unitVoltage)*(if (control.v > level) then Goff else 1); 
    15521550  end ControlledIdealOpeningSwitch; 
    15531551   
     
    16231621  protected  
    16241622      Real s(final unit="1") "Auxiliary variable"; 
    1625       constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
    1626       constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
     1623      constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1624      constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    16271625    equation  
    16281626      control.i = 0; 
    16291627      0 = p.i + n.i; 
    1630       p.v - n.v = (s*unitVoltPerOhm)*(if (control.v > level) then Ron else 1); 
    1631       p.i = (s*unitAmperePerSiemens)*(if (control.v > level) then 1 else Goff); 
     1628      p.v - n.v = (s*unitCurrent)*(if (control.v > level) then Ron else 1); 
     1629      p.i = (s*unitVoltage)*(if (control.v > level) then 1 else Goff); 
    16321630    end ControlledIdealClosingSwitch; 
    16331631   
  • Modelica/trunk/Modelica/Mechanics/Rotational.mo

    r643 r662  
    17571757    equation  
    17581758      tau_support = -adapter.flange_b.tau; 
    1759       connect(adapter.flange_a, bearing) annotation (points=[-6.12323e-016,-70;  
     1759      connect(adapter.flange_a, bearing) annotation (points=[-6.12323e-016,-70; 
    17601760            0,-70; 0,-100],    style(color=0)); 
    17611761      annotation (Documentation(info="<html> 
     
    45744574    SI.Torque tau_support "Support torque"; 
    45754575  protected  
    4576     parameter Real w_crit=2*Modelica.Constants.pi*f_crit  
    4577       "critical frequency in [1/s]"; 
     4576    parameter Modelica.SIunits.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit  
     4577      "Critical frequency"; 
    45784578    constant Real af=1.3617 "s coefficient of Bessel filter"; 
    45794579    constant Real bf=0.6180 "s*s coefficient of Bessel filter"; 
     
    47074707    SI.Torque tau_support "Support torque"; 
    47084708  protected  
    4709     parameter Real w_crit=2*Constants.pi*f_crit "critical frequency in [1/s]"; 
     4709    parameter Modelica.SIunits.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit  
     4710      "Critical frequency"; 
    47104711  public  
    47114712    Interfaces.Flange_b flange_b annotation (extent=[90, -10; 110, 10]); 
  • Modelica/trunk/Modelica/Mechanics/Translational.mo

    r643 r662  
    22722272    output SI.Acceleration a "absolute acceleration of flange_b"; 
    22732273  protected  
    2274     parameter Real w_crit=2*Modelica.Constants.pi*f_crit  
    2275       "critical frequency in [1/s]"; 
     2274    parameter Modelica.SIunits.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit  
     2275      "Critical frequency"; 
    22762276    constant Real af=1.3617 "s coefficient of Bessel filter"; 
    22772277    constant Real bf=0.6180 "s*s coefficient of Bessel filter"; 
     
    24212421              color=10, fillColor=10)))); 
    24222422  protected  
    2423     parameter Real w_crit=2*Modelica.Constants.pi*f_crit  
    2424       "critical frequency in [1/s]"; 
     2423    parameter Modelica.SIunits.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit  
     2424      "Critical frequency"; 
    24252425    SI.Acceleration a  
    24262426      "absolute acceleration of flange_b if exact=false (a=0, if exact=true)"; 
  • Modelica/trunk/Modelica/SIunits.mo

    r597 r662  
    390390      type Angle_deg = Real (final quantity="Angle", final unit="deg"); 
    391391      type AngularVelocity_rpm = Real (final quantity="AngularVelocity", final unit 
    392             =    "rev/min"); 
     392            =    "r/min"); 
    393393      type Velocity_kmh = Real (final quantity="Velocity", final unit="km/h"); 
    394394      type Time_day = Real (final quantity="Time", final unit="d"); 
     
    422422"), Icon(Text( 
    423423            extent=[-66, -13; 52, -67], 
    424             string="[rev/min]", 
     424            string="[r/min]", 
    425425            style(color=0)))); 
    426426    end NonSIunits; 
     
    556556            extent=[100, -20; 20, -100], 
    557557            style(color=0), 
    558             string="rev/min"))); 
     558            string="r/min"))); 
    559559    algorithm  
    560560      rpm := (30/Modelica.Constants.pi)*rs; 
     
    569569            extent=[-20, 100; -100, 20], 
    570570            style(color=0), 
    571             string="rev/min"), Text( 
     571            string="r/min"), Text( 
    572572            extent=[100, -20; 20, -100], 
    573573            style(color=0), 
     
    850850      final quantity="AngularVelocity", 
    851851      final unit="rad/s", 
    852       displayUnit="rev/min"); 
     852      displayUnit="r/min"); 
    853853  type AngularAcceleration = Real (final quantity="AngularAcceleration", final unit 
    854854        =    "rad/s2"); 
     
    860860  type Frequency = Real (final quantity="Frequency", final unit="Hz"); 
    861861  type AngularFrequency = Real (final quantity="AngularFrequency", final unit= 
    862           "s-1"); 
     862          "rad/s"); 
    863863  type Wavelength = Real (final quantity="Wavelength", final unit="m"); 
    864864  type Wavelenght = Wavelength; 
  • Modelica/trunk/Modelica/Thermal/FluidHeatFlow.mo

    r655 r662  
    11within Modelica.Thermal; 
     2 
    23 
    34package FluidHeatFlow  
     
    13951396        "Part of friction losses fed to medium"; 
    13961397    protected  
     1398      constant Modelica.SIunits.VolumeFlowRate unitVolumeFlowRate = 1; 
    13971399      constant Real small = Modelica.Constants.small; 
    1398       constant Modelica.SIunits.VolumeFlowRate smallVolumeFlowRate = eps; 
     1400      constant Modelica.SIunits.VolumeFlowRate smallVolumeFlowRate = eps*unitVolumeFlowRate; 
    13991401      constant Real eps = Modelica.Constants.eps; 
    14001402      Real yLim = max(min(y,y1),0) "Limited valve opening";