[General] network = inet.networks.tsn.TsnLinearNetwork sim-time-limit = 10s description = "Traffic shaping using mixed asynchronous and credit-based shapers" #################### # Flow Configuration # # Traffic class Packet interval CBS data rate Channel data rate Priority Shaping # Best Effort 200us ~41.84Mbps ~42.64Mbps 0 CBS # Video 400us ~20.92Mbps ~21.32Mbps 4 CBS # # Applicaion packet length: 1000B # Credit based shaper packet lengt: 1046B = 1000B + 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) # Credit based shaper data rate: 1046B * 8 / Packet interval # Channel packet length: 1054B = 1000B (APP) + 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) + 8B (ETH PHY) # Channel data rate = (1054B + 12B (IFG)) * 8 / Packet interval #################### **.displayGateSchedules = true **.gateFilter = "**.eth[1].**.transmissionGate*" **.gateScheduleVisualizer.height = 16 **.gateScheduleVisualizer.placementHint = "top" # client applications *.client.numApps = 2 *.client.app[*].typename = "UdpSourceApp" *.client.app[0].display-name = "best effort" *.client.app[1].display-name = "video" *.client.app[*].io.destAddress = "server" *.client.app[0].io.destPort = 1000 *.client.app[1].io.destPort = 1001 *.client.app[*].source.packetLength = 1000B # 42B = 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) + 8B (ETH PHY) *.client.app[0].source.productionInterval = replaceUnit(1 / (sin(dropUnit(simTime()) * 3) + 4.5), "ms") *.client.app[1].source.productionInterval = replaceUnit(1 / (sin(dropUnit(simTime() * 1)) + sin(dropUnit(simTime() * 8)) + 2), "ms") # server applications *.server.numApps = 2 *.server.app[*].typename = "UdpSinkApp" *.server.app[0].display-name = "best effort" *.server.app[1].display-name = "video" *.server.app[0].io.localPort = 1000 *.server.app[1].io.localPort = 1001 # enable outgoing streams *.client.hasOutgoingStreams = true # enable incoming streams *.server.hasIncomingStreams = true # client stream identification *.client.bridging.streamIdentifier.identifier.mapping = [{stream: "best effort", packetFilter: expr(udp.destPort == 1000)}, {stream: "video", packetFilter: expr(udp.destPort == 1001)}] # client stream encoding *.client.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0}, {stream: "video", pcp: 4}] # switch stream decoding *.switch.bridging.streamCoder.decoder.mapping = [{pcp: 0, stream: "best effort"}, {pcp: 4, stream: "video"}] # enable egress traffic shaping *.switch.hasEgressTrafficShaping = true # credit-based and asynchronous traffic shaping *.switch.eth[*].macLayer.queue.numTrafficClasses = 2 *.switch.eth[*].macLayer.queue.*[0].display-name = "best effort" *.switch.eth[*].macLayer.queue.*[1].display-name = "video" *.switch.eth[*].macLayer.queue.transmissionSelectionAlgorithm[0].typename = "Ieee8021qCreditBasedShaper" *.switch.eth[*].macLayer.queue.transmissionSelectionAlgorithm[0].idleSlope = 63.96Mbps # channel data rate * 2/3 *.switch.eth[*].macLayer.queue.transmissionSelectionAlgorithm[1].typename = "Ieee8021qCreditBasedShaper" *.switch.eth[*].macLayer.queue.transmissionSelectionAlgorithm[1].idleSlope = 63.96Mbps # channel data rate * 1/3 *.switch.eth[*].macLayer.queue.transmissionGate[0].initiallyOpen = true *.switch.eth[*].macLayer.queue.transmissionGate[1].initiallyOpen = false *.switch.eth[*].macLayer.queue.transmissionGate[*].durations = [4ms, 2ms]