From ff8e11e8dafcf895235c8ff65b563b6fbbb42d1d Mon Sep 17 00:00:00 2001 From: Malin Date: Fri, 12 Jan 2024 09:12:48 +0100 Subject: [PATCH 1/4] adjust size of traffic network --- .../networks/TrafficNetwork.ned | 552 ++++++++++++++++-- 1 file changed, 510 insertions(+), 42 deletions(-) diff --git a/cosima_omnetpp_project/networks/TrafficNetwork.ned b/cosima_omnetpp_project/networks/TrafficNetwork.ned index 14f7855..a265871 100644 --- a/cosima_omnetpp_project/networks/TrafficNetwork.ned +++ b/cosima_omnetpp_project/networks/TrafficNetwork.ned @@ -30,7 +30,7 @@ import modules.CosimaScenarioManager; network TrafficNetwork { - @display("bgb=1332.5,1063.4"); + @display("bgb=5003.927,3943.4114"); submodules: scenarioManager: CosimaScenarioManager { @@ -47,26 +47,26 @@ network TrafficNetwork } client0: StandardHost { - @display("p=738.364,66.154"); + @display("p=3327.8247,146.27802"); } client2: StandardHost { - @display("p=1016.6,659.1"); + @display("p=3656.9502,603.3968"); } client1: StandardHost { - @display("p=799.5,379.6"); + @display("p=3388.774,463.21368"); } router0: Router { - @display("p=577.2,638.3"); + @display("p=3163.262,719.2002"); } router1: Router { - @display("p=300.3,452.4"); + @display("p=2888.9907,536.3527"); } switch0: EtherSwitch { - @display("p=800.8,657.8"); + @display("p=3382.679,676.53577"); } switch1: EtherSwitch { - @display("p=495.3,109.2"); + @display("p=3084.028,188.94243"); } visualizer: IntegratedCanvasVisualizer { @@ -74,69 +74,537 @@ network TrafficNetwork } router2: Router { - @display("p=208,279.5"); + @display("p=2797.567,359.6001"); } router3: Router { - @display("p=422.5,301.6"); + @display("p=3010.889,383.97977"); } router4: Router { - @display("p=284.69998,128.7"); + @display("p=2870.7058,213.3221"); } switch2: EtherSwitch { - @display("p=613.6,315.9"); + @display("p=3199.8315,396.16962"); } client3: StandardHost { - @display("p=1030.9,942.5"); + @display("p=3608.191,835.00366"); } switch3: EtherSwitch { - @display("p=688.32007,876.82263"); + @display("p=3382.679,828.9087"); } traffic_device_0: StandardHost { - @display("p=283.822,941.094"); + @display("p=2596.4346,1066.6105"); } traffic_device_1: StandardHost { - @display("p=98.164,751.168"); + @display("p=2456.2515,676.53577"); } switch4: EtherSwitch { - @display("p=420.398,819.456"); + @display("p=3004.7942,902.0477"); } switch5: EtherSwitch { - @display("p=198.462,618.86"); + @display("p=2785.3772,700.91547"); } traffic_device_2: StandardHost { - @display("p=467.346,985.908"); + @display("p=3053.5535,1066.6105"); } traffic_device_3: StandardHost { - @display("p=381.98602,689.28204"); + @display("p=2968.2246,774.05444"); } traffic_device_4: StandardHost { - @display("p=714.89,206.998"); + @display("p=3303.445,286.4611"); } + router5: Router { + @display("p=3303.445,1310.4071"); + } + router6: Router { + @display("p=3748.374,1371.3563"); + } + router7: Router { + @display("p=4193.3027,1194.6038"); + } + router8: Router { + @display("p=4114.069,804.52905"); + } + router9: Router { + @display("p=3797.1333,530.25775"); + } + router10: Router { + @display("p=3230.306,2340.4482"); + } + client4: StandardHost { + @display("p=3163.262,2121.031"); + } + client5: StandardHost { + @display("p=2888.9907,2334.3533"); + } + client6: StandardHost { + @display("p=2888.9907,2614.7195"); + } + client7: StandardHost { + @display("p=3199.8315,2614.7195"); + } + client8: StandardHost { + @display("p=3486.2925,2614.7195"); + } + client9: StandardHost { + @display("p=3656.9502,2389.2075"); + } + client10: StandardHost { + @display("p=3528.957,2188.0752"); + } + client11: StandardHost { + @display("p=3797.1333,1767.5259"); + } + client12: StandardHost { + @display("p=4047.025,1682.1971"); + } + client13: StandardHost { + @display("p=4339.581,1499.3496"); + } + client14: StandardHost { + @display("p=4558.998,1237.2682"); + } + client15: StandardHost { + @display("p=4485.859,774.05444"); + } + client16: StandardHost { + @display("p=4412.7197,530.25775"); + } + client17: StandardHost { + @display("p=4193.3027,396.16962"); + } + client18: StandardHost { + @display("p=3894.6519,207.22717"); + } + client19: StandardHost { + @display("p=2968.2246,1499.3496"); + } + client20: StandardHost { + @display("p=3230.306,1682.1971"); + } + router11: Router { + @display("p=2450.1567,1420.1157"); + } + router12: Router { + @display("p=1676.1022,1371.3563"); + } + router13: Router { + @display("p=1529.8242,1084.8953"); + } + router14: Router { + @display("p=1121.4647,969.0918"); + } + router15: Router { + @display("p=828.9087,1304.3123"); + } + router16: Router { + @display("p=975.1867,1566.3937"); + } + router17: Router { + @display("p=1322.597,1633.4377"); + } + switch6: EtherSwitch { + @display("p=1030.041,713.1053"); + } + + client21: StandardHost { + @display("p=1377.4513,560.73236"); + } + client22: StandardHost { + @display("p=987.3766,463.21368"); + } + client23: StandardHost { + @display("p=414.45435,835.00366"); + } + client24: StandardHost { + @display("p=243.79668,1188.5088"); + } + client25: StandardHost { + @display("p=268.17636,1548.1089"); + } + client26: StandardHost { + @display("p=243.79668,1980.848"); + } + client27: StandardHost { + @display("p=524.16284,1858.9497"); + } + client28: StandardHost { + @display("p=877.668,1932.0887"); + } + client29: StandardHost { + @display("p=1133.6545,1999.1328"); + } + client30: StandardHost { + @display("p=1426.2106,1913.804"); + } + client31: StandardHost { + @display("p=1730.9564,2035.7023"); + } + client32: StandardHost { + @display("p=1767.5259,1767.5259"); + } + client33: StandardHost { + @display("p=2011.3226,1682.1971"); + } + client34: StandardHost { + @display("p=1676.1022,798.43414"); + } + client35: StandardHost { + @display("p=1865.0446,835.00366"); + } + client36: StandardHost { + @display("p=1968.6582,1066.6105"); + } + router18: Router { + @display("p=713.1053,2687.8584"); + } + client37: StandardHost { + @display("p=920.33246,2474.5364"); + } + client38: StandardHost { + @display("p=1066.6105,2681.7634"); + } + client39: StandardHost { + @display("p=713.1053,2986.5093"); + } + client40: StandardHost { + @display("p=962.9969,2986.5093"); + } + client41: StandardHost { + @display("p=420.5493,2986.5093"); + } + client42: StandardHost { + @display("p=323.0306,2681.7634"); + } + client43: StandardHost { + @display("p=524.16284,2535.4856"); + } + client44: StandardHost { + @display("p=219.417,2474.5364"); + } + client45: StandardHost { + @display("p=115.80342,2809.7568"); + } + client46: StandardHost { + @display("p=115.80342,3090.123"); + } + client47: StandardHost { + @display("p=420.5493,3321.7297"); + } + client48: StandardHost { + @display("p=713.1053,3321.7297"); + } + client49: StandardHost { + @display("p=1066.6105,3321.7297"); + } + client50: StandardHost { + @display("p=1255.5529,3090.123"); + } + client51: StandardHost { + @display("p=1401.8309,2895.0857"); + } + client52: StandardHost { + @display("p=1359.1665,2565.96"); + } + router19: Router { + @display("p=4114.069,2992.6042"); + } + client53: StandardHost { + @display("p=4047.025,2724.428"); + } + client54: StandardHost { + @display("p=4047.025,2724.428"); + } + client55: StandardHost { + @display("p=4047.025,2724.428"); + } + client56: StandardHost { + @display("p=4406.625,2535.4856"); + } + client57: StandardHost { + @display("p=4193.3027,2724.428"); + } + client58: StandardHost { + @display("p=3388.774,3236.401"); + } + client59: StandardHost { + @display("p=4193.3027,2480.6313"); + } + client60: StandardHost { + @display("p=4485.859,2663.4788"); + } + client61: StandardHost { + @display("p=3608.191,3480.1975"); + } + client62: StandardHost { + @display("p=3608.191,3199.8315"); + } + client63: StandardHost { + @display("p=4705.276,2901.1804"); + } + client64: StandardHost { + @display("p=3608.191,2956.0347"); + } + client65: StandardHost { + @display("p=4260.347,3382.679"); + } + client66: StandardHost { + @display("p=4047.025,3480.1975"); + } + client67: StandardHost { + @display("p=3797.1333,3260.7805"); + } + client68: StandardHost { + @display("p=3797.1333,3004.7942"); + } + client69: StandardHost { + @display("p=4558.998,3120.5974"); + } + client70: StandardHost { + @display("p=4339.581,2809.7568"); + } + router20: Router { + @display("p=2303.8787,1919.8988"); + } + router21: Router { + @display("p=1956.4684,2486.726"); + } + router22: Router { + @display("p=2078.3667,3474.1028"); + } + router23: Router { + @display("p=2383.1125,2748.8076"); + } + client71: StandardHost { + @display("p=2669.5737,2114.9363"); + } + client72: StandardHost { + @display("p=2669.5737,3382.679"); + } + client73: StandardHost { + @display("p=2157.6006,3090.123"); + } + client74: StandardHost { + @display("p=2529.3906,3114.5027"); + } + client75: StandardHost { + @display("p=1877.2345,3090.123"); + } + client76: StandardHost { + @display("p=2675.6685,3602.096"); + } + client77: StandardHost { + @display("p=1468.875,3748.374"); + } + client78: StandardHost { + @display("p=1730.9564,3260.7805"); + } + client79: StandardHost { + @display("p=1621.2479,3468.0078"); + } + client80: StandardHost { + @display("p=2596.4346,3827.608"); + } + client81: StandardHost { + @display("p=2340.4482,3224.2112"); + } + client82: StandardHost { + @display("p=2157.6006,2480.6313"); + } + client83: StandardHost { + @display("p=2114.9363,1980.848"); + } + client84: StandardHost { + @display("p=2529.3906,1828.4751"); + } + client85: StandardHost { + @display("p=2596.4346,2535.4856"); + } + client86: StandardHost { + @display("p=2529.3906,3321.7297"); + } + client87: StandardHost { + @display("p=2078.3667,3224.2112"); + } + client88: StandardHost { + @display("p=2303.8787,3382.679"); + } + client89: StandardHost { + @display("p=2450.1567,3528.957"); + } + client90: StandardHost { + @display("p=2303.8787,3748.374"); + } + client91: StandardHost { + @display("p=1767.5259,2742.7126"); + } + client92: StandardHost { + @display("p=1676.1022,2474.5364"); + } + client93: StandardHost { + @display("p=1968.6582,2261.214"); + } + client94: StandardHost { + @display("p=1688.292,3638.6655"); + } + client95: StandardHost { + @display("p=1877.2345,3748.374"); + } + client96: StandardHost { + @display("p=2078.3667,3748.374"); + } + client97: StandardHost { + @display("p=1877.2345,3382.679"); + } + client98: StandardHost { + @display("p=2592.684,2723.9592"); + } + client99: StandardHost { + @display("p=2156.663,2784.9082"); + } connections: - switch0.ethg++ <--> Eth10M { length = 1000km; } <--> client2.ethg++; - switch0.ethg++ <--> Eth10M { length = 1000km; } <--> router0.ethg++; - router0.ethg++ <--> Eth10M { length = 1000km; } <--> router1.ethg++; - client0.ethg++ <--> Eth10M { length = 500km; } <--> switch1.ethg++; - router2.ethg++ <--> Eth10M { length = 100km; } <--> router4.ethg++; - router2.ethg++ <--> Eth10M { length = 500km; } <--> router1.ethg++; - router1.ethg++ <--> Eth10M { length = 500km; } <--> router3.ethg++; - router3.ethg++ <--> Eth10M { length = 50km; } <--> router4.ethg++; - router4.ethg++ <--> Eth10M { length = 50km; } <--> switch1.ethg++; - router2.ethg++ <--> Eth10M { length = 50km; } <--> router3.ethg++; - switch2.ethg++ <--> Eth10M { length = 50km; } <--> client1.ethg++; - switch2.ethg++ <--> Eth10M { length = 50km; } <--> router3.ethg++; - switch3.ethg++ <--> Eth10M { length = 50km; } <--> client3.ethg++; - router0.ethg++ <--> Eth10M { length = 50km; } <--> switch3.ethg++; - router0.ethg++ <--> Eth10M { length = 50km; } <--> switch4.ethg++; - router1.ethg++ <--> Eth10M { length = 50km; } <--> switch5.ethg++; - traffic_device_1.ethg++ <--> Eth10M { length = 50km; } <-->switch5.ethg++; - switch4.ethg++ <--> Eth10M { length = 50km; } <--> traffic_device_0.ethg++; - switch1.ethg++ <--> Eth10M { length = 50km; } <--> traffic_device_4.ethg++; - switch4.ethg++ <--> Eth10M { length = 50km; } <--> traffic_device_2.ethg++; - switch5.ethg++ <--> Eth10M { length = 50km; } <--> traffic_device_3.ethg++; + switch0.ethg++ <--> Eth100M <--> client2.ethg++; + switch0.ethg++ <--> Eth100M <--> router0.ethg++; + router0.ethg++ <--> Eth100M <--> router1.ethg++; + client0.ethg++ <--> Eth100M <--> switch1.ethg++; + router2.ethg++ <--> Eth100M <--> router4.ethg++; + router2.ethg++ <--> Eth100M <--> router1.ethg++; + router1.ethg++ <--> Eth100M <--> router3.ethg++; + router3.ethg++ <--> Eth100M <--> router4.ethg++; + router4.ethg++ <--> Eth100M <--> switch1.ethg++; + router2.ethg++ <--> Eth100M <--> router3.ethg++; + switch2.ethg++ <--> Eth100M <--> client1.ethg++; + switch2.ethg++ <--> Eth100M <--> router3.ethg++; + switch3.ethg++ <--> Eth100M <--> client3.ethg++; + router0.ethg++ <--> Eth100M <--> switch3.ethg++; + router0.ethg++ <--> Eth100M <--> switch4.ethg++; + router1.ethg++ <--> Eth100M <--> switch5.ethg++; + traffic_device_1.ethg++ <--> Eth100M <--> switch5.ethg++; + switch4.ethg++ <--> Eth100M <--> traffic_device_0.ethg++; + switch1.ethg++ <--> Eth100M <--> traffic_device_4.ethg++; + switch4.ethg++ <--> Eth100M <--> traffic_device_2.ethg++; + switch5.ethg++ <--> Eth100M <--> traffic_device_3.ethg++; + router0.ethg++ <--> Eth100M <--> router5.ethg++; + router5.ethg++ <--> Eth100M <--> router6.ethg++; + router6.ethg++ <--> Eth100M <--> router7.ethg++; + router8.ethg++ <--> Eth100M <--> router7.ethg++; + router9.pppg++ <--> Eth100M <--> router8.pppg++; + router9.ethg++ <--> Eth100M <--> router0.ethg++; + router6.ethg++ <--> Eth100M <--> router10.ethg++; + router10.ethg++ <--> Eth100M <--> client10.ethg++; + router10.ethg++ <--> Eth100M <--> client9.ethg++; + router10.ethg++ <--> Eth100M <--> client8.ethg++; + router10.ethg++ <--> Eth100M <--> client7.ethg++; + router10.ethg++ <--> Eth100M <--> client6.ethg++; + router10.ethg++ <--> Eth100M <--> client5.ethg++; + router10.ethg++ <--> Eth100M <--> client4.ethg++; + router9.ethg++ <--> Eth100M <--> client18.ethg++; + router9.ethg++ <--> Eth100M <--> client17.ethg++; + router8.ethg++ <--> Eth100M <--> client16.ethg++; + router8.ethg++ <--> Eth100M <--> client15.ethg++; + router7.ethg++ <--> Eth100M <--> client14.ethg++; + router7.ethg++ <--> Eth100M <--> client13.ethg++; + router6.ethg++ <--> Eth100M <--> client12.ethg++; + router6.ethg++ <--> Eth100M <--> client11.ethg++; + client19.ethg++ <--> Eth100M <--> router5.ethg++; + router5.ethg++ <--> Eth100M <--> client20.ethg++; + router5.ethg++ <--> Eth100M <--> router11.ethg++; + router11.ethg++ <--> Eth100M <--> router12.ethg++; + router12.ethg++ <--> Eth100M <--> router13.ethg++; + router13.ethg++ <--> Eth100M <--> router14.ethg++; + router14.ethg++ <--> Eth100M <--> router15.ethg++; + router15.ethg++ <--> Eth100M <--> router16.ethg++; + router16.ethg++ <--> Eth100M <--> router17.ethg++; + router17.ethg++ <--> Eth100M <--> router12.ethg++; + router14.ethg++ <--> Eth100M <--> switch6.ethg++; + switch6.ethg++ <--> Eth100M <--> client21.ethg++; + switch6.ethg++ <--> Eth100M <--> client22.ethg++; + router15.ethg++ <--> Eth100M <--> client23.ethg++; + router15.ethg++ <--> Eth100M <--> client24.ethg++; + router16.ethg++ <--> Eth100M <--> client25.ethg++; + router16.ethg++ <--> Eth100M <--> client26.ethg++; + router17.ethg++ <--> Eth100M <--> client28.ethg++; + router16.ethg++ <--> Eth100M <--> client27.ethg++; + router17.ethg++ <--> Eth100M <--> client29.ethg++; + router17.ethg++ <--> Eth100M <--> client30.ethg++; + router17.ethg++ <--> Eth100M <--> client31.ethg++; + router12.ethg++ <--> Eth100M <--> client32.ethg++; + router12.ethg++ <--> Eth100M <--> client33.ethg++; + client34.ethg++ <--> Eth100M <--> router13.ethg++; + client35.ethg++ <--> Eth100M <--> router13.ethg++; + client36.ethg++ <--> Eth100M <--> router13.ethg++; + router17.ethg++ <--> Eth100M <--> router18.ethg++; + client37.ethg++ <--> Eth100M <--> router18.ethg++; + client38.ethg++ <--> Eth100M <--> router18.ethg++; + client39.ethg++ <--> Eth100M <--> router18.ethg++; + client40.ethg++ <--> Eth100M <--> router18.ethg++; + client41.ethg++ <--> Eth100M <--> router18.ethg++; + client42.ethg++ <--> Eth100M <--> router18.ethg++; + client43.ethg++ <--> Eth100M <--> router18.ethg++; + client44.ethg++ <--> Eth100M <--> router18.ethg++; + client45.ethg++ <--> Eth100M <--> router18.ethg++; + client46.ethg++ <--> Eth100M <--> router18.ethg++; + client47.ethg++ <--> Eth100M <--> router18.ethg++; + client48.ethg++ <--> Eth100M <--> router18.ethg++; + client49.ethg++ <--> Eth100M <--> router18.ethg++; + client50.ethg++ <--> Eth100M <--> router18.ethg++; + client51.ethg++ <--> Eth100M <--> router18.ethg++; + client52.ethg++ <--> Eth100M <--> router18.ethg++; + router10.ethg++ <--> Eth100M <--> router19.ethg++; + client53.ethg++ <--> Eth100M <--> router19.ethg++; + client54.ethg++ <--> Eth100M <--> router19.ethg++; + client55.ethg++ <--> Eth100M <--> router19.ethg++; + client56.ethg++ <--> Eth100M <--> router19.ethg++; + client57.ethg++ <--> Eth100M <--> router19.ethg++; + client58.ethg++ <--> Eth100M <--> router19.ethg++; + client59.ethg++ <--> Eth100M <--> router19.ethg++; + client60.ethg++ <--> Eth100M <--> router19.ethg++; + client61.ethg++ <--> Eth100M <--> router19.ethg++; + client62.ethg++ <--> Eth100M <--> router19.ethg++; + client63.ethg++ <--> Eth100M <--> router19.ethg++; + client64.ethg++ <--> Eth100M <--> router19.ethg++; + client65.ethg++ <--> Eth100M <--> router19.ethg++; + client66.ethg++ <--> Eth100M <--> router19.ethg++; + client67.ethg++ <--> Eth100M <--> router19.ethg++; + client68.ethg++ <--> Eth100M <--> router19.ethg++; + client69.ethg++ <--> Eth100M <--> router19.ethg++; + client70.ethg++ <--> Eth100M <--> router19.ethg++; + router11.ethg++ <--> Eth100M <--> router20.ethg++; + router20.ethg++ <--> Eth100M <--> router21.ethg++; + router21.ethg++ <--> Eth100M <--> router22.ethg++; + router22.ethg++ <--> Eth100M <--> router23.ethg++; + router20.ethg++ <--> Eth100M <--> router23.ethg++; + client85.ethg++ <--> Eth100M <--> router23.ethg++; + router20.ethg++ <--> Eth100M <--> client84.ethg++; + client84.ethg++ <--> Eth100M <--> client83.ethg++; + client71.ethg++ <--> Eth100M <--> router20.ethg++; + client93.ethg++ <--> Eth100M <--> router21.ethg++; + router21.ethg++ <--> Eth100M <--> client82.ethg++; + router21.ethg++ <--> Eth100M <--> client92.ethg++; + router21.ethg++ <--> Eth100M <--> client91.ethg++; + client87.ethg++ <--> Eth100M <--> router22.ethg++; + client73.ethg++ <--> Eth100M <--> router22.ethg++; + client88.ethg++ <--> Eth100M <--> router22.ethg++; + client81.ethg++ <--> Eth100M <--> router22.ethg++; + client74.ethg++ <--> Eth100M <--> router22.ethg++; + client86.ethg++ <--> Eth100M <--> router22.ethg++; + client72.ethg++ <--> Eth100M <--> router22.ethg++; + client89.ethg++ <--> Eth100M <--> router22.ethg++; + client76.ethg++ <--> Eth100M <--> router22.ethg++; + client80.ethg++ <--> Eth100M <--> router22.ethg++; + client90.ethg++ <--> Eth100M <--> router22.ethg++; + client96.ethg++ <--> Eth100M <--> router22.ethg++; + client95.ethg++ <--> Eth100M <--> router22.ethg++; + router22.ethg++ <--> Eth100M <--> client94.ethg++; + router22.ethg++ <--> Eth100M <--> client77.ethg++; + router22.ethg++ <--> Eth100M <--> client79.ethg++; + router22.ethg++ <--> Eth100M <--> client97.ethg++; + router22.ethg++ <--> Eth100M <--> client78.ethg++; + router22.ethg++ <--> Eth100M <--> client75.ethg++; + router23.ethg++ <--> Eth100M <--> client99.ethg++; + router23.ethg++ <--> Eth100M <--> client98.ethg++; } From 13d01ccf43222f3c5c087e2c927014e45e359e36 Mon Sep 17 00:00:00 2001 From: Malin Date: Fri, 12 Jan 2024 10:46:47 +0100 Subject: [PATCH 2/4] fix merge bugs --- .../scenarios/mango/mango_cohda_scenario.py | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/cosima_core/scenarios/mango/mango_cohda_scenario.py b/cosima_core/scenarios/mango/mango_cohda_scenario.py index c422a74..e1c8282 100644 --- a/cosima_core/scenarios/mango/mango_cohda_scenario.py +++ b/cosima_core/scenarios/mango/mango_cohda_scenario.py @@ -1,4 +1,3 @@ -import time from copy import deepcopy from os import listdir import pandas as pd @@ -25,17 +24,7 @@ # [3200, 3200, 3200, 3200, 4000], same weight # Target 20 agents DayAhead: # [4000, 4000, 4000, 4000, 4000], same weight -target = ([110, 110, 110, 110, 110], [1, 1, 1, 1, 1, ],) - -s_array = [ - [ - [1, 1, 1, 1, 1], - [4, 3, 3, 3, 3], - [6, 6, 6, 6, 6], - [9, 8, 8, 8, 8], - [11, 11, 11, 11, 11], - ] -] +target = ([20000, 20000, 20000, 20000], [1, 1, 1, 1]) def main(): @@ -46,15 +35,13 @@ def main(): }, } - start = time.time() - scenario_helper = ScenarioHelper() world, communication_simulator, client_attribute_mapping, sim_config = \ scenario_helper.prepare_scenario(sim_config=sim_config) # adapt maximal byte size per msg group, since message get bigger if more agents are involved # TODO: change for other number of agents - cfg.MAX_BYTE_SIZE_PER_MSG_GROUP = 10000 + cfg.MAX_BYTE_SIZE_PER_MSG_GROUP = 30000 filenames = listdir(cfg.CHP_DATA) all_schedule_names = [filename for filename in filenames if filename.startswith("CHP")] @@ -104,7 +91,8 @@ def schedule_provider(i): # is normal participant cohda_roles.append(NegotiationTerminationParticipantRole()) - cohda_roles.append(COHDANegotiationRole(lambda: s_array[0], lambda s: True)) + cohda_roles.append(COHDANegotiationRole(schedules_provider=schedule_provider(idx), + local_acceptable_func=lambda s: True)) cohda_roles.append(CoalitionParticipantRole()) agent_models[current_container_name] = \ @@ -126,8 +114,6 @@ def schedule_provider(i): scenario_helper.run_simulation() scenario_helper.shutdown_simulation() - print('time: ', time.time() - start) - if __name__ == '__main__': main() From a53a47b697a26eeb064f854b7ef319206f1fb4e9 Mon Sep 17 00:00:00 2001 From: Malin Date: Mon, 15 Jan 2024 08:29:18 +0100 Subject: [PATCH 3/4] fix traffic functionality --- .../scenarios/mango/mango_cohda_scenario.py | 20 ++++++++++++++- .../simulators/ict_controller_simulator.py | 1 + .../modules/CosimaScheduler.cc | 14 +++++++++++ .../networks/TrafficNetwork.ned | 25 +++++++++++++++++++ 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/cosima_core/scenarios/mango/mango_cohda_scenario.py b/cosima_core/scenarios/mango/mango_cohda_scenario.py index e1c8282..36d014f 100644 --- a/cosima_core/scenarios/mango/mango_cohda_scenario.py +++ b/cosima_core/scenarios/mango/mango_cohda_scenario.py @@ -14,7 +14,7 @@ import cosima_core.util.general_config as cfg from cosima_core.util.scenario_setup_util import ScenarioHelper from cosima_core.util.util_functions import get_host_names -from scenario_config import NUMBER_OF_AGENTS +from scenario_config import NUMBER_OF_AGENTS, TRAFFIC_CONFIGURATION, USE_COMMUNICATION_SIMULATION codec = JSON() for serializer in cohda_serializers: @@ -33,6 +33,8 @@ def main(): 'ContainerSim': { 'python': 'cosima_core.simulators.mango_example.container_sim:ContainerSimulator', }, + 'ICTController': { + 'python': 'cosima_core.simulators.ict_controller_simulator:ICTController'}, } scenario_helper = ScenarioHelper() @@ -43,6 +45,14 @@ def main(): # TODO: change for other number of agents cfg.MAX_BYTE_SIZE_PER_MSG_GROUP = 30000 + use_ict_simulator = (len(TRAFFIC_CONFIGURATION) > 0 and USE_COMMUNICATION_SIMULATION) + + if use_ict_simulator: + ict_controller = world.start('ICTController', + infrastructure_changes=[], + traffic_configuration=TRAFFIC_CONFIGURATION).ICT() + + filenames = listdir(cfg.CHP_DATA) all_schedule_names = [filename for filename in filenames if filename.startswith("CHP")] all_schedules = {} @@ -108,9 +118,17 @@ def schedule_provider(i): world.connect(agent_models[name], communication_simulator, f'message', weak=True) world.connect(communication_simulator, agent_models[name], client_attribute_mapping[name]) + if use_ict_simulator: + # connect ict controller with communication_simulator + world.connect(ict_controller, communication_simulator, f'ict_message', weak=True) + world.connect(communication_simulator, ict_controller, f'ctrl_message') + # set initial event world.set_initial_event(agent_models['client0'].sid, time=0) + if use_ict_simulator: + world.set_initial_event(ict_controller.sid) + scenario_helper.run_simulation() scenario_helper.shutdown_simulation() diff --git a/cosima_core/simulators/ict_controller_simulator.py b/cosima_core/simulators/ict_controller_simulator.py index e7f0b57..939f4bf 100644 --- a/cosima_core/simulators/ict_controller_simulator.py +++ b/cosima_core/simulators/ict_controller_simulator.py @@ -86,6 +86,7 @@ def get_data(self, outputs): 'sim_time': event['start'], 'source': event['source'], 'destination': event['destination'], + 'start': event['start'], 'stop': event['stop'], 'interval': event['interval'], 'packet_length': event['packet_length'] diff --git a/cosima_omnetpp_project/modules/CosimaScheduler.cc b/cosima_omnetpp_project/modules/CosimaScheduler.cc index 1632fef..1ddbdd0 100644 --- a/cosima_omnetpp_project/modules/CosimaScheduler.cc +++ b/cosima_omnetpp_project/modules/CosimaScheduler.cc @@ -416,6 +416,18 @@ int CosimaScheduler::handleMsgFromCoupledSimulation(std::vector data) { log("Setting logging level to: " + loggingLevelStr, "info"); MAX_BYTE_SIZE_PER_MSG = initialMessage.max_byte_size_per_msg_group(); log("Setting max byte size per message to " + std::to_string(MAX_BYTE_SIZE_PER_MSG)); + + // schedule max advance event + auto maxAdvance = (initialMessage.max_advance() * 1.0)/1000; + schedulerModuleObject->cancelMaxAdvanceEvent(); + schedulerModuleObject->maxAdvEvent->setCtrlType(ControlType::MaxAdvance); + if (maxAdvance >= simTime().dbl()) { + schedulerModuleObject->maxAdvEvent->setArrival(schedulerModule->getId(), -1, maxAdvance); + getSimulation()->getFES()->insert(schedulerModuleObject->maxAdvEvent); + log("CosimaScheduler: max advanced event inserted for time " + std::to_string(maxAdvance) + " at simtime " + simTime().str()); + } else { + log("max advance " + std::to_string(maxAdvance) + " at time " + simTime().str() + " not inserted"); + } } // get info messages @@ -551,6 +563,8 @@ int CosimaScheduler::handleMsgFromCoupledSimulation(std::vector data) { trafficEvent->setArrival(scenarioManagerObject->getId(), -1, arrivalTime); log("CosimaScheduler: traffic event inserted for simtime " + std::to_string(arrivalTime) + " for " + trafficMessage.source() + " to " + trafficMessage.destination() + "."); getSimulation()->getFES()->insert(trafficEvent); + insertedEvent = true; + eventScheduled = true; } for(auto i=0; i < pmsg_group.attack_messages().size(); i++) { diff --git a/cosima_omnetpp_project/networks/TrafficNetwork.ned b/cosima_omnetpp_project/networks/TrafficNetwork.ned index a265871..e96c1cf 100644 --- a/cosima_omnetpp_project/networks/TrafficNetwork.ned +++ b/cosima_omnetpp_project/networks/TrafficNetwork.ned @@ -466,6 +466,26 @@ network TrafficNetwork client99: StandardHost { @display("p=2156.663,2784.9082"); } + traffic_device_5: StandardHost { + @display("p=3436.5957,1561.2365"); + + } + traffic_device_6: StandardHost { + @display("p=3525.6753,1186.1647"); + + } + traffic_device_7: StandardHost { + @display("p=3891.37,1064.2664"); + + } + traffic_device_8: StandardHost { + @display("p=4411.782,1026.7592"); + + } + traffic_device_9: StandardHost { + @display("p=3858.5515,2611.4375"); + + } connections: switch0.ethg++ <--> Eth100M <--> client2.ethg++; switch0.ethg++ <--> Eth100M <--> router0.ethg++; @@ -607,4 +627,9 @@ network TrafficNetwork router22.ethg++ <--> Eth100M <--> client75.ethg++; router23.ethg++ <--> Eth100M <--> client99.ethg++; router23.ethg++ <--> Eth100M <--> client98.ethg++; + traffic_device_9.ethg++ <--> Eth100M <--> router19.ethg++; + traffic_device_5.ethg++ <--> Eth100M <--> router5.ethg++; + traffic_device_7.ethg++ <--> Eth100M <--> router8.ethg++; + traffic_device_8.ethg++ <--> Eth100M <--> router7.ethg++; + traffic_device_6.ethg++ <--> Eth100M <--> router5.ethg++; } From cd563a5ef7cc368842894a89333b8bbc25646ee6 Mon Sep 17 00:00:00 2001 From: Malin Date: Mon, 15 Jan 2024 09:31:47 +0100 Subject: [PATCH 4/4] make target dependent on number of agents --- cosima_core/scenarios/mango/mango_cohda_scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosima_core/scenarios/mango/mango_cohda_scenario.py b/cosima_core/scenarios/mango/mango_cohda_scenario.py index 36d014f..2844706 100644 --- a/cosima_core/scenarios/mango/mango_cohda_scenario.py +++ b/cosima_core/scenarios/mango/mango_cohda_scenario.py @@ -24,7 +24,7 @@ # [3200, 3200, 3200, 3200, 4000], same weight # Target 20 agents DayAhead: # [4000, 4000, 4000, 4000, 4000], same weight -target = ([20000, 20000, 20000, 20000], [1, 1, 1, 1]) +target = ([3200 * NUMBER_OF_AGENTS/20 for _ in range(4)], [1, 1, 1, 1]) def main():