Simulink - SimEvents - how to design a simulation and how to remember variables - a beginner asks for help&hints
2 views (last 30 days)
I'm a complete beginner in MATLAB. I'll have to make a simulation of routing in Wireless Sensor Network, and I have a tons of questions... I'd be very grateful if anyone can shed a light on my darkness.
Background: I'll have to simulate routing of packets between X number of sensor nodes. I have a known mechanism, which will do some processing in every node and every node should learn something from data packets which will be forwarded and received from the base station. This learned knowledge shuld be stored in nodes in form of tables. Latencies, load balance, fairnes, MAC and physical level will not be modelled.
What is already clear to me: I will have to model a node in Simulink with SimEvents library. Then I'll multiply this nodes to create a networkwith modeled links between them. Some of those nodes will be slightly different (base station or corrupted nodes)
1. Is my approach with modelling a node, multiplying and connecting them OK? Would anyone take some other approach?
2. Is it possible to create a model in Simulink and then add some kind of initializaton procedure before the simulation of a model is run? I would use this init procedure to set the locations of sensor nodes, because they need to know distances among them. I guess this init procedure would be writen in Matlab script.
3. How can I store some data into tables inside every node? Haw can this be done?
4. How can I put some code inside nodes? This code should execute routing data packets from source node to base station, learn according to my known mechanism and save "knowledge" in nodes.
Thanks a lot in advance Robert
Ryan G on 12 Apr 2013
Edited: Ryan G on 12 Apr 2013
1) What do you mean by multiplying and connecting? Do you mean copying to create multiple nodes, like with a library?
3) You can define table data in the matlab workspace and use the parameter defined in the workspace inside your model
4) SimEvents has an attribute function block that allows you to use MATLAB code with SimEvents attributes.
Sounds like you are just getting started. I think you'll be able to ask some more defined questions once you start developing and finding the points where you get stuck.