<!DOCTYPE OMNotebook>
<Notebook>
 <GroupCell closed="false" >
  <TextCell style="Text" >
   <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
   <Rule name="ShowCellBracket" >False</Rule>
   <Rule name="CellOpen" >False</Rule>
   <Rule name="CellTags" >&lt;ModelicaIndex></Rule>
  </TextCell>
  <GroupCell closed="false" >
   <TextCell style="Title" >
    <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Arial; font-size:38pt; font-weight:600; color:#000000;">Models for Event Based Stochastic Processes&lt;/p>&lt;/body>&lt;/html></Text>
   </TextCell>
   <TextCell style="Text" >
    <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">&lt;br />If we generalize a finite state automaton by letting the time between two events be stochastic, and possibly also letting the choice of the next state be stochastic, we obtain a model for event based stochastic processes. Such models have many applications, of which one is queuing systems.&lt;/p>&lt;/body>&lt;/html></Text>
   </TextCell>
   <GroupCell closed="false" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">The Random Package&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <InputCell style="Input" closed="true" >
     <Input>package Random
import Modelica.Math;
constant Real NV_MAGICCONST=4*exp(-0.5)/sqrt(2.0);
type Seed = Integer[3];

function random "input random number generator with external storage of the seed"
  input Seed si "input random seed";
  output Real x "uniform random variate between 0 and 1";
  output Seed so "output random seed";
algorithm
  so[1] := rem((171 * si[1]),30269);
  so[2] := rem((172 * si[2]),30307);
  so[3] := rem((170 * si[3]),30323);
  // zero is a poor Seed, therfore substitute 1;
  if so[1] == 0 then
    so[1] := 1;
  end if;
  if so[2] == 0 then
    so[2] := 1;
  end if;
  if so[3] == 0 then
    so[3] := 1;
  end if;
  x := rem((so[1]/30269.0 +so[2]/30307.0 + so[3]/30323.0),1.0);
end random;

function normalvariate "normally distributed random variable"
  input Real mu "mean value";
  input Real sigma "standard deviation";
  input Seed si "input random seed";
  output Real x "gaussian random variate";
  output Seed so "output random seed";
protected
  Seed s1, s2;
  Real z, zz, u1, u2;
  Boolean break=false;
algorithm
  s1 := si;
  u2 := 1;
  while not break loop
    (u1,s2) := random(s1);
    (u2,s1) := random(s2);
    z := NV_MAGICCONST*(u1-0.5)/u2;
    zz := z*z/4.0;
    break := zz &lt;= (- Math.log(u2));
  end while;
  x := mu + z*sigma;
  so := s1; 
end normalvariate;

connector discreteConnector
   discrete Boolean dcon;
end discreteConnector;

end Random;</Input>
     <Output></Output>
    </InputCell>
   </GroupCell>
   <GroupCell closed="false" >
    <TextCell style="Section" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:18pt; font-weight:600; color:#000000;">Examples&lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <TextCell style="Text" >
     <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">As a simple example of discrete-time stochastic process simulation we can consider a simple server model with a queue. &lt;/p>&lt;/body>&lt;/html></Text>
    </TextCell>
    <GroupCell closed="false" >
     <TextCell style="Subsection" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:14pt; font-weight:600; color:#000000;">CustomerGeneration Model&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <TextCell style="Text" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">The &lt;span style=" font-family:Courier New;">CustomerGenerator&lt;/span> model contains an output connector &lt;span style=" font-family:Courier New;">outCustomer&lt;/span> that transmits the customer arrival events to the rest of the system. We first start by defining a model which generates customers at random points in time. The time delay until the next customer arrival is assumed to be a normally distributed stochastic variable &lt;span style=" font-family:Courier New;">T&lt;/span>, here computed by calling the random number function &lt;span style=" font-family:Courier New;">normalvariate&lt;/span>, see above, where the negative part is folded back on the positive side using &lt;span style=" font-family:Courier New;">abs(T)&lt;/span> to avoid unrealistic negative service times. Since this function is side-effect free as all Modelica functions, it returns a &lt;span style=" font-family:Courier New;">randomSeed&lt;/span> value to be used at the next call to &lt;span style=" font-family:Courier New;">normalvariate&lt;/span>, see the help functions above. &lt;br />&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>model CustomerGeneration
  Random.discreteConnector dOutput;
  parameter Real mean = 0;
  parameter Real stDeviation = 1;
  
  discrete Real normalDelta;
  discrete Real nextCustomerArrivalTime(start=0);
  discrete Random.Seed randomSeed(start={23,87,187});
  
equation
  when pre(nextCustomerArrivalTime)&lt;=time then
    (normalDelta,randomSeed)=Random.normalvariate(mean,stDeviation,pre(randomSeed));
     nextCustomerArrivalTime = pre(nextCustomerArrivalTime) + abs(normalDelta);
   end when;
   
   dOutput.dcon=if nextCustomerArrivalTime&lt;>pre(nextCustomerArrivalTime) then true
   else  false;
end CustomerGeneration;</Input>
      <Output></Output>
     </InputCell>
     <GroupCell closed="false" >
      <TextCell style="Subsubsection" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:12pt; font-weight:600; color:#000000;">Simulation of CustomerGeneration&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <TextCell style="Text" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">We simulate the &lt;span style=" font-family:Courier New;">CustomerGeneration&lt;/span> model for a while to observe the customer arrival times.&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <InputCell style="Input" closed="true" >
       <Input>simulate( CustomerGeneration, stopTime=10 );</Input>
       <Output></Output>
      </InputCell>
      <TextCell style="Output" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <InputCell style="Input" closed="true" >
       <Input>plot( nextCustomerArrivalTime );</Input>
       <Output>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Output>
      </InputCell>
      <TextCell style="Output" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;img src="file:///C:/OpenMod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lGU5t5Y5E48zTf+zHc6cwZVuI/7GQgYCGQl6l280GegUO+T1S4D1fzouc9Af/94hKf5UR7CGTSx8E06LA0f0GmgzeEiBgIGAgYCBgJ9B/J10MAZBAwEDAQMBAwEDAQ8zQNnEKgd6DmfCO5UPdDRHVtlIGAgYCBgIFD7ddB/E+jg3XVybk/UCNTda59UlUA1DqRVBgIGmskvd6HNwvJw8vVrbRve9ZfNT9j1e/XGys1xizKvA/s0Zy1IhSXW16krzJ78/kBPvdC51Ow1ckGgEw7mAQwEDASqBCp9a1u2fSjdvHTbzT1qBJp/48fDKt28cOuSQrjH/h93bC2x0idcsn3hBCqbnscD5UNbS6zgkBZerMLmhT0vmkH50OYSK3TeM24zUPkqKPpGetoSG+by6d+ku2YgYCBQ5zTfMWcQMBBYCdT/j332qv3Rc3cMBAwEDAQsAQwEDAQMBAwEDAQMBAwEDAQMBAwEDAQMBP4Bt6vZrhVr17IAAAAASUVORK5CYII=</Image>
      </TextCell>
      <TextCell style="" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">&lt;span style=" font-family:Courier New; font-size:12pt; color:#000000;">Next customer arrival time for customers arriving at random points in time.&lt;/span>&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
     </GroupCell>
    </GroupCell>
    <GroupCell closed="false" >
     <TextCell style="Subsection" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:14pt; font-weight:600; color:#000000;">ServerWithQueue Model&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <TextCell style="Text" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">We can now design a server model &lt;span style=" font-family:Courier New;">ServerWithQueue&lt;/span> which through its &lt;span style=" font-family:Courier New;">inCustomer&lt;/span> port will accept the arriving customers from the &lt;span style=" font-family:Courier New;">CustomerGeneration&lt;/span> model. The &lt;span style=" font-family:Courier New;">nrOfCustomersInQueue&lt;/span> represents the current number of customers in the queue. Other state variables of interest are &lt;span style=" font-family:Courier New;">nrOfArrivedCustomers&lt;/span>, the number of customers that have so far arrived and &lt;span style=" font-family:Courier New;">nrOfServedCustomers&lt;/span>, the number of customers that have so far been served. The first &lt;span style=" font-family:Courier New;">when-&lt;/span>equation services the arrival of a new customer, whereas the second &lt;span style=" font-family:Courier New;">when-&lt;/span>equation handles the event when a customer is serviced and is ready to leave the queue.&lt;br />      &lt;br />The event when &lt;span style=" font-family:Courier New;">readyCustomer&lt;/span> becomes true represents completed service for the current customer. The time needed to serve a customer is &lt;span style=" font-family:Courier New;">custServeTime&lt;/span>, which is constant in this model but could be varying according to some formula or be randomly distributed. The variable &lt;span style=" font-family:Courier New;">lastServeStart&lt;/span> represents the starting time for servicing the most recent serviced customer.&lt;br />&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>model ServerWithQueue
  Random.discreteConnector dInput;
  parameter Real serveTime=0.1;
  
  discrete Real nrOfArrivedCustomers;
  discrete Real nrOfServedCustomers;
  discrete Real nrOfCustomersInQueue(start=0);
  
  discrete Boolean readyCustomer(start=false);
  discrete Boolean serveCustomer(start=false);
  
  Real resetTime;
  
equation
  when dInput.dcon then
    nrOfArrivedCustomers=pre(nrOfArrivedCustomers)+1;
  end when;
  
  when readyCustomer then
     nrOfServedCustomers=pre(nrOfServedCustomers)+1;
  end when;
  
  when (pre(nrOfCustomersInQueue)==0 and dInput.dcon) or (pre(nrOfCustomersInQueue)>=1 and pre(readyCustomer))then
    serveCustomer=true;
    resetTime=time;
  end when;
  
  readyCustomer=if (serveCustomer and (serveTime&lt;time-resetTime)) then true else false;
  
    
 nrOfCustomersInQueue=nrOfArrivedCustomers-nrOfServedCustomers;
    
end ServerWithQueue;</Input>
      <Output></Output>
     </InputCell>
     <GroupCell closed="false" >
      <TextCell style="Subsubsection" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:12pt; font-weight:600; color:#000000;">Test Model 1&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <TextCell style="Text" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">The simulation of the whole system can be done by defining a test model which connects the CustomerGeneration model with the ServerWithQueue model.  &lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <InputCell style="Input" closed="true" >
       <Input>model testServer1
   CustomerGeneration customer;
   ServerWithQueue server(serveTime=0.4);
equation
   connect(customer.dOutput, server.dInput);
end testServer1;</Input>
       <Output></Output>
      </InputCell>
     </GroupCell>
    </GroupCell>
    <GroupCell closed="false" >
     <TextCell style="Subsection" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:14pt; font-weight:600; color:#000000;">Simulation of testServer1&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <TextCell style="Text" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">Using the MathModelica simulation environment we simulate the model for 10 seconds with the customer service time custServeTime = 0.4 seconds.&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>simulate( testServer1, stopTime=10 );</Input>
      <Output></Output>
     </InputCell>
     <TextCell style="Output" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>plot( server.nrOfArrivedCustomers, server.nrOfServedCustomers, server.nrOfCustomersInQueue );</Input>
      <Output>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Output>
     </InputCell>
     <TextCell style="Output" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;img src="file:///C:/OpenModelica132/bin/OMNoteboook_tempfiles/2.png" width="288" height="214" />&lt;/p>&lt;/body>&lt;/html></Text>
      <Image name="file:///C:/OpenModelica132/bin/OMNoteboook_tempfiles/2.png" >AAAAAYlQTkcNChoKAAAADUlIRFIAAAEgAAAA1ggDAAAARuGvAgAAAwBQTFRFAAAAAAD/2dnZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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WyZrQsJptMIOuzljYIABQEKAhQE9DqLVSvJCALyXY1hb6PaBe7hlAjq6ab9aYJiPWmzn/MEDXfuWzJUvlVRwLyL5cnxeSwcVSPb1RgerWxU0An0MM0rCFAQcIuglgwZQYCCAAUBCgIcpD84c12xQHsRdOrCYk7Lgi5BQYCCAAUBDc5i117OCAIUBLS37XNfBDWy7aMgIIigMIauXXnNCR9BF/uYkT/MEm6QDiNoU/INKAiIKiiMoaiCrq3FFxQEKAhQEKAgIKqgOw3dubKYETGC7nbygYIABQEKAhQEhJzFbrz2DCMIyE1EuGEWWVCIW66RBRlBOWsRdJ2hiz8xVsr9XeziT4yVcn8XC6ll5P5pXkGAgoBGBV04i112pV0YQYCCAAUBCgJOHKQ3/CHecAuLOSdG0OO5uI4ILiTnZEHtoyBAQYCCgDNnseNFBMAIAhQEzO8oVrvl2qmg5eQ9dCkoVbwn3aego9s+7SyyNlJ726cPKxNqd7HeBUEyoyDgzwjaPUjvrklQjCBAQYCCAAUBCgIqz2KdrC8mVI6g7vwoiFAQoCCg9iC9vyZBMYIABQEzE8d2NfoXdPD/zXcv6Og96f4F7fl/893tZEyZiyiPoP6sTFgYpNNS8jf+lqCvycsoCFAQ8CcFFc1iVWoSFCMIUBCgIEBBQIVBusP1xYQKEdS1HwURCgIUBCgIqDGL1alJUIwgQEGAgjJWHl75ki0tJ4/Hj9U8eOqh7CecOu5arLw95Fhi/cH31VNaYk3I9i7W6oPvhaSs8TsEdU72G46CAAUBCgK2LzW+CCr9PFpZ/lSavTTv1zNqRFA+8GO1SrMX5i4xhGfU6WKlDS7JXxhAZeF5kaDSFhS1udRnwAgq/7TVeS2OKai8FxQNpKd1sVcs7xmk2/tbY2dRY+OwaxQEKAjQBKAgQEGAggAFAQoCFAQoCFAQoCBAQYCCAAUB/wCnDtmJH42r+AAAAABJRU5ErkJggg==</Image>
     </TextCell>
     <TextCell style="" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">&lt;span style=" font-family:Courier New; font-size:12pt; color:#000000;">Number of arrived customers, number of served customers, and number of customers waiting in the queue or being serviced. Customer service time is 0.4 seconds.&lt;/span>&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <GroupCell closed="false" >
      <TextCell style="Subsubsection" >
       <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:12pt; font-weight:600; color:#000000;">Test Model 2&lt;/p>&lt;/body>&lt;/html></Text>
      </TextCell>
      <InputCell style="Input" closed="true" >
       <Input>model testServer2
   CustomerGeneration customer;
   ServerWithQueue server(serveTime = 1);
equation
   connect(customer.dOutput, server.dInput);
end testServer2;</Input>
       <Output></Output>
      </InputCell>
     </GroupCell>
    </GroupCell>
    <GroupCell closed="false" >
     <TextCell style="Subsection" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times; font-size:14pt; font-weight:600; color:#000000;">Simulation of testServer2&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <TextCell style="Text" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Times New Roman; font-size:12pt; color:#000000;">We now simulate the model for 10 seconds with the customer service time custServeTime = 1 second.&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>simulate( testServer2, stopTime=10 );</Input>
      <Output></Output>
     </InputCell>
     <TextCell style="Output" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
     <InputCell style="Input" closed="true" >
      <Input>plot( server.nrOfArrivedCustomers, server.nrOfServedCustomers, server.nrOfCustomersInQueue );</Input>
      <Output>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;/p>&lt;/body>&lt;/html></Output>
     </InputCell>
     <TextCell style="Output" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:Courier New; font-size:11pt; color:#000000;">&lt;img src="file:///C:/OpenModelica132/bin/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UBBw7SK/4Qb7iFxZQDI+ixGB3BnbxxrKAOUBCgIEBBwJGz2P4iAmAEAQoCpncUm91y7VTQfPIWuhSUGt6T7lPQ3m2f+yyyVtJ626cPKxmtu1jvgiCZURDwNYI2D9KbaxIUIwhQEKAgQEGAgoDGs1gn64uMxhHUnR8FEQoCFAS0HqS31yQoRhCgIGBiYt+uRv+Cdv6/+e4F7b0n3b+gLf9vvrudjJypiPoI6s9KxswgneaSP/Fdgj4mz6MgQEHAVwqqmsWa1CQoRhCgIEBBgIKABoN0h+uLjAYR1LUfBREKAhQEKAhoMYu1qUlQjCBAQYCCChYeXvmQLc0nj8ePxTx46q7sB5w67losvDzkmGP5wffFU+7EkpD1Xezx+tQ1qWh8paAvoPgNR0GAggAFAeuXGh8E1b4frS5/qs1em/fjGS0iqBz4sVq12Stz1xjCM9p0sdoG1+SvDKC68DxJUG0Lqtpc6zNgBNW/2+q4FscUVN8LqgbSw7rYXyxvGaTv97fGjqLFxmHXKAhQEKAJQEGAggAFAQoCFAQoCFAQoCBAQYCCAAUBCgL+AQWN2Yq1eIsdAAAAAElFTkSuQmCC</Image>
     </TextCell>
     <TextCell style="" >
      <Text>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:MS Shell Dlg; font-size:8.25pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;">&lt;span style=" font-family:Courier New; font-size:12pt; color:#000000;">Number of arrived customers, number of served customers, and number of customers waiting in the queue or being serviced. Customer service time is 1 second.&lt;/span>&lt;/p>&lt;/body>&lt;/html></Text>
     </TextCell>
    </GroupCell>
   </GroupCell>
  </GroupCell>
 </GroupCell>
</Notebook>
