diff --git a/MAC_use_cases/Model/MAC_use_casesEM.cs b/MAC_use_cases/Model/MAC_use_casesEM.cs index 20220bf..12d5192 100644 --- a/MAC_use_cases/Model/MAC_use_casesEM.cs +++ b/MAC_use_cases/Model/MAC_use_casesEM.cs @@ -117,7 +117,7 @@ public override bool GenerateTiaPortal(TiaTemplateContext tiaTemplateContext, st var s120 = HardwareGeneration.GenerateS120(this, "S120MACTest", "S120DeviceTest", "this drive is generated with MAC"); var s210 = HardwareGeneration.GenerateS210(this, "S210MACTest", "S210DeviceTest", "this drive is generated with MAC"); - var subnet1 = HardwareGeneration.GetOrCreateSubnet(SubnetsManager, "NewSubnet1"); + var subnet1 = HardwareGeneration.GetOrCreateSubnet(SubnetsManager, "PN/IE_1"); HardwareGeneration.ConnectDriveToSubnet(s120, subnet1, this); HardwareGeneration.ConnectDriveToSubnet(s210, subnet1, this); diff --git a/MAC_use_cases/Model/UseCases/HardwareGeneration.cs b/MAC_use_cases/Model/UseCases/HardwareGeneration.cs index 00cfbcd..f30a131 100644 --- a/MAC_use_cases/Model/UseCases/HardwareGeneration.cs +++ b/MAC_use_cases/Model/UseCases/HardwareGeneration.cs @@ -119,20 +119,18 @@ public static void ConnectDriveToSubnet(ProfiDriveObjectInfo drive, ISubnetInfo var plcNwItf = module.ParentDeviceAsHardwareInfo.ControllerProfinetInterfaces.First(); plcNwItf.ConnectedSubnetInfo = subnet; + var ioSystem = plcNwItf.ConnectedSubnetInfo.GetOrCreateIoSystem(plcNwItf, "PROFINET IO-System"); + if (device.GetType() == typeof(S120PNDriveInfo)) { (device as S120PNDriveInfo).ProfinetInterface.ConnectedSubnetInfo = subnet; - var ioSystem = plcNwItf.ConnectedSubnetInfo.GetOrCreateIoSystem(plcNwItf, "NewIoSystem"); ioSystem.ConnectIoDevice((device as S120PNDriveInfo).ProfinetInterface.IoConnectors.First().Value); - plcNwItf.Ports.First().Connect((device as S120PNDriveInfo).ProfinetInterface.Ports.First()); } if (device.GetType() == typeof(S210DriveInfo)) { (device as S210DriveInfo).ProfinetInterface.ConnectedSubnetInfo = subnet; - var ioSystem = plcNwItf.ConnectedSubnetInfo.GetOrCreateIoSystem(plcNwItf, "NewIoSystem"); ioSystem.ConnectIoDevice((device as S210DriveInfo).ProfinetInterface.IoConnectors.First().Value); - plcNwItf.Ports.First().Connect((device as S210DriveInfo).ProfinetInterface.Ports.First()); }