test.gaml 2.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/**
 *  test
 *  Author: Thibaut
 *  Description: 
 */

model test


global {
	
	
	init {
Thibaut Démare's avatar
Thibaut Démare committed
14
		// Clear all previous senders
15 16
		gs_clear_senders;
		
Thibaut Démare's avatar
Thibaut Démare committed
17 18
		// Add a new sender on localhost:2001
		gs_add_sender gs_host:"localhost" gs_port:2001 gs_sender_id:"test1";
19 20
		
		// Create three nodes
Thibaut Démare's avatar
Thibaut Démare committed
21 22 23
		gs_add_node gs_sender_id:"test1" gs_node_id:"node1";
		gs_add_node gs_sender_id:"test1" gs_node_id:"node2";
		gs_add_node gs_sender_id:"test1" gs_node_id:"node3";
24
		
Thibaut Démare's avatar
Thibaut Démare committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
		// Create one directed edge and one undirected edge
		gs_add_edge gs_sender_id:"test1" gs_edge_id:"edge1" gs_node_id_from:"node1" gs_node_id_to:"node2" gs_is_directed:true;
		gs_add_edge gs_sender_id:"test1" gs_edge_id:"edge2" gs_node_id_from:"node2" gs_node_id_to:"node3" gs_is_directed:false;
		
		
		// Add attributes on edge
			// A string attribute
		gs_add_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"string" gs_attribute_value:"a string value";
			// A double attribute
		gs_add_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"double" gs_attribute_value:10.0;
			// An integer attribute
		gs_add_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"integer" gs_attribute_value:1;
			// A boolean attribute
		gs_add_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"boolean" gs_attribute_value:true;
			// A list attribute
		//gs_add_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"list" gs_attribute_value:["one","two","three"];
		
		// Step
Thibaut Démare's avatar
Thibaut Démare committed
43
		gs_step gs_sender_id:"test1" gs_step_number:1;
Thibaut Démare's avatar
Thibaut Démare committed
44 45
		
		// Clear
Thibaut Démare's avatar
Thibaut Démare committed
46 47 48 49 50 51 52
		gs_clear gs_sender_id:"test1";
		
		// Close
		gs_close gs_sender_id:"test1";
		
		// If the previous command has worked, the next one should work too
		gs_add_sender gs_host:"localhost" gs_port:2001 gs_sender_id:"test1";
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
	}
}

species Provider {
	
	
	aspect base { 
		draw square(1.5°km) color: rgb([100, 0, 100]) ;
	} 
}

experiment test_gs_extension type: gui {
	output {
		display display_FinalDestinationManager {
			species Provider aspect: base;
		}
	}
}