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

Fixed minor unit errors reported by Sven Erik
(requires Advanced.DeduceUnits = true; default = false, i.e.,
these errors are only reported with DeduceUnits=true).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Modelica/branches/maintenance/2.2.2/Modelica/Electrical/Analog/Ideal.mo

    r660 r661  
    871871   
    872872  model IdealOpAmpLimited "Ideal operational amplifier with limitation"  
     873     
    873874    annotation ( 
    874875      Documentation(info="<HTML> 
     
    958959    SI.Voltage vin "input voltage"; 
    959960  protected  
    960     Real s "Auxiliary variable"; 
     961    Real s(unit="1") "Auxiliary variable"; 
    961962    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
    962963  equation  
     
    966967    VMin.i = 0; 
    967968    vin = in_p.v - in_n.v; 
    968     in_p.v - in_n.v = if (s < -1) then s + 1 else if (s > 1) then s - 1 else 0; 
     969    in_p.v - in_n.v = unitVoltage*(if (s < -1) then s + 1 else if (s > 1) then s - 1 else 0); 
    969970    out.v = if (s < -1) then VMin.v else if (s > 1) then VMax.v else (VMax.v - 
    970971      VMin.v)*s/2 + (VMax.v + VMin.v)/2; 
     
    981982      "Forward threshold voltage"; 
    982983          Boolean off(start=true) "Switching state"; 
    983   protected  
    984           Real s  
    985       "Auxiliary variable: if on then current, if opened then voltage"; 
    986984          annotation ( 
    987985            Documentation(info="<html> 
     
    10951093              height=0.6)); 
    10961094     
     1095  protected  
     1096          Real s  
     1097      "Auxiliary variable: if on then current, if opened then voltage"; 
     1098          constant Real unitVoltPerOhm(unit="V/Ohm") = 1    annotation(Hide=true); 
     1099          constant Real unitAmperePerSiemens(unit="A/S") = 1 annotation(Hide=true); 
    10971100        equation  
    10981101          off = s < 0; 
    1099           v = s*(if off then 1 else Ron) + Vknee; 
    1100           i = s*(if off then Goff else 1) + Goff*Vknee; 
     1102          v = (s*unitVoltPerOhm)*(if off then 1 else Ron) + Vknee; 
     1103          i = (s*unitAmperePerSiemens)*(if off then Goff else 1) + Goff*Vknee; 
    11011104        end IdealDiode; 
    11021105