File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
2929help :
3030 @python -c " $$ PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST )
3131
32+ bump :
33+ bumpversion minor
34+
35+
36+
3237clean : clean-build clean-pyc clean-test # # remove all build, test, coverage and Python artifacts
3338
3439clean-build : # # remove build artifacts
Original file line number Diff line number Diff line change @@ -266,6 +266,23 @@ def get_current_time(self):
266266
267267 return metadata [method ]
268268
269+ def get_time_step (self ):
270+ """
271+ Return time step of simulation
272+ """
273+
274+ method = "get_time_step"
275+
276+ A = None
277+ metadata = {method : - 1 }
278+
279+ send_array (self .socket , A , metadata )
280+ A , metadata = recv_array (
281+ self .socket , poll = self .poll , poll_timeout = self .poll_timeout ,
282+ flags = self .zmq_flags )
283+
284+ return metadata [method ]
285+
269286 def update (self , dt ):
270287 """
271288 Advance the module with timestep dt
@@ -312,5 +329,7 @@ def remote(self, action):
312329 return metadata [method ]
313330
314331 def subscribe (self , topic = b'' ):
315- """subscribe to the SUB socket, to listen for incomming variables"""
332+ """subscribe to the SUB socket, to listen for incomming variables, return a stream that can be listened to. """
316333 self .sockets [zmq .SUB ].setsockopt (zmq .SUBSCRIBE , topic )
334+ poller = self .pollers [zmq .SUB ]
335+ return poller
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ def __init__(
3535 mpi = False ,
3636 port = 'random' ,
3737 bmi_class = 'bmi.wrapper.BMIWrapper' ,
38+ pause = False ,
3839 * args ,
3940 ** kwargs
4041 ):
@@ -59,6 +60,8 @@ def __init__(
5960 self .sockets = self .create_sockets ()
6061
6162 self .model = self .create_bmi_model (engine , bmi_class )
63+ if pause :
64+ self .model .state = 'pause'
6265 self .metadata = {}
6366 self .fill_metadata ()
6467
@@ -366,6 +369,7 @@ def create_sockets(self):
366369
367370 poller .register (rep , zmq .POLLIN )
368371 poller .register (pull , zmq .POLLIN )
372+
369373 sockets = dict (
370374 poller = poller ,
371375 rep = rep ,
You can’t perform that action at this time.
0 commit comments