modeling hybrid systems -凯发k8网页登录
description
this example shows a hybrid system with both continuous time and discrete event sections. the discrete event part models tanks, represented by entities, which are being queued and need to be filled up. each tank has a "capacity" attribute. the continuous time part models the process of filling up a tank, modeled by an integrator. when a tank is filled to capacity, this event can be detected by a hit crossing block, which will generate a message corresponding to this event. the generated message will trigger the server to release the tank.
structure of the model
the model includes the following components:
tank generator: generates tanks periodically with each tank having an arbitrarily assigned capacity attribute.
waiting queue: queues tanks waiting to be filled
fill this tank: serves tanks and calls into the simulink function
startfilling
to pass the tank's capacity attribute to the time-based section of the model.
tank filling: models the process of filling each tank up to capacity
sensor: detects when the amount filled in the tank has reached capacity and when this happens, sends a message to the discrete-event section of the model. sensor serves as a bridge between the time-based section and even-based section.
processor: receives message generated from the sensor and decides which tank to be released from the server. it then calls the simulink function named
release
to generate a release message for a specific tank.
selection gate: receives a release message, and in response, opens the gate to let the specific tank through.
configure demo: sets the number of gas pumps in the gas station and turns on/off of the animation. to show the animation, please use a gas pump number between 1 and 20.
domain crossings between time domain and event domain
simevents automatically handles any exchange of data across the time and event domains by automatically inserting gateways where needed. these positions are annotated in the model using e
. in this model, a gateway has been inserted at the input port of the entity queue block that is connected to the hit crossing block since it receives a message from the time domain section of the model.
results
the scope block labeled "fill process" and "trucks leaving after fill" shows the results of the simulation.
if show animation
check box is selected in configure demo, an animation window appears for visualizing the demo. a screenshot of the animation with four gas pumps is shown below:
see also
| |