- Timestamp:
- 10/10/2007 03:17:26 PM (15 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Modelica/branches/maintenance/2.2.2/Modelica/Electrical/Analog/Ideal.mo
r550 r660 45 45 model IdealThyristor "Ideal thyristor" 46 46 extends Modelica.Electrical.Analog.Interfaces.OnePort; 47 Modelica.Blocks.Interfaces.BooleanInput fire 48 annotation (extent=[50,90; 90,130], rotation=-90); 47 49 parameter Modelica.SIunits.Resistance Ron(final min=0) = 1.E-5 48 50 "Closed thyristor resistance"; … … 52 54 "Forward threshold voltage"; 53 55 Boolean off(start=true) "Switching state"; 54 protected55 Real s56 "Auxiliary variable: if on then current, if opened then voltage";57 56 annotation ( 58 57 Documentation(info="<html> … … 175 174 height=0.6)); 176 175 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; 178 190 Modelica.Blocks.Interfaces.BooleanInput fire 179 191 annotation (extent=[50,90; 90,130], rotation=-90); 180 equation181 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;188 192 parameter Modelica.SIunits.Resistance Ron(final min=0) = 1.E-5 189 193 "Closed thyristor resistance"; … … 193 197 "Forward threshold voltage"; 194 198 Boolean off(start=true) "Switching state"; 195 protected196 Real s197 "Auxiliary variable: if on then current, if opened then voltage";198 199 annotation ( 199 200 Documentation(info="<html> … … 312 313 width=0.6, 313 314 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); 318 320 equation 319 321 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; 322 324 end IdealGTOThyristor; 323 325 … … 390 392 Real s1; 391 393 Real s2 "Auxiliary variables"; 394 constant Real unitVoltage(unit="V") = 1 annotation(Hide=true); 395 constant Real unitCurrent(unit="A") = 1 annotation(Hide=true); 392 396 equation 393 397 0 = p.i + n2.i + n1.i; 394 398 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); 399 403 end IdealCommutingSwitch; 400 404 … … 476 480 annotation (extent=[-20,60; 20,100],rotation=-90); 477 481 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); 482 488 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); 487 493 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; 492 498 end IdealIntermediateSwitch; 493 499 … … 562 568 Real s1; 563 569 Real s2 "Auxiliary variables"; 570 constant Real unitVoltage(unit="V") = 1 annotation(Hide=true); 571 constant Real unitCurrent(unit="A") = 1 annotation(Hide=true); 564 572 equation 565 573 control.i = 0; 566 574 0 = p.i + n2.i + n1.i; 567 575 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); 572 580 end ControlledIdealCommutingSwitch; 573 581 … … 657 665 Real s3; 658 666 Real s4 "Auxiliary variables"; 667 constant Real unitVoltage(unit="V") = 1 annotation(Hide=true); 668 constant Real unitCurrent(unit="A") = 1 annotation(Hide=true); 659 669 equation 660 670 control.i = 0; 661 671 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); 666 676 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; 671 681 end ControlledIdealIntermediateSwitch; 672 682 … … 949 959 protected 950 960 Real s "Auxiliary variable"; 961 constant Real unitVoltage(unit="V") = 1 annotation(Hide=true); 951 962 equation 952 963 in_p.i = 0; … … 958 969 out.v = if (s < -1) then VMin.v else if (s > 1) then VMax.v else (VMax.v - 959 970 VMin.v)*s/2 + (VMax.v + VMin.v)/2; 971 960 972 end IdealOpAmpLimited; 961 973 … … 1316 1328 "true => switch open, false => p--n connected" annotation (extent=[-20,50; 1317 1329 20,90], rotation=-90); 1318 protected1319 Real s "Auxiliary variable";1320 1321 1330 annotation ( 1322 1331 Documentation(info="<HTML> … … 1372 1381 Line(points=[0, 51; 0, 26]), 1373 1382 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); 1374 1387 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); 1377 1390 end IdealOpeningSwitch; 1378 1391 … … 1387 1400 "true => p--n connected, false => switch open" annotation (extent=[-20,50; 1388 1401 20,90], rotation=-90); 1389 protected1390 Real s "Auxiliary variable";1391 1392 1402 annotation ( 1393 1403 Documentation(info="<HTML> … … 1409 1419 </P> 1410 1420 </HTML> 1411 ", revisions="<html> 1421 ", revisions= 1422 "<html> 1412 1423 <ul> 1413 1424 <li><i> </i> … … 1441 1452 Text(extent=[-100, -40; 100, -79], string="%name"), 1442 1453 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); 1443 1458 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); 1446 1461 end IdealClosingSwitch; 1447 1462 1448 1463 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 1449 1470 parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667, 1450 1471 10; -10, 56.6667]); … … 1454 1475 "Opened switch conductance" annotation (extent=[-56.6667, -56.6667; -10, 1455 1476 -10]); 1456 protected1457 Real s "Auxiliary variable";1458 1477 annotation ( 1459 1478 Documentation(info=" … … 1509 1528 Line(points=[0,96; 0,25]), 1510 1529 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); 1517 1534 equation 1518 1535 control.i = 0; 1519 1536 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); 1522 1539 end ControlledIdealOpeningSwitch; 1523 1540 1524 1541 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); 1525 1547 parameter SI.Voltage level=0.5 "Switch level" annotation (extent=[-56.6667, 1526 1548 10; -10, 56.6667]); … … 1531 1553 "Opened switch conductance" annotation (extent=[-56.6667, -56.6667; -10, 1532 1554 -10]); 1533 protected1534 Real s "Auxiliary variable";1535 1555 annotation ( 1536 1556 Documentation(info=" … … 1553 1573 </P> 1554 1574 </HTML> 1555 ", revisions="<html> 1575 ", revisions= 1576 "<html> 1556 1577 <ul> 1557 1578 <li><i> </i> … … 1584 1605 Line(points=[40,0; 96,0]), 1585 1606 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); 1592 1611 equation 1593 1612 control.i = 0; 1594 1613 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); 1597 1616 end ControlledIdealClosingSwitch; 1598 1617
