Modeling of track traffic light which works based on the Position of trains in Stateflow
Mostrar comentarios más antiguos
I have 2 Trains which need to cross 2 Sections in the same track. To enter a section we need to know if it is already occupied by another train or not.
So I have as input the Position of both Trains PosTrain1 and PosTrain2 and the length of Sections (Section 1= (0:20) and Section 2 = (20:40))
I used the matlab function (ismember) to check if the train is in the Section or not.
BlockedSection=ismember(Train1,Section1) will return a logic value à if its 1 then the train exist in Section 1, and if not then it will return the value 0.
Does anyone have an idea how can I check both trains in both Sections in the same time?
Example for the detection of train 1 in Section1
function BusySection1 = FuncBusySection1(PosTrain1, Section1)
BusySection1 = ismember(PosTrain1,Section1);
end
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Decision Logic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!