To simulate Bus-Star Hybrid Topology in MATLAB has series of steps that integrates the contexts of both bus and star topologies. In this topology, multiple star-configured subnetworks associate to a central bus, enabling for efficient, centralized interaction and a flexibility structure. Each star subnetwork has contains of a central hub (star hub) which associates multiple nodes, since the central bus links to each star hub.
The following are the detailed guide to approach this process.
Steps to Simulate a Bus-Star Hybrid Topology in MATLAB
- Define the Network Structure
- Abode nodes in clusters, in which each cluster generates a star topology with a central star hub.
- Associate each star hub to a central bus that creates the hybrid structure.
- Establish Connections Based on Topology
- Link nodes in each cluster to their corresponding star hub.
- Associate each star hub to the central bus.
- Simulate Data Transmission
- Execute data transmission inside each star and via the bus to other star clusters.
- Utilize multi-hop routing if data must transmit from one star cluster to another.
- Visualize the Topology
- Visualize nodes, hubs, and the central bus to demonstrate the hybrid structure.
- Evaluate Performance Metrics
- Evaluate the parameters like total data routed, delay, or packet success rate.
Example MATLAB Code for Simulating a Bus-Star Hybrid Topology
Here is a MATLAB script to replicate a bus-star hybrid topology with multiple star clusters associated to a central bus.
% Parameters
numStars = 3; % Number of star networks (clusters)
nodesPerStar = 4; % Number of nodes per star network (excluding the star hub)
starRadius = 10; % Radius for placing nodes within each star network
busLength = 50; % Length of the central bus
busYPosition = 25; % Y position for the central bus
starSpacing = 20; % Horizontal spacing between star hubs along the bus
transmissionDelay = 0.5; % Delay per transmission (in seconds)
dataPackets = randi([10, 30], numStars, nodesPerStar); % Data packets each node sends to its hub
% Define positions for star hubs along the central bus
starHubPositions = [linspace(10, busLength – 10, numStars)’, repmat(busYPosition, numStars, 1)];
% Define positions for nodes within each star network
starNodePositions = cell(numStars, 1); % Cell array to store positions of nodes in each star
theta = linspace(0, 2*pi, nodesPerStar + 1);
theta(end) = []; % Remove last element to avoid overlap
% Plot the Bus-Star Hybrid Topology
figure;
hold on;
% Plot the central bus
plot([0, busLength], [busYPosition, busYPosition], ‘k-‘, ‘LineWidth’, 2, ‘DisplayName’, ‘Central Bus’);
% Plot each star network
for s = 1:numStars
% Plot the star hub on the bus
plot(starHubPositions(s,1), starHubPositions(s,2), ‘ro’, ‘MarkerSize’, 10, ‘DisplayName’, [‘Star Hub ‘, num2str(s)]);
% Generate positions for nodes around the star hub
starNodePositions{s} = [starRadius * cos(theta)’ + starHubPositions(s,1), …
starRadius * sin(theta)’ + starHubPositions(s,2)];
% Plot each node and its connection to the star hub
for n = 1:nodesPerStar
plot(starNodePositions{s}(n,1), starNodePositions{s}(n,2), ‘bo’, ‘MarkerSize’, 8, ‘DisplayName’, [‘Node ‘, num2str(n), ‘ in Star ‘, num2str(s)]);
plot([starHubPositions(s,1), starNodePositions{s}(n,1)], [starHubPositions(s,2), starNodePositions{s}(n,2)], ‘k–‘);
end
end
title(‘Bus-Star Hybrid Topology’);
xlabel(‘X Position’);
ylabel(‘Y Position’);
grid on;
axis equal;
hold off;
% Step 1: Simulate Intra-Star Data Transmission
disp(‘Intra-Star Data Transmission Simulation:’);
for s = 1:numStars
for n = 1:nodesPerStar
fprintf(‘Node %d in Star %d sends %d packets to Star Hub %d…\n’, n, s, dataPackets(s, n), s);
pause(transmissionDelay); % Simulate transmission delay
fprintf(‘Star Hub %d received data from Node %d in Star %d\n’, s, n, s);
end
end
% Step 2: Simulate Inter-Star Data Transmission via Central Bus
disp(‘Inter-Star Data Transmission Simulation:’);
for s = 1:numStars
for other_s = 1:numStars
if s ~= other_s
fprintf(‘Star Hub %d sends data to Star Hub %d via the Central Bus…\n’, s, other_s);
pause(transmissionDelay); % Simulate transmission delay
fprintf(‘Star Hub %d received data from Star Hub %d\n’, other_s, s);
end
end
end
% Display Network Metrics (Example: Total Data Transmitted)
totalDataTransmitted = sum(dataPackets(:));
disp([‘Total data transmitted within the network: ‘, num2str(totalDataTransmitted), ‘ packets’]);
Explanation of Code
- Node Positioning and Topology Setup:
- The central bus is a horizontal line besides the busYPosition.
- Star hubs are placed at regularly spaced points beside the bus (starHubPositions), and nodes inside an each star are organised in a circular manner around their relevant star hub.
- Topology Visualization:
- Every node is denoted as a blue circle, star hubs are red circles, and the central bus is a thick black line.
- Connections among each node and its hub are dashed lines, since the bus is denoted by way of a solid line.
- Data Transmission Simulation:
- Intra-Star Transmission: Each node in a star sends data to its corresponding hub.
- Inter-Star Transmission via Bus: Each hub interact with other hubs through the central bus replicating data flow among diverse star networks.
- Network Metrics Calculation:
- The amount data routed inside the network by all nodes is estimated and demonstrated.
Extensions and Variations
- Bidirectional Communication:
- Execute bidirectional data transmission inside and among star networks.
- Variable Transmission Delays:
- Add random latency for bus and star communications to replicate realistic network conditions.
- Measure Additional Performance Metrics:
- Measure packet success rates, end-to-end delay, and total throughput for a comprehensive evaluation.
- Simulate Node and Hub Failures:
- Establish the likelihood of node or hub failures and measure on how the network modifies to sustain connectivity.
Visualization of Data Transmission Metrics
We can plot the amount of packets every star hub collects from its nodes to demonstrate intra-star communication.
% Plot the number of packets each star hub receives
figure;
bar(1:numStars, sum(dataPackets, 2));
title(‘Data Packets Received by Each Star Hub’);
xlabel(‘Star Hub Index’);
ylabel(‘Packets Received’);
grid on;
Advanced Simulation Scenarios
- Traffic Load and Congestion Analysis:
- Upsurge the data traffic in certain star clusters to evaluate on how congestion impacts transmission via the bus.
- Dynamic Topology Changes:
- Enable nodes to transmit within each cluster or replicate to totalling/eliminating nodes to learn the effects on network performance.
- Implement QoS Routing:
- Execute Quality of Service (QoS) to select certain data flows via the bus or in star networks.
In this demonstration we clearly learned and gain knowledge on how the Bus-Star Hybrid Topology projects will perform in the network simulation environment using the tool of MATLAB and also we deliver the sample snippets to complete the process. More details regarding this process will also be shared.
We specialize in Bus Star Hybrid Topology Projects utilizing MATLAB tools, offering you innovative services customized to your requirements from the talented developers at phdprime.com. Our expertise in bus and star topologies ensures that your project is executed flawlessly, delivering exceptional performance tailored just for you.