Coverage for wsimod\nodes\waste.py: 91%

11 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-10-30 14:52 +0000

1# -*- coding: utf-8 -*- 

2"""Created on Mon Nov 15 14:20:36 2021. 

3 

4@author: bdobson 

5""" 

6from wsimod.nodes.nodes import Node 

7 

8 

9# TODO call this outlet not waste 

10class Waste(Node): 

11 """""" 

12 

13 def __init__(self, name): 

14 """Outlet node that can receive any amount of water by pushes. 

15 

16 Args: 

17 name (str): Node name 

18 

19 Functions intended to call in orchestration: 

20 None 

21 

22 Key assumptions: 

23 - Water 'disappears' (leaves the model) from these nodes. 

24 

25 Input data and parameter requirements: 

26 - None 

27 """ 

28 # Update args 

29 super().__init__(name) 

30 

31 # Update handlers 

32 self.pull_set_handler["default"] = self.pull_set_deny 

33 self.pull_check_handler["default"] = self.pull_check_deny 

34 self.push_set_handler["default"] = self.push_set_accept 

35 self.push_check_handler["default"] = self.push_check_accept 

36 

37 # Mass balance 

38 self.mass_balance_out.append(self.total_in) 

39 

40 def push_set_accept(self, vqip): 

41 """Push set function that accepts all water. 

42 

43 Args: 

44 vqip (dict): A VQIP that has been pushed (ignored) 

45 

46 Returns: 

47 (dict): An empty VQIP, indicating all water was received 

48 """ 

49 return self.empty_vqip()