Changeset 2688
- Timestamp:
- 01/13/12 00:33:29 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
simo/trunk/simulator/models/operation/harvestop.py
r2596 r2688 765 765 bmassortmentlabel) 766 766 767 # pulp price 768 for row in pricematrix: 769 if row[0]==pulplabel: 770 pulp_price=row[-1] 771 break 772 else: 773 continue 774 767 775 # Do the tree level log reduction for each of the assortments 768 776 if self.hdata.cdata['log_reduction_type'] in (1,3): 769 777 timber = self._log_reduction(timber, sp, pulplabel, 770 bmassortmentlabel, log_reduction )778 bmassortmentlabel, log_reduction, pulp_price) 771 779 # Do the regional log reduction for each of the assortments 772 780 if self.hdata.cdata['log_reduction_type'] in (2,3): 773 timber = self._regional_log_reduction(timber, sp, pulplabel )781 timber = self._regional_log_reduction(timber, sp, pulplabel, pulp_price) 774 782 775 783 return stemvol … … 989 997 return hs 990 998 991 def _log_reduction(self, timber, species, pulplabel, bmassortmentlabel, log_reduction ):999 def _log_reduction(self, timber, species, pulplabel, bmassortmentlabel, log_reduction, pulp_price): 992 1000 """ 993 1001 reduce the bucked volume and value of logs with a given reduction … … 995 1003 volumered = 0.0 # total volume removed from log assortments 996 1004 redp = log_reduction 997 totprice = 0.0998 totvol = 0.0999 1005 for assortment, values in timber.iteritems(): 1000 1006 # reduce the volume only if not pulp or biomass assortment … … 1004 1010 values[0] *= redp # reduce the volume by percentage 1005 1011 values[1] *= redp # reduce the value by percentage 1006 totprice += values[1]1007 totvol += values[0]1008 1012 if volumered > EPSILON and timber[pulplabel][0] > 0: 1009 1013 increase = 1 + volumered / timber[pulplabel][0] … … 1012 1016 elif volumered > EPSILON: 1013 1017 timber[pulplabel][0] = volumered 1014 timber[pulplabel][1] = totprice / totvol1018 timber[pulplabel][1] = volumered*pulp_price 1015 1019 return timber 1016 1020 1017 def _regional_log_reduction(self, timber, species, pulplabel ):1021 def _regional_log_reduction(self, timber, species, pulplabel, pulp_price): 1018 1022 """ 1019 1023 reduce the bucked volume and value of logs with a given reduction … … 1023 1027 log_assortment_count = 0 # counts number of log assortments 1024 1028 redp = self.hdata.cdata['regional_log_reduction'] 1025 totprice = 0.01026 totvol = 0.01027 1029 if redp <= 1: 1028 1030 for assortment, values in timber.iteritems(): … … 1032 1034 values[0] *= redp # reduce the volume by percentage 1033 1035 values[1] *= redp # reduce the value by percentage 1034 totprice += values[1]1035 totvol += values[0]1036 1036 #increase pulp volume 1037 1037 if volumered > EPSILON and timber[pulplabel][0] > 0: … … 1041 1041 elif volumered > EPSILON: 1042 1042 timber[pulplabel][0] = volumered 1043 if totvol > 0: 1044 timber[pulplabel][1] = totprice / totvol 1045 else: 1046 timber[pulplabel][1] = 0.0 1043 timber[pulplabel][1] = volumered*pulp_price 1047 1044 else: # redp > 1, ie. add log volume and reduce pulp volume 1048 1045 for assortment, values in timber.iteritems(): … … 1066 1063 values[0] *= redp_pulp # reduce the volume by % 1067 1064 values[1] *= redp_pulp # reduce the value by % 1068 totprice += values[1]1069 totvol += values[0]1070 1065 #increase log volume 1071 1066 if volumered > EPSILON:
Note: See TracChangeset
for help on using the changeset viewer.
