-
Notifications
You must be signed in to change notification settings - Fork 8
add common symmetric roll passes base class #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
769b6c6
add common symmetric roll passes base class
axtimhaus 0d621e5
fix rebase mistakes
axtimhaus 1665bc3
fix calculation of roll surface velocity
ChRen95 eb36cef
fix test and in_profile angles
ChRen95 f092f8a
fixed test
ChRen95 71bf614
fix test
ChRen95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| from .base import BaseRollPass | ||
| from .roll_pass import RollPass | ||
| from .two_roll_pass import TwoRollPass | ||
| from .three_roll_pass import ThreeRollPass | ||
| from .deformation_unit import DeformationUnit | ||
|
|
||
| from . import hookimpls | ||
|
|
||
| RollPass = TwoRollPass | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| from shapely import difference, line_merge, MultiLineString | ||
|
|
||
| from ..base import BaseRollPass | ||
| from ...config import Config | ||
| from ...rotator import Rotator | ||
|
|
||
|
|
||
| @BaseRollPass.rotation | ||
| def auto_rotation(self: BaseRollPass): | ||
| return Config.ROLL_PASS_AUTO_ROTATION | ||
|
|
||
|
|
||
| @BaseRollPass.rotation | ||
| def detect_already_rotated(self: BaseRollPass): | ||
| if Config.ROLL_PASS_AUTO_ROTATION and self.parent is not None: | ||
| try: | ||
| prev = self.prev | ||
| except IndexError: | ||
| return True | ||
|
|
||
| while True: | ||
| if isinstance(prev, BaseRollPass): | ||
| return True | ||
| if isinstance(prev, Rotator): | ||
| return False | ||
| try: | ||
| prev = prev.prev | ||
| except IndexError: | ||
| return True | ||
|
|
||
|
|
||
| @BaseRollPass.orientation | ||
| def default_orientation(self: BaseRollPass): | ||
| return 0 | ||
|
|
||
|
|
||
| @BaseRollPass.volume | ||
| def volume(self: BaseRollPass): | ||
| return (self.in_profile.cross_section.area + 2 * self.out_profile.cross_section.area | ||
| ) / 3 * self.length | ||
|
|
||
|
|
||
| @BaseRollPass.surface_area | ||
| def surface_area(self: BaseRollPass): | ||
| return (self.in_profile.cross_section.perimeter + 2 * self.out_profile.cross_section.perimeter | ||
| ) / 3 * self.length | ||
|
|
||
|
|
||
| @BaseRollPass.duration | ||
| def duration(self: BaseRollPass): | ||
| return self.length / self.velocity | ||
|
|
||
|
|
||
| @BaseRollPass.length | ||
| def length(self: BaseRollPass): | ||
| return -self.entry_point + self.exit_point | ||
|
|
||
|
|
||
| @BaseRollPass.displaced_cross_section | ||
| def displaced_cross_section(self: BaseRollPass): | ||
| return difference(self.in_profile.cross_section, self.usable_cross_section) | ||
|
|
||
|
|
||
| @BaseRollPass.reappearing_cross_section | ||
| def reappearing_cross_section(self: BaseRollPass): | ||
| return difference(self.out_profile.cross_section, self.in_profile.cross_section) | ||
|
|
||
|
|
||
| @BaseRollPass.elongation_efficiency | ||
| def elongation_efficiency(self: BaseRollPass): | ||
| return 1 - self.reappearing_cross_section.area / self.displaced_cross_section.area | ||
|
|
||
|
|
||
| @BaseRollPass.target_filling_ratio(trylast=True) | ||
| def default_target_filling(self: BaseRollPass): | ||
| return 1 | ||
|
|
||
|
|
||
| @BaseRollPass.target_width | ||
| def target_width_from_target_filling_ratio(self: BaseRollPass): | ||
| if self.has_value("target_filling_ratio"): | ||
| return self.target_filling_ratio * self.usable_width | ||
|
|
||
|
|
||
| @BaseRollPass.target_filling_ratio | ||
| def target_filling_ratio_from_target_width(self: BaseRollPass): | ||
| if self.has_set_or_cached("target_width"): | ||
| return self.target_width / self.usable_width | ||
|
|
||
|
|
||
| @BaseRollPass.target_cross_section_area | ||
| def target_cross_section_area_from_target_cross_section_filling_ratio(self: BaseRollPass): | ||
| if self.has_set_or_cached("target_cross_section_filling_ratio"): | ||
| return self.target_cross_section_filling_ratio * self.usable_cross_section.area | ||
|
|
||
|
|
||
| @BaseRollPass.target_cross_section_filling_ratio | ||
| def target_cross_section_filling_ratio_from_target_cross_section_area(self: BaseRollPass): | ||
| if self.has_value("target_cross_section_area"): # important has_value for computing from target_width | ||
| return self.target_cross_section_area / self.usable_cross_section.area | ||
|
|
||
|
|
||
| @BaseRollPass.exit_point | ||
| def exit_point(self: BaseRollPass): | ||
| return 0 | ||
|
|
||
|
|
||
| @BaseRollPass.Profile.contact_lines | ||
| def contact_contour_lines(self: BaseRollPass.Profile): | ||
| rp = self.roll_pass | ||
| contact_contur_lines_possible_multilinestring = [cl.intersection(self.cross_section.exterior.buffer(1e-9)) for cl in rp.contour_lines] | ||
|
|
||
| contact_contour_lines_linestring = [] | ||
| for ccl in contact_contur_lines_possible_multilinestring: | ||
| if isinstance(ccl, MultiLineString): | ||
| merged_ccl = line_merge(ccl) | ||
| contact_contour_lines_linestring.append(merged_ccl) | ||
| else: | ||
| contact_contour_lines_linestring.append(ccl) | ||
|
|
||
| return contact_contour_lines_linestring | ||
|
|
||
|
|
||
| @BaseRollPass.front_tension | ||
| def default_front_tension(self: BaseRollPass): | ||
| return 0 | ||
|
|
||
|
|
||
| @BaseRollPass.back_tension | ||
| def default_back_tension(self: BaseRollPass): | ||
| return 0 | ||
|
|
||
|
|
||
| @BaseRollPass.technologically_orientated_contour_lines | ||
| def technologically_correctly_orientated_contour_lines(self: BaseRollPass): | ||
| return MultiLineString([self._get_oriented_geom(cl) for cl in self.contour_lines]) | ||
|
|
||
|
|
||
| @BaseRollPass.OutProfile.technologically_orientated_cross_section | ||
| def technologically_correctly_orientated_cross_section(self: BaseRollPass.OutProfile): | ||
| return self.roll_pass._get_oriented_geom(self.cross_section, orientation=self.roll_pass.orientation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the entry, resp. exit angles?