Skip to content

Commit

Permalink
fix: subnet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
dssAutomation committed Dec 13, 2024
1 parent 39684bd commit 5e4c5cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MAC_use_cases/Model/MAC_use_casesEM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions MAC_use_cases/Model/UseCases/HardwareGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit 5e4c5cb

Please sign in to comment.