MATLAB REAL-TIME WORKSHOP 7 - TARGET LANGUAGE COMPILER Guia do Utilizador Página 174

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 386
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 173
6 Program Architecture
6-12
occurs. The clock tick gives a clockSem (clock semaphore) to the model task
(tSingleRate). The model task will wait for the semaphore before executing.
The clock ticks are configured to occur at the fundamental step size (base rate)
foryourmodel.
The pseudocode below is for a multitasking model using real-time tasking
primitives.
tSubRate(subTaskSem,i)
{
Loop:
Wait on semaphore subTaskSem.
ModelOutputs(tid=i)
ModelUpdate(tid=i)
EndLoop
}
tBaseRate()
{
MainLoop:
If clockSem already "given", then error out due to overflow.
Wait on clockSem
For i=1:NumTasks
If (hit in task i)
If task i is currently executing, then error out due to
overflow.
Do a "semGive" on subTaskSem for task i.
EndIf
EndFor
ModelOutputs(tid=0) -- major time step.
LogTXY -- Log time, states and root outports.
ModelUpdate(tid=0) -- major time step.
Loop: -- Integration in minor time step for
-- models with continuous states.
ModelDeriviatives
Do 0 or more:
ModelOutputs(tid=0)
ModelDerivatives
EndDo (number of iterations depends upon the solver).
Integrate derivatives to update continuous states.
EndLoop
Vista de página 173
1 2 ... 169 170 171 172 173 174 175 176 177 178 179 ... 385 386

Comentários a estes Manuais

Sem comentários