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

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

Files:
1 modified

Legend:

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

    r550 r660  
    4545          model IdealThyristor "Ideal thyristor"  
    4646            extends Modelica.Electrical.Analog.Interfaces.OnePort; 
     47            Modelica.Blocks.Interfaces.BooleanInput fire  
     48              annotation (extent=[50,90; 90,130],   rotation=-90); 
    4749            parameter Modelica.SIunits.Resistance Ron(final min=0) = 1.E-5  
    4850      "Closed thyristor resistance"; 
     
    5254      "Forward threshold voltage"; 
    5355            Boolean off(start=true) "Switching state"; 
    54   protected  
    55             Real s  
    56       "Auxiliary variable: if on then current, if opened then voltage"; 
    5756            annotation ( 
    5857              Documentation(info="<html> 
     
    175174                height=0.6)); 
    176175     
    177   public  
     176  protected  
     177            Real s  
     178      "Auxiliary variable: if on then current, if opened then voltage"; 
     179            constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     180            constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
     181     
     182          equation  
     183            off = s < 0 or pre(off) and not fire; 
     184            v = (s*unitCurrent)*(if off then 1 else Ron) + Vknee; 
     185            i = (s*unitVoltage)*(if off then Goff else 1) + Goff*Vknee; 
     186          end IdealThyristor; 
     187   
     188          model IdealGTOThyristor "Ideal GTO thyristor"  
     189            extends Modelica.Electrical.Analog.Interfaces.OnePort; 
    178190            Modelica.Blocks.Interfaces.BooleanInput fire  
    179191              annotation (extent=[50,90; 90,130],   rotation=-90); 
    180           equation  
    181             off = s < 0 or pre(off) and not fire; 
    182             v = s*(if off then 1 else Ron) + Vknee; 
    183             i = s*(if off then Goff else 1) + Goff*Vknee; 
    184           end IdealThyristor; 
    185    
    186           model IdealGTOThyristor "Ideal GTO thyristor"  
    187             extends Modelica.Electrical.Analog.Interfaces.OnePort; 
    188192            parameter Modelica.SIunits.Resistance Ron(final min=0) = 1.E-5  
    189193      "Closed thyristor resistance"; 
     
    193197      "Forward threshold voltage"; 
    194198            Boolean off(start=true) "Switching state"; 
    195   protected  
    196             Real s  
    197       "Auxiliary variable: if on then current, if opened then voltage"; 
    198199            annotation ( 
    199200              Documentation(info="<html> 
     
    312313                width=0.6, 
    313314                height=0.6)); 
    314      
    315   public  
    316             Modelica.Blocks.Interfaces.BooleanInput fire  
    317               annotation (extent=[50,90; 90,130],   rotation=-90); 
     315  protected  
     316            Real s  
     317      "Auxiliary variable: if on then current, if opened then voltage"; 
     318            constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     319            constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    318320          equation  
    319321            off = s < 0 or not fire; 
    320             v = s*(if off then 1 else Ron) + Vknee; 
    321             i = s*(if off then Goff else 1) + Goff*Vknee; 
     322            v = (s*unitCurrent)*(if off then 1 else Ron) + Vknee; 
     323            i = (s*unitVoltage)*(if off then Goff else 1) + Goff*Vknee; 
    322324          end IdealGTOThyristor; 
    323325   
     
    390392    Real s1; 
    391393    Real s2 "Auxiliary variables"; 
     394    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     395    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    392396  equation  
    393397    0 = p.i + n2.i + n1.i; 
    394398     
    395     p.v - n1.v = s1*(if (control) then 1 else Ron); 
    396     n1.i = -s1*(if (control) then Goff else 1); 
    397     p.v - n2.v = s2*(if (control) then Ron else 1); 
    398     n2.i = -s2*(if (control) then 1 else Goff); 
     399    p.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); 
     400    n1.i = -(s1*unitVoltage)*(if (control) then Goff else 1); 
     401    p.v - n2.v = (s2*unitCurrent)*(if (control) then Ron else 1); 
     402    n2.i = -(s2*unitVoltage)*(if (control) then 1 else Goff); 
    399403  end IdealCommutingSwitch; 
    400404   
     
    476480      annotation (extent=[-20,60; 20,100],rotation=-90); 
    477481  protected  
    478     Real s1; 
    479     Real s2; 
    480     Real s3; 
    481     Real s4 "Auxiliary variables"; 
     482    Real s1(final unit="1"); 
     483    Real s2(final unit="1"); 
     484    Real s3(final unit="1"); 
     485    Real s4(final unit="1") "Auxiliary variables"; 
     486    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     487    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    482488  equation  
    483     p1.v - n1.v = s1*(if (control) then 1 else Ron); 
    484     p2.v - n2.v = s2*(if (control) then 1 else Ron); 
    485     p1.v - n2.v = s3*(if (control) then Ron else 1); 
    486     p2.v - n1.v = s4*(if (control) then Ron else 1); 
     489    p1.v - n1.v = (s1*unitCurrent)*(if (control) then 1 else Ron); 
     490    p2.v - n2.v = (s2*unitCurrent)*(if (control) then 1 else Ron); 
     491    p1.v - n2.v = (s3*unitCurrent)*(if (control) then Ron else 1); 
     492    p2.v - n1.v = (s4*unitCurrent)*(if (control) then Ron else 1); 
    487493     
    488     p1.i = if (control) then s1*Goff + s3 else s1 + s3*Goff; 
    489     p2.i = if (control) then s2*Goff + s4 else s2 + s4*Goff; 
    490     n1.i = if (control) then -s1*Goff - s4 else -s1 - s4*Goff; 
    491     n2.i = if (control) then -s2*Goff - s3 else -s2 - s3*Goff; 
     494    p1.i = if control then s1*unitVoltage*Goff + s3*unitCurrent else s1*unitCurrent + s3*unitVoltage*Goff; 
     495    p2.i = if control then s2*unitVoltage*Goff + s4*unitCurrent else s2*unitCurrent + s4*unitVoltage*Goff; 
     496    n1.i = if control then -s1*unitVoltage*Goff - s4*unitCurrent else -s1*unitCurrent - s4*unitVoltage*Goff; 
     497    n2.i = if control then -s2*unitVoltage*Goff - s3*unitCurrent else -s2*unitCurrent - s3*unitVoltage*Goff; 
    492498  end IdealIntermediateSwitch; 
    493499   
     
    562568    Real s1; 
    563569    Real s2 "Auxiliary variables"; 
     570    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     571    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    564572  equation  
    565573    control.i = 0; 
    566574    0 = p.i + n2.i + n1.i; 
    567575     
    568     p.v - n1.v = s1*(if (control.v > level) then 1 else Ron); 
    569     n1.i = -s1*(if (control.v > level) then Goff else 1); 
    570     p.v - n2.v = s2*(if (control.v > level) then Ron else 1); 
    571     n2.i = -s2*(if (control.v > level) then 1 else Goff); 
     576    p.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     577    n1.i = -(s1*unitVoltage)*(if (control.v > level) then Goff else 1); 
     578    p.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then Ron else 1); 
     579    n2.i = -(s2*unitVoltage)*(if (control.v > level) then 1 else Goff); 
    572580  end ControlledIdealCommutingSwitch; 
    573581   
     
    657665    Real s3; 
    658666    Real s4 "Auxiliary variables"; 
     667    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     668    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    659669  equation  
    660670    control.i = 0; 
    661671     
    662     p1.v - n1.v = s1*(if (control.v > level) then 1 else Ron); 
    663     p2.v - n2.v = s2*(if (control.v > level) then 1 else Ron); 
    664     p1.v - n2.v = s3*(if (control.v > level) then Ron else 1); 
    665     p2.v - n1.v = s4*(if (control.v > level) then Ron else 1); 
     672    p1.v - n1.v = (s1*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     673    p2.v - n2.v = (s2*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     674    p1.v - n2.v = (s3*unitCurrent)*(if (control.v > level) then Ron else 1); 
     675    p2.v - n1.v = (s4*unitCurrent)*(if (control.v > level) then Ron else 1); 
    666676     
    667     p1.i = if (control.v > level) then s1*Goff + s3 else s1 + s3*Goff; 
    668     p2.i = if (control.v > level) then s2*Goff + s4 else s2 + s4*Goff; 
    669     n1.i = if (control.v > level) then -s1*Goff - s4 else -s1 - s4*Goff; 
    670     n2.i = if (control.v > level) then -s2*Goff - s3 else -s2 - s3*Goff; 
     677    p1.i = if control.v > level then s1*unitVoltage*Goff + s3*unitCurrent else s1*unitCurrent + s3*unitVoltage*Goff; 
     678    p2.i = if control.v > level then s2*unitVoltage*Goff + s4*unitCurrent else s2*unitCurrent + s4*unitVoltage*Goff; 
     679    n1.i = if control.v > level then -s1*unitVoltage*Goff - s4*unitCurrent else -s1*unitCurrent - s4*unitVoltage*Goff; 
     680    n2.i = if control.v > level then -s2*unitVoltage*Goff - s3*unitCurrent else -s2*unitCurrent - s3*unitVoltage*Goff; 
    671681  end ControlledIdealIntermediateSwitch; 
    672682   
     
    949959  protected  
    950960    Real s "Auxiliary variable"; 
     961    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
    951962  equation  
    952963    in_p.i = 0; 
     
    958969    out.v = if (s < -1) then VMin.v else if (s > 1) then VMax.v else (VMax.v - 
    959970      VMin.v)*s/2 + (VMax.v + VMin.v)/2; 
     971     
    960972  end IdealOpAmpLimited; 
    961973   
     
    13161328      "true => switch open, false => p--n connected" annotation (extent=[-20,50; 
    13171329          20,90],      rotation=-90); 
    1318   protected  
    1319     Real s "Auxiliary variable"; 
    1320      
    13211330    annotation ( 
    13221331      Documentation(info="<HTML> 
     
    13721381        Line(points=[0, 51; 0, 26]), 
    13731382        Line(points=[40, 20; 40, 0]))); 
     1383  protected  
     1384   Real s "Auxiliary variable"; 
     1385   constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1386   constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    13741387 equation  
    1375     v = s*(if control then 1 else Ron); 
    1376     i = s*(if control then Goff else 1); 
     1388    v = (s*unitCurrent)*(if control then 1 else Ron); 
     1389    i = (s*unitVoltage)*(if control then Goff else 1); 
    13771390 end IdealOpeningSwitch; 
    13781391   
     
    13871400      "true => p--n connected, false => switch open"   annotation (extent=[-20,50; 
    13881401            20,90],      rotation=-90); 
    1389   protected  
    1390       Real s "Auxiliary variable"; 
    1391      
    13921402      annotation ( 
    13931403        Documentation(info="<HTML> 
     
    14091419</P> 
    14101420</HTML> 
    1411 ", revisions="<html> 
     1421",     revisions= 
     1422             "<html> 
    14121423<ul> 
    14131424<li><i>  </i> 
     
    14411452          Text(extent=[-100, -40; 100, -79], string="%name"), 
    14421453          Line(points=[0, 51; 0, 26]))); 
     1454  protected  
     1455      Real s "Auxiliary variable"; 
     1456      constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1457      constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    14431458    equation  
    1444       v = s*(if control then Ron else 1); 
    1445       i = s*(if control then 1 else Goff); 
     1459      v = (s*unitCurrent)*(if control then Ron else 1); 
     1460      i = (s*unitVoltage)*(if control then 1 else Goff); 
    14461461    end IdealClosingSwitch; 
    14471462   
    14481463  model ControlledIdealOpeningSwitch "Controlled ideal electrical opener"  
     1464    Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); 
     1465    Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); 
     1466    Interfaces.Pin control  
     1467      "Control pin: control.v > level switch open, otherwise p--n connected"  
     1468      annotation (extent=[-10, 90; 10, 110], rotation=90); 
     1469     
    14491470    parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667, 
    14501471            10; -10, 56.6667]); 
     
    14541475      "Opened switch conductance" annotation (extent=[-56.6667, -56.6667; -10, 
    14551476          -10]); 
    1456   protected  
    1457     Real s "Auxiliary variable"; 
    14581477    annotation ( 
    14591478      Documentation(info=" 
     
    15091528        Line(points=[0,96; 0,25]), 
    15101529        Line(points=[40, 20; 40, 0]))); 
    1511   public  
    1512     Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); 
    1513     Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); 
    1514     Interfaces.Pin control  
    1515       "Control pin: control.v > level switch open, otherwise p--n connected"  
    1516       annotation (extent=[-10, 90; 10, 110], rotation=90); 
     1530  protected  
     1531    Real s "Auxiliary variable"; 
     1532    constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1533    constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    15171534  equation  
    15181535    control.i = 0; 
    15191536    0 = p.i + n.i; 
    1520     p.v - n.v = s*(if (control.v > level) then 1 else Ron); 
    1521     p.i = s*(if (control.v > level) then Goff else 1); 
     1537    p.v - n.v = (s*unitCurrent)*(if (control.v > level) then 1 else Ron); 
     1538    p.i = (s*unitVoltage)*(if (control.v > level) then Goff else 1); 
    15221539  end ControlledIdealOpeningSwitch; 
    15231540   
    15241541    model ControlledIdealClosingSwitch "Controlled ideal electrical closer"  
     1542      Modelica.Electrical.Analog.Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); 
     1543      Modelica.Electrical.Analog.Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); 
     1544      Modelica.Electrical.Analog.Interfaces.Pin control  
     1545      "Control pin: control.v > level switch closed, otherwise switch open"  
     1546        annotation (extent=[-10, 90; 10, 110], rotation=90); 
    15251547      parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667, 
    15261548              10; -10, 56.6667]); 
     
    15311553      "Opened switch conductance"   annotation (extent=[-56.6667, -56.6667; -10, 
    15321554            -10]); 
    1533   protected  
    1534       Real s "Auxiliary variable"; 
    15351555      annotation ( 
    15361556        Documentation(info=" 
     
    15531573</P> 
    15541574</HTML> 
    1555 ", revisions="<html> 
     1575",     revisions= 
     1576             "<html> 
    15561577<ul> 
    15571578<li><i>  </i> 
     
    15841605          Line(points=[40,0; 96,0]), 
    15851606          Line(points=[0,96; 0,25]))); 
    1586   public  
    1587       Modelica.Electrical.Analog.Interfaces.PositivePin p annotation (extent=[-110, -10; -90, 10]); 
    1588       Modelica.Electrical.Analog.Interfaces.NegativePin n annotation (extent=[90, -10; 110, 10]); 
    1589       Modelica.Electrical.Analog.Interfaces.Pin control  
    1590       "Control pin: control.v > level switch closed, otherwise switch open"  
    1591         annotation (extent=[-10, 90; 10, 110], rotation=90); 
     1607  protected  
     1608      Real s "Auxiliary variable"; 
     1609      constant Real unitVoltage(unit="V") = 1           annotation(Hide=true); 
     1610      constant Real unitCurrent(unit="A") = 1            annotation(Hide=true); 
    15921611    equation  
    15931612      control.i = 0; 
    15941613      0 = p.i + n.i; 
    1595       p.v - n.v = s*(if (control.v > level) then Ron else 1); 
    1596       p.i = s*(if (control.v > level) then 1 else Goff); 
     1614      p.v - n.v = (s*unitCurrent)*(if (control.v > level) then Ron else 1); 
     1615      p.i = (s*unitVoltage)*(if (control.v > level) then 1 else Goff); 
    15971616    end ControlledIdealClosingSwitch; 
    15981617