pycba icon indicating copy to clipboard operation
pycba copied to clipboard

Run vehicle on a given range

Open scote89 opened this issue 2 years ago • 1 comments

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 avatar Oct 19 '23 20:10 scote89

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

`

scote89 avatar Nov 23 '23 14:11 scote89