Skip to content
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

Run vehicle on a given range #53

Open
scote89 opened this issue Oct 19, 2023 · 1 comment
Open

Run vehicle on a given range #53

scote89 opened this issue Oct 19, 2023 · 1 comment

Comments

@scote89
Copy link

scote89 commented Oct 19, 2023

https://github.com/ccaprani/pycba/blob/283df18832e610f59461e0866719c4e614bb6ff6/src/pycba/bridge.py#L211C10-L211C10

How easy would it be to implement setting a range of motion the vehicle is allowed to move? This is particularly useful in a transverse deck bridge analyses where the vehicle can only move within the lanes.

Regards

@scote89
Copy link
Author

scote89 commented Nov 23, 2023

Could we implement something like this? (sorry for not being able to implement the code myself)

`
def run_vehicle(
self, step: float, plot_env: bool = False, plot_all: bool = False, fist_axle_start_pos: float=0,fist_axle_end_pos: float=0
):

    self._check_objects()
    self.pos = []
    self.vResults = []
    npts = round((self.ba.beam.length + self.veh.L) / step) + 1

    if fist_axle_end_pos==0:
        fist_axle_end_pos=(self.ba.beam.length + self.veh.L)

    if plot_all:
        fig, axs = plt.subplots(2, 1, sharex=True)

    for i in range(npts):
        # load position
        pos = i * step
        if (pos>=fist_axle_start_pos and pos<=fist_axle_end_pos):
            self.pos.append(pos)
            out = self._single_analysis(pos)
            if out != 0:
                raise ValueError("Bridge analysis did not succeed at {pos=}")
                return
            if plot_all:
                self.plot_static(pos, axs)
                plt.pause(0.01)
            self.vResults.append(self.ba.beam_results)

    env = Envelopes(self.vResults)

    if plot_env:
        self.plot_envelopes(env)

    return env

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant