Flowcode 4 Virtual Network Advanced Simulation

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply

Please rate this article out of 5: (1 being the worst and 5 being the best)

1
0
No votes
2
0
No votes
3
0
No votes
4
0
No votes
5
4
100%
 
Total votes: 4

User avatar
Benj
Matrix Staff
Posts: 14837
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Flowcode 4 Virtual Network Advanced Simulation

Post by Benj »

Image

The virtual network simulation or VNet is a new feature in V4.1 of Flowcode. The VNet simulation is designed to allow multiple instances of Flowcode to communicate together whilst simulating to provide functionality similar to what would happen if the chips were running together on a single circuit board or network. This allows multiprocessor systems such as CAN bus systems to be tested in a multi node simulation environment before downloading your programs to the embedded hardware. The VNet functionality currently supports the RS232 and CAN Flowcode components with other components to hopefully follow in the near future.

To start with the VNet first you have to run a special server application on any computer in your network to create a VNet server for your network. This can be started by browsing to your "FlowcodeV4" folder (default is C:\Program Files\Matrix Multimedia\Flowcode V4) and running the executable file located inside the "VNET Server" folder. Each server instance is capable of hosting multiple individual VNet networks so if you want to run the VNet server application on your network server or a dedicated machine then this is possible.

You then need to know the IP address of the server to allow your computer and other computers to talk to the server software. To find out the IP address of your server you can click Start and Run and then type in "cmd" to launch the command prompt window. Once inside the command prompt window type in "ipconfig" to list the IP address assigned to your network card.
pic1.jpg
pic1.jpg (11.93 KiB) Viewed 7164 times
Once you have started the VNet server and you know the IP address of the server, you can click the VNet menu and select VNet Options in Flowcode. Here you should assign the IP address of the VNet server. You should leave the default port number set to 4360 if you have not changed it on the server.
pic2.jpg
pic2.jpg (7.32 KiB) Viewed 7168 times
For every VNet there must be a VNet Owner that initiates group simulations and assigns the connections of the network. The creator of each VNet becomes the Owner of that VNet by default. To create a new VNet you first have to click on the VNet menu and select Create. If your Flowcode instance can successfully connect to the VNet server on the network, you will be presented with a dialog window shown below. You should enter a name for your VNet and a name for your Flowcode instance. It is important that your VNet name is unique on the server and is not already hosted by someone else. Clicking the create button starts up the VNet on the server and makes the VNet available to other Flowcode instances.
pic3.jpg
pic3.jpg (9.88 KiB) Viewed 7160 times
The next step is to expose components on your instance of Flowcode to make them visible over the VNet. To do this click on the VNet menu and select manage nodes. Here you can select which components are visible on the VNet. In this example I have made one of my RS232 components available to the VNet. Note that the components list in this dialog will only show the components that are VNet enabled. Once you finished exposing the nodes available to the VNet you can close the Manage nodes window.
pic4.jpg
pic4.jpg (7.39 KiB) Viewed 7165 times
Now that you have started up a server, created a network and exposed some of the components over the VNet, we can start to join another Flowcode instance nodes to the VNet. In another instance of Flowcode either on the same PC or on a networked PC, set the VNet server߀™s IP address and click VNet and Join. From here you can enter a name for your Flowcode instance and also select the active VNet you wish to join. Make sure that your Flowcode instance is unique or otherwise you will not be able to join the VNet.
pic5.jpg
pic5.jpg (10.54 KiB) Viewed 7163 times
Again you also have to click VNet and Manage Nodes to expose components to the Vnet. Here I have made another RS232 component accessible to the VNet. When you have finished making components accessible you can close the manage nodes window.
pic6.jpg
pic6.jpg (6.74 KiB) Viewed 7161 times
Once all nodes have been established onto the VNet you are ready to start wiring the nodes of available Flowcode instance together. The VNet owner instance can click on VNet and View Diagram to see the nodes currently attached the VNet. The nodes appear at the bottom of the window and can be clicked to be added on to the VNet diagram. Once the Flowcode instances are on the VNet Diagram they can be dragged around and rearranged to allow for more connectivity options. Shown below are the two VNet instances I created which both have RS232 nodes available.
pic7.jpg
pic7.jpg (7.66 KiB) Viewed 7160 times
By clicking on the RS232 node I can draw a line to the other RS232 node. Connection lines can have multiple points and can even branch in multiple directions to allow multiple nodes to be tied together.
pic8.jpg
pic8.jpg (8.27 KiB) Viewed 7163 times
When you have finished editing the VNet connections click the Save button to send the connections information to the VNet Server.

Other Flowcode instances that are part of the VNet can also click the VNet menu and select View Diagram to see the interconnection between the nodes. Note that the connections cannot be edited on them however.

You are now ready to begin shared simulation. If you click the run simulation button in a VNet client Flowcode instance then you will receive this message.
pic9.jpg
pic9.jpg (4.24 KiB) Viewed 7155 times
If you click the run simulation button in a VNet master client Flowcode instance then you will receive this message.
pic10.jpg
pic10.jpg (4.54 KiB) Viewed 7158 times
When every node in the VNet is ready for the group simulation to begin then the VNet owner will receive this message from the VNet Server.
pic11.jpg
pic11.jpg (7.87 KiB) Viewed 7154 times
Clicking Yes will start the simulation on every Flowcode instance connected to the VNet allowing the start up to be synchronised similar to plugging the power into a real life system.

In the examples provided node 1 is constantly polling a keypad. When a key is pressed on the keypad the ASCII value for the key press is sent over the RS232 connection.
pic12.jpg
pic12.jpg (13.68 KiB) Viewed 7156 times
Node 2 simply listens to the RS232 for incoming data, if data is present then it gets printed onto the LCD screen.
pic13.jpg
pic13.jpg (9.46 KiB) Viewed 7155 times
Click here to download the examples
Vnet Functionality.zip
(191.85 KiB) Downloaded 573 times

Dompelpompje
Posts: 8
Joined: Thu Mar 13, 2008 10:57 am
Contact:

Re: Flowcode 4 Virtual Network Advanced Simulation

Post by Dompelpompje »

When a try to open the zip file it gives me a error
not in the the right dir ?
Can some one help me ?

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Contact:

Re: Flowcode 4 Virtual Network Advanced Simulation

Post by Spanish_dude »

Hi,

I got the same error ^^.

Nice feature of the V4, btw !

Rgds,

Nicolas L. F.

User avatar
Benj
Matrix Staff
Posts: 14837
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: Flowcode 4 Virtual Network Advanced Simulation

Post by Benj »

Hello,

I have reloaded the example file and it should now work correctly when you try to download it.

Post Reply