|
| 1 | +//! base 0.1.0 |
| 2 | +package 'CauerLowPassAnalog' |
| 3 | + model 'CauerLowPassAnalog' "Cauer low pass filter with analog components" |
| 4 | + parameter Real 'l1'(unit = "H", quantity = "Inductance") = 1.304 "Filter coefficient I1"; |
| 5 | + parameter Real 'l2'(unit = "H", quantity = "Inductance") = 0.8586 "Filter coefficient I2"; |
| 6 | + parameter Real 'c1'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.072 "Filter coefficient c1"; |
| 7 | + parameter Real 'c2'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.0 / (2.906997720064 * 'l1') "Filter coefficient c2"; |
| 8 | + parameter Real 'c3'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.682 "Filter coefficient c3"; |
| 9 | + parameter Real 'c4'(min = 0.0, unit = "F", quantity = "Capacitance") = 1.0 / (1.392270203025 * 'l2') "Filter coefficient c4"; |
| 10 | + parameter Real 'c5'(min = 0.0, unit = "F", quantity = "Capacitance") = 0.7262 "Filter coefficient c5"; |
| 11 | + Real 'G.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 12 | + Real 'G.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 13 | + Real 'C1.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 14 | + Real 'C1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 15 | + Real 'C1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 16 | + Real 'C1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 17 | + Real 'C1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 18 | + Real 'C1.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 19 | + parameter Real 'C1.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c1' "Capacitance"; |
| 20 | + Real 'C2.v'(start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 21 | + Real 'C2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 22 | + Real 'C2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 23 | + Real 'C2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 24 | + Real 'C2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 25 | + Real 'C2.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 26 | + parameter Real 'C2.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c2' "Capacitance"; |
| 27 | + Real 'C3.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 28 | + Real 'C3.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 29 | + Real 'C3.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 30 | + Real 'C3.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 31 | + Real 'C3.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 32 | + Real 'C3.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 33 | + parameter Real 'C3.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c3' "Capacitance"; |
| 34 | + Real 'C4.v'(start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 35 | + Real 'C4.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 36 | + Real 'C4.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 37 | + Real 'C4.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 38 | + Real 'C4.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 39 | + Real 'C4.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 40 | + parameter Real 'C4.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c4' "Capacitance"; |
| 41 | + Real 'C5.v'(fixed = true, start = 0.0, unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 42 | + Real 'C5.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 43 | + Real 'C5.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 44 | + Real 'C5.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 45 | + Real 'C5.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 46 | + Real 'C5.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 47 | + parameter Real 'C5.C'(start = 1.0, min = 0.0, unit = "F", quantity = "Capacitance") = 'c5' "Capacitance"; |
| 48 | + Real 'L1.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 49 | + Real 'L1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 50 | + Real 'L1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 51 | + Real 'L1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 52 | + Real 'L1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 53 | + Real 'L1.i'(fixed = true, start = 0.0, unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 54 | + parameter Real 'L1.L'(start = 1.0, unit = "H", quantity = "Inductance") = 'l1' "Inductance"; |
| 55 | + Real 'L2.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 56 | + Real 'L2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 57 | + Real 'L2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 58 | + Real 'L2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 59 | + Real 'L2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 60 | + Real 'L2.i'(fixed = true, start = 0.0, unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 61 | + parameter Real 'L2.L'(start = 1.0, unit = "H", quantity = "Inductance") = 'l2' "Inductance"; |
| 62 | + parameter Real 'R1.R'(start = 1.0, unit = "Ohm", quantity = "Resistance") = 1.0 "Resistance at temperature T_ref"; |
| 63 | + parameter Real 'R1.T_ref'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 300.15 "Reference temperature"; |
| 64 | + parameter Real 'R1.alpha'(unit = "1/K", quantity = "LinearTemperatureCoefficient") = 0.0 "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))"; |
| 65 | + Real 'R1.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 66 | + Real 'R1.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 67 | + Real 'R1.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 68 | + Real 'R1.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 69 | + Real 'R1.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 70 | + Real 'R1.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 71 | + parameter Boolean 'R1.useHeatPort' = false "= true, if heatPort is enabled" annotation(Evaluate = true); |
| 72 | + parameter Real 'R1.T'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 'R1.T_ref' "Fixed device temperature if useHeatPort = false"; |
| 73 | + Real 'R1.LossPower'(unit = "W", quantity = "Power") "Loss power leaving component via heatPort"; |
| 74 | + Real 'R1.T_heatPort'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") "Temperature of heatPort"; |
| 75 | + Real 'R1.R_actual'(unit = "Ohm", quantity = "Resistance") "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))"; |
| 76 | + parameter Real 'R2.R'(start = 1.0, unit = "Ohm", quantity = "Resistance") = 1.0 "Resistance at temperature T_ref"; |
| 77 | + parameter Real 'R2.T_ref'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 300.15 "Reference temperature"; |
| 78 | + parameter Real 'R2.alpha'(unit = "1/K", quantity = "LinearTemperatureCoefficient") = 0.0 "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))"; |
| 79 | + Real 'R2.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 80 | + Real 'R2.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 81 | + Real 'R2.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 82 | + Real 'R2.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 83 | + Real 'R2.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 84 | + Real 'R2.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 85 | + parameter Boolean 'R2.useHeatPort' = false "= true, if heatPort is enabled" annotation(Evaluate = true); |
| 86 | + parameter Real 'R2.T'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") = 'R2.T_ref' "Fixed device temperature if useHeatPort = false"; |
| 87 | + Real 'R2.LossPower'(unit = "W", quantity = "Power") "Loss power leaving component via heatPort"; |
| 88 | + Real 'R2.T_heatPort'(nominal = 300.0, start = 288.15, min = 0.0, displayUnit = "degC", unit = "K", quantity = "ThermodynamicTemperature") "Temperature of heatPort"; |
| 89 | + Real 'R2.R_actual'(unit = "Ohm", quantity = "Resistance") "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))"; |
| 90 | + parameter Real 'V.V'(start = 1.0, unit = "V", quantity = "ElectricPotential") = 1.0 "Height of step"; |
| 91 | + Real 'V.v'(unit = "V", quantity = "ElectricPotential") "Voltage drop of the two pins (= p.v - n.v)"; |
| 92 | + Real 'V.p.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 93 | + Real 'V.p.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 94 | + Real 'V.n.v'(unit = "V", quantity = "ElectricPotential") "Potential at the pin"; |
| 95 | + Real 'V.n.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing into the pin"; |
| 96 | + Real 'V.i'(unit = "A", quantity = "ElectricCurrent") "Current flowing from pin p to pin n"; |
| 97 | + parameter Real 'V.signalSource.height' = 'V.V' "Height of step"; |
| 98 | + Real 'V.signalSource.y' "Connector of Real output signal"; |
| 99 | + parameter Real 'V.signalSource.offset' = 'V.offset' "Offset of output signal y"; |
| 100 | + parameter Real 'V.signalSource.startTime'(unit = "s", quantity = "Time") = 'V.startTime' "Output y = offset for time < startTime"; |
| 101 | + parameter Real 'V.offset'(unit = "V", quantity = "ElectricPotential") = 0.0 "Voltage offset"; |
| 102 | + parameter Real 'V.startTime'(unit = "s", quantity = "Time") = 1.0 "Time offset"; |
| 103 | + equation |
| 104 | + 'L1.p.v' = 'C1.p.v'; |
| 105 | + 'L1.p.v' = 'C2.p.v'; |
| 106 | + 'L1.p.v' = 'R1.n.v'; |
| 107 | + 'C2.n.v' = 'L2.p.v'; |
| 108 | + 'C2.n.v' = 'C4.p.v'; |
| 109 | + 'C2.n.v' = 'C3.p.v'; |
| 110 | + 'C2.n.v' = 'L1.n.v'; |
| 111 | + 'C4.n.v' = 'R2.p.v'; |
| 112 | + 'C4.n.v' = 'C5.p.v'; |
| 113 | + 'C4.n.v' = 'L2.n.v'; |
| 114 | + 'V.n.v' = 'G.p.v'; |
| 115 | + 'V.n.v' = 'R2.n.v'; |
| 116 | + 'V.n.v' = 'C1.n.v'; |
| 117 | + 'V.n.v' = 'C5.n.v'; |
| 118 | + 'V.n.v' = 'C3.n.v'; |
| 119 | + 'R1.p.v' = 'V.p.v'; |
| 120 | + 'V.n.i' + 'R2.n.i' + 'C5.n.i' + 'C3.n.i' + 'C1.n.i' + 'G.p.i' = 0.0; |
| 121 | + 'L2.p.i' + 'L1.n.i' + 'C4.p.i' + 'C3.p.i' + 'C2.n.i' = 0.0; |
| 122 | + 'R2.p.i' + 'L2.n.i' + 'C5.p.i' + 'C4.n.i' = 0.0; |
| 123 | + 'V.p.i' + 'R1.p.i' = 0.0; |
| 124 | + 'R1.n.i' + 'L1.p.i' + 'C2.p.i' + 'C1.p.i' = 0.0; |
| 125 | + 'G.p.v' = 0.0; |
| 126 | + 'C1.i' = 'C1.C' * der('C1.v'); |
| 127 | + 0.0 = 'C1.p.i' + 'C1.n.i'; |
| 128 | + 'C1.i' = 'C1.p.i'; |
| 129 | + 'C1.v' = 'C1.p.v' - 'C1.n.v'; |
| 130 | + 'C2.i' = 'C2.C' * der('C2.v'); |
| 131 | + 0.0 = 'C2.p.i' + 'C2.n.i'; |
| 132 | + 'C2.i' = 'C2.p.i'; |
| 133 | + 'C2.v' = 'C2.p.v' - 'C2.n.v'; |
| 134 | + 'C3.i' = 'C3.C' * der('C3.v'); |
| 135 | + 0.0 = 'C3.p.i' + 'C3.n.i'; |
| 136 | + 'C3.i' = 'C3.p.i'; |
| 137 | + 'C3.v' = 'C3.p.v' - 'C3.n.v'; |
| 138 | + 'C4.i' = 'C4.C' * der('C4.v'); |
| 139 | + 0.0 = 'C4.p.i' + 'C4.n.i'; |
| 140 | + 'C4.i' = 'C4.p.i'; |
| 141 | + 'C4.v' = 'C4.p.v' - 'C4.n.v'; |
| 142 | + 'C5.i' = 'C5.C' * der('C5.v'); |
| 143 | + 0.0 = 'C5.p.i' + 'C5.n.i'; |
| 144 | + 'C5.i' = 'C5.p.i'; |
| 145 | + 'C5.v' = 'C5.p.v' - 'C5.n.v'; |
| 146 | + 'L1.L' * der('L1.i') = 'L1.v'; |
| 147 | + 0.0 = 'L1.p.i' + 'L1.n.i'; |
| 148 | + 'L1.i' = 'L1.p.i'; |
| 149 | + 'L1.v' = 'L1.p.v' - 'L1.n.v'; |
| 150 | + 'L2.L' * der('L2.i') = 'L2.v'; |
| 151 | + 0.0 = 'L2.p.i' + 'L2.n.i'; |
| 152 | + 'L2.i' = 'L2.p.i'; |
| 153 | + 'L2.v' = 'L2.p.v' - 'L2.n.v'; |
| 154 | + assert(1.0 + 'R1.alpha' * ('R1.T_heatPort' - 'R1.T_ref') >= 2.220446049250313e-16, "Temperature outside scope of model!", AssertionLevel.error); |
| 155 | + 'R1.R_actual' = 'R1.R' * (1.0 + 'R1.alpha' * ('R1.T_heatPort' - 'R1.T_ref')); |
| 156 | + 'R1.v' = 'R1.R_actual' * 'R1.i'; |
| 157 | + 'R1.LossPower' = 'R1.v' * 'R1.i'; |
| 158 | + 'R1.T_heatPort' = 'R1.T'; |
| 159 | + 0.0 = 'R1.p.i' + 'R1.n.i'; |
| 160 | + 'R1.i' = 'R1.p.i'; |
| 161 | + 'R1.v' = 'R1.p.v' - 'R1.n.v'; |
| 162 | + assert(1.0 + 'R2.alpha' * ('R2.T_heatPort' - 'R2.T_ref') >= 2.220446049250313e-16, "Temperature outside scope of model!", AssertionLevel.error); |
| 163 | + 'R2.R_actual' = 'R2.R' * (1.0 + 'R2.alpha' * ('R2.T_heatPort' - 'R2.T_ref')); |
| 164 | + 'R2.v' = 'R2.R_actual' * 'R2.i'; |
| 165 | + 'R2.LossPower' = 'R2.v' * 'R2.i'; |
| 166 | + 'R2.T_heatPort' = 'R2.T'; |
| 167 | + 0.0 = 'R2.p.i' + 'R2.n.i'; |
| 168 | + 'R2.i' = 'R2.p.i'; |
| 169 | + 'R2.v' = 'R2.p.v' - 'R2.n.v'; |
| 170 | + 'V.signalSource.y' = 'V.signalSource.offset' + (if time < 'V.signalSource.startTime' then 0.0 else 'V.signalSource.height'); |
| 171 | + 'V.v' = 'V.signalSource.y'; |
| 172 | + 0.0 = 'V.p.i' + 'V.n.i'; |
| 173 | + 'V.i' = 'V.p.i'; |
| 174 | + 'V.v' = 'V.p.v' - 'V.n.v'; |
| 175 | + annotation(experiment(StopTime = 60)); |
| 176 | + end 'CauerLowPassAnalog'; |
| 177 | +end 'CauerLowPassAnalog'; |
0 commit comments