1 | #*--------------------------------------------------------------------- |
---|

2 | * This file is property of the author and cannot be used, copyed |
---|

3 | * or modified without permission. |
---|

4 | * |
---|

5 | * Copyright (C) 2004 the author |
---|

6 | *---------------------------------------------------------------------- |
---|

7 | * Author: Rafael de Pelegrini Soares |
---|

8 | * $Id: electrical.mso 1 2006-06-20 17:33:53Z rafael $ |
---|

9 | *--------------------------------------------------------------------*# |
---|

10 | |
---|

11 | using "types"; |
---|

12 | |
---|

13 | Model wire |
---|

14 | #* Model for a electrical wire. |
---|

15 | * This model holds a current and voltage. |
---|

16 | *# |
---|

17 | VARIABLES |
---|

18 | i as current(Lower=-100); |
---|

19 | V as voltage; |
---|

20 | end |
---|

21 | |
---|

22 | Model electrical_basic |
---|

23 | #* Basic model for electrical devices with one |
---|

24 | * input and one output wire. |
---|

25 | *# |
---|

26 | VARIABLES |
---|

27 | in inlet as wire; |
---|

28 | out outlet as wire; |
---|

29 | end |
---|

30 | |
---|

31 | Model electrical as electrical_basic |
---|

32 | #* Model for an electrical device in which the |
---|

33 | * inlet current is equal to the outlet one. |
---|

34 | *# |
---|

35 | EQUATIONS |
---|

36 | outlet.i = inlet.i; |
---|

37 | end |
---|

38 | |
---|

39 | Model Resistor as electrical |
---|

40 | #* Electrical resistor *# |
---|

41 | PARAMETERS |
---|

42 | R as resistance; |
---|

43 | EQUATIONS |
---|

44 | inlet.V - outlet.V = R * outlet.i; |
---|

45 | end |
---|

46 | |
---|

47 | Model Capacitor as electrical |
---|

48 | #* Electrical capacitor *# |
---|

49 | PARAMETERS |
---|

50 | C as capacitance; |
---|

51 | VARIABLES |
---|

52 | q as charge; |
---|

53 | EQUATIONS |
---|

54 | diff(q) = inlet.i; |
---|

55 | inlet.V - outlet.V = (1/C) * q; |
---|

56 | end |
---|

57 | |
---|

58 | Model Indutor as electrical |
---|

59 | #* Electrical indutor *# |
---|

60 | PARAMETERS |
---|

61 | L as indutance; |
---|

62 | EQUATIONS |
---|

63 | inlet.V - outlet.V = L * diff(inlet.i); |
---|

64 | end |
---|

65 | |
---|

66 | Model Supply as electrical_basic |
---|

67 | #* Electrical supply *# |
---|

68 | PARAMETERS |
---|

69 | V as voltage; |
---|

70 | V0 as voltage(Default = 0); |
---|

71 | EQUATIONS |
---|

72 | outlet.V = V0; |
---|

73 | inlet.V - outlet.V = V; |
---|

74 | end |
---|