Browse Source

Fixed PM2DEVS, still need valid distributions

Yentl Van Tendeloo 7 years ago
parent
commit
809f3d15e3

+ 1 - 1
models/WSC/PM_to_DEVS.mvc

@@ -353,7 +353,7 @@ Composite schedule {
                     $
                     $
                 value_parameters = $
                 value_parameters = $
                     String function value(model : Element, name : String, mapping : Element):
                     String function value(model : Element, name : String, mapping : Element):
-                        return "[" + cast_string(set_len(allIncomingAssociationInstances(model, name, "PM/Next"))) + "]"!
+                        return "[" + cast_string(set_len(allIncomingAssociationInstances(model, mapping["0"], "PM/Next"))) + "]"!
                     $
                     $
             }
             }
             Post_Trace (post_sync_0, post_sync_1) {
             Post_Trace (post_sync_0, post_sync_1) {

+ 3 - 1
models/WSC/experiment_example.mvc

@@ -8,6 +8,7 @@ def simulate(nresources, seed):
     model = Root('root', [nresources])
     model = Root('root', [nresources])
     sim = Simulator(model)
     sim = Simulator(model)
     sim.setClassicDEVS()
     sim.setClassicDEVS()
+    sim.setVerbose()
     sim.simulate()
     sim.simulate()
     return model.submodels['finish'].state
     return model.submodels['finish'].state
 
 
@@ -16,7 +17,8 @@ def main():
     for i in range(1, 3):
     for i in range(1, 3):
         results = results + str(i)
         results = results + str(i)
         for v in range(1, 3):
         for v in range(1, 3):
-            results = results + ' ' + simulate(i, v)
+            results = results + ' ' + str(simulate(i, v))
+            print(results)
         results = results + '\\n'
         results = results + '\\n'
     print('Result: ' + results)
     print('Result: ' + results)
     return results
     return results

+ 6 - 6
models/WSC/pm_example.mvc

@@ -3,14 +3,14 @@ Initial init {
 }
 }
 Activity req {
 Activity req {
     name = "define_requirements"
     name = "define_requirements"
-    distribution = "lambda iteration: iteration"
+    distribution = "lambda iteration: iteration + 1"
 }
 }
 SimpleMerge merge {
 SimpleMerge merge {
     name = "merge_0"
     name = "merge_0"
 }
 }
 Activity model {
 Activity model {
     name = "model_system"
     name = "model_system"
-    distribution = "lambda iteration: iteration"
+    distribution = "lambda iteration: iteration + 1"
 }
 }
 ParallelSplit split {
 ParallelSplit split {
     name = "split_0"
     name = "split_0"
@@ -18,22 +18,22 @@ ParallelSplit split {
 MultiInstance simulate {
 MultiInstance simulate {
     name = "simulate"
     name = "simulate"
     nr_instances = 10
     nr_instances = 10
-    distribution = "lambda iteration: iteration"
+    distribution = "lambda iteration: iteration + 1"
 }
 }
 Activity check {
 Activity check {
     name = "check"
     name = "check"
-    distribution = "lambda iteration: iteration"
+    distribution = "lambda iteration: iteration + 1"
 }
 }
 Synchronization sync {
 Synchronization sync {
     name = "sync_0"
     name = "sync_0"
 }
 }
 Activity evaluate {
 Activity evaluate {
     name = "evaluate"
     name = "evaluate"
-    distribution = "lambda iteration: iteration"
+    distribution = "lambda iteration: iteration + 1"
 }
 }
 ExclusiveChoice choice {
 ExclusiveChoice choice {
     name = "xor_0"
     name = "xor_0"
-    distribution = "lambda iteration: 1 - 1/iteration"
+    distribution = "lambda iteration: 1 - 1/(iteration+1)"
 }
 }
 Finish finish {
 Finish finish {
     name = "finish"
     name = "finish"

+ 1 - 2
services/DEVS_batch/main.py

@@ -15,8 +15,7 @@ def pypdevs_service(port):
         f.write(experiment)
         f.write(experiment)
 
 
     main = getattr(__import__(model_name), "main")
     main = getattr(__import__(model_name), "main")
-    for i in main():
-        service_set(port, i)
+    service_set(port, main())
 try:
 try:
     init(sys.argv[1])
     init(sys.argv[1])
     login("pypdevs_batch_service", "my_password")
     login("pypdevs_batch_service", "my_password")

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue May 15 15:50:20 2018
+Date:   Tue May 15 16:13:15 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server