AnyLogic: a single traffic lane for public transport - anylogic

My objective is to restrict any means of transport (except for public transport) from moving on a particular traffic lane. Thus, I am intended to allow a single lane for public transport. Is it possible to create it only with the interface elements? Also, I would appreciate it if some references are provided because I didn't find any in "AnyLogic Help".

This is not possible directly.
You will have to create 2 parallel roads. You can make them look like 1 road with 2 lanes but it must be 2 roads. Then, send public transport via 1 of these 2 roads.
Obviously, you need to create entry/exit points so public transport can re-join normal traffic.

Related

Is this the valid contact header and can you explain the parameters

I am new to sipp and network concepts i got a contact header
"Fin Tax" <sip:b2fdfc58-b7f2-a482-572c-8dbc1aae24#10.195.1.41:5060>;+
"ip.instance="urn:uuid:00000000-0000-0000-0000-34db8dc64>";+
u.sip!devicename="ATA34DBFD8DC64"4DBFD18DC64";+u.sip!model.cc.co.com="681"
Can you explain this contact paramerter i know the first part uri but what are next parameters
First parameter is +sip.instance (the double quote after + in the example above is a typo for sure), which is defined by IETF, it can be found in SIP Outbound (RFC5626) and GRUU (RFC5627):
https://www.rfc-editor.org/rfc/rfc5626
https://www.rfc-editor.org/rfc/rfc5627
Its purpose is to identify uniquely a device, independent of contact address (which can change in case of roaming around wifi hotspots or 4G/5G networks) or multiple connections, but contact addresses can also overlap when devices are located in private networks using same IP range.
Usually its value is build using a UUID (universally unique identifier), which should reduce the risk of duplicate values for users with multiple devices. Its uniqueness allows SIP Registrar Server to identify what contact record to update or remove when processing REGISTER requests from the same device.
The next two parameters prefixed with +u.sip! seem to be custom parameters set by the sending SIP UA. They look like specific to some CISCO equipment, probably a gateway. In general, SIP specifications tell that custom parameters can be ignored by receiving UA, if it does not know how to interpret them.

Communication in multiple contacts network in Anylogic

I have defined a Person agent and a population of Person "living" inside Main agent environment. I'm wondering if in anylogic there is some kind of mechanism to define multiple layer networks and send messages only in specific layer, i.e I want to define for person agents some relations like "family connections" if agents are in the same family (see picture, each connected component is a family), "workplace connections" if agents works in the same place, etc. From the help guide I understood that is possible to create multiple custom connections links.
What isn't clear to me is how to reference a specific relation when I send messages between agents, i.e I would send messages from agent X only to the connected agents Y1,...,Y2 for the relation "family connections" ignoring connected agents for the relation "workplace connections".
From the api doc i see only methods like getConnections() (or send()) to return all the connected agents without the possibility to specify the connection links object (aka a specific network layer).
if you use a link to family members you can use the link to agents object, call it familyLink for instance and connect all your family together. You will have another independent workersLink.
you connect your agents by doing familyLink.connectTo(agent); where the agent is a person which is part of the family.
to send messages to all your family you can do:
familyLink.sendToAllConnected(msg);
You can use a paramter to define the layer of agents (like Person.layer = "XXX"), then make a filter on Persons that should receive the message:
for (Person p : populationOfPerson.stream().filter(predicate).collect(Collectors.toList())) {
/// send msg to p;
}

(Socket.io) How should I optimize number of Namespaces?

I am planning on using socket.io to create an online app that allows users to chat via video, and saves each video call/session in a database. (Audio for each of these sessions will be separately available to download as well.)
Because there could be multiple video calls/sessions happening at once, I want to separate the data for each session. Socket.io offers both Namespaces and Rooms to do this, but I am unsure which is more optimal for my problem.
Namespaces, according to the documentation, are "a useful feature to minimize the number of resources (TCP connections) and at the same time separate concerns within your application by introducing separation between communication channels."
Is it best to have 1 namespace per room/call/session?
Or would it be best to limit tcp connections by creating some rule that will create a new namespace if/when:
Let's say MAX_CLIENTS_PER_NAMESPACE = (the max number of sockets/clients we want in a namespace)
Say the last/smallest namespace currently has N clients (i.e. if you add up the clients from all the rooms in that namespace we get some number N), and the new room/call/session to-be-created has M clients. Create a new namespace if M + N >= MAX_CLIENTS_PER_NAMESPACE

AnyLogic Chat Call Center Model

I am trying to model a Call Center with Chat communication and need your thoughts on this scenario. Real world scenario is that Customer Service Representatives[CSR] in Chat Call Center can service multiple customer chats at same time based on their capacity[integer value 1,2...]
"Chat" Agent [source]
"ChatAgent" resource unit with int parameters totalCapacity[default=3]
Using a service, incoming "Chat" from source seizes a "ChatAgent" from a resourcePool[with resourceUnit "ChatAgent"]. In this model, a "ChatAgent" accepts only 1 "Chat" inside the service block.
ResourcePool
On seize: unit.totalCapacity--;
On release: unit.totalCapacity++;
But I couldn't model a scenario where 1 "ChatAgent" can service multiple customer "Chats" at a time based on their totalCapacity like in a real chat call center.
Please advise on how I can configure this multiple agents to 1 resource seize/delay.
Updated Model
Updated ChatAgent Resource Structure
Thanks,
Shiva
Many ways of doing this, but the first thing that comes to mind is NOT to use ChatAgent as a resource (at least not the kind you use on a service block) because chats can come at any given time, and you can't have a resource taking many different agents that come at different times through the service block...
Instead you can use the following structure in the chatAgent:
The capacity of the resource will define how many agents can enter the restrictedArea block... This structure will exist inside your chatAgent resource.
Your main agent will have the following structure:
when the chat waits for an available chatAgent, if a chatAgent is available by doing:
chatAgent.beginService.entitiesInside() < chatAgent.capacity
These are the most important details to make it work... now you have to build the model properly.

What are "Included Services" in a Service useful for?

I have a custom profile for a proprietary device (my smartphone app will be the only thing communicating with my peripheral) that includes two simple services. Each service allows the client to read and write a single byte of data on the peripheral. I would like to add the ability to read and write both bytes in a single transaction.
I tried adding a third service that simply included the two existing single byte services but all that appears to do is assign a UUID that combines the UUIDs for the existing services and I don't see how to use the combined UUID since it doesn't have any Characteristic Values.
The alternatives I'm considering are to make a separate service for the two bytes and combine their effects on my server, or I could replace all of this with a single service that includes the two bytes along with a boolean flag for each byte that indicates whether or not the associated byte should be written.
The first alternative seems overly complicated and the second would preclude individual control of notifications and indications for the separate bytes.
Is there a way to use included services to accomplish my goals?
It's quite an old question, but in case anyone else comes across it I leave a comment here.
Here are two parts. One is a late answer for Lance F: You had a wrong understanding of the BLE design principles. Services are defined on the host level of the BLE stack. And you considered your problem from the application level point view, wanting an atomic transaction to provide you with a compound object of two distinct entities. Otherwise why would you have defined two services?
The second part is an answer to the actual question taken as quote from "Getting Started with Bluetooth Low Energy" by Kevin Townsend et al., O'Reilly, 2014, p.58:
Included services can help avoid duplicating data in a GATT server. If a service will be referenced by other services, you can use this mechanism to save memory and simplify the layout of the GATT server. In the previous analogy with classes and objects, you could see include definitions as pointers or references to an existing object instance.
It's an update of my answer to clarify why there is no need for the included services in a problem stated by Lance F.
I am mostly familiar with BLE use in medical devices, so I briefly sketch the SIG defined Glucose Profile as an example to draw some analogies with your problem.
Let's imagine a server device which has the Glucose Service with 2 defined characteristics: Glucose Measurement and Glucose Measurement Context. A client can subscribe for notifications of either or both of these characteristics. In some time later the client device can change its subscriptions by simply writing to the Client Configuration Characteristic Descriptor of the corresponding characteristic.
Server also has a special mandatory characteristic - Record Access Control Point (RACP), which is used by a client to retrieve or update glucose measurement history.
If a client wants to get a number of stored history records it writes to the RACP { OpCode: 4 (Report number of stored records), Operator: 1 (All records) }. Then a server sends an indication from the RACP { OpCode: 5 (Number of stored records response), Operator: 0 (Null), Operand: 17 (some number) }.
If a client wants to get any specific records it writes to the RACP { OpCode: 1 (Report stored records), Operator: 4 (Within range of, inclusive), Operand: [13, 14] (for example the records 13 and 14) }. In response a server sends requested records one by one as notifications of the Glucose Measurement and Glucose Measurement Context characteristics, and then sends an indication from the RACP characteristic to report a status of the operation.
So Glucose Measurement and Glucose Measurement Context are your Mode and Rate characteristics, then you also need one more control characteristic - an analog of the RACP. Now you need to define a number of codes, operators, and operands. Create a structure whichever suits you best, for example, Code: 1 - update, Operator: 1 - Mode only, Operand: actual number. A client writes it to the control point characteristic. A server gets notified on write, interprets it, and acts in a way defined by your custom profile.