Lateley I have been experimenting with multi phase trajectories. I am modelling a racing car that drives a lap around a circuit, similar to the racing car example in the docs. I am splitting the lap up into two parts to be able to force the car to keep accelerating after the final corner. Let's call the first phase A and the second B. I need the end of A to be matched to the start of B. This works without issues. However, I also need the end of B to be matched to the start of A to ensure the lap is repeatable (i.e. the car doesn't start with a ridiculously high speed and starts and ends at the same position on track). This final linkage constraint seems impossible to enforce together with the first one.
Example
Phase B (or phase1) is a duplicate of my 'normal' phase.
phase1 = phase.duplicate(transcription=dm.Radau(num_segments=15, order=6, compressed=True))
traj.add_phase('phase1',phase1)
# Link the two parts of the lap together
traj.link_phases(phases=['phase0', 'phase1'],
vars=['u','v','t','I_FC','SoC','n','xi','U_bus'])
# Link the states at the start and end of the phase in order to ensure a continous lap
traj.link_phases(phases=['phase1','phase0'], vars = ['u','v','r','n','I_FC'],
locs=['final','initial'])
When I use this code the latter linkage constraints are not used (except for the variables that are 'new' in this case 'r') and their residuals do not show up when the results are printed either. So to me it seems like I can only define one linkage between these two phases. This might be expected behaviour, but as one phase is able to be linked to itself I assumed two phases could be linked to eachother multiple times (at different ends).
Also I can't use vars = ['*'] in the declaration of the constraint as my integration variable is not time but s so I get an error if I try that, not a big deal but might be good to know for people that change their integration variable names.
Description
Hi everyone,
Lateley I have been experimenting with multi phase trajectories. I am modelling a racing car that drives a lap around a circuit, similar to the racing car example in the docs. I am splitting the lap up into two parts to be able to force the car to keep accelerating after the final corner. Let's call the first phase A and the second B. I need the end of A to be matched to the start of B. This works without issues. However, I also need the end of B to be matched to the start of A to ensure the lap is repeatable (i.e. the car doesn't start with a ridiculously high speed and starts and ends at the same position on track). This final linkage constraint seems impossible to enforce together with the first one.
Example
Phase B (or
phase1
) is a duplicate of my 'normal' phase.When I use this code the latter linkage constraints are not used (except for the variables that are 'new' in this case
'r'
) and their residuals do not show up when the results are printed either. So to me it seems like I can only define one linkage between these two phases. This might be expected behaviour, but as one phase is able to be linked to itself I assumed two phases could be linked to eachother multiple times (at different ends).Also I can't use
vars = ['*']
in the declaration of the constraint as my integration variable is nottime
buts
so I get an error if I try that, not a big deal but might be good to know for people that change their integration variable names.Dymos Version
1.10.1.dev0
Relevant environment information
No response