AnyLogic problem with having multiregions and regions under the roof of the same parameter type - gis

I get problem with some of GIS map regions turning into multi regions as I try to use them as agents. So I applied the advised method to "create a normal agent type ("MyGISRegion") and provide it a parameter p_MyRegion of type GISRegion. For every region you create, you also now instantiate such an agent and set its parameter to the region created." and now the mentioned parameter type conflicts with regions as some of them are multi regions and some regular GISRegions. How to fix the conflict?

Related

Fusion Compiler IO filtering command - Tcl

i am currently learning about IC physical design. I came across this set of TCL command which I understand only partially. I the second and third 'set' command, what does the '-only_leaf' and '-flat' refer to?
Please help me by giving some explanation.
Thank you guys.
Those are flags accepted by the all_fanout and all_fanin commands; the set is just storing the results in variables. (Tcl uses set to do basic assignment; it doesn't have top level operators.)
At a guess, -flat means "give me the results as a flat list" (instead of something more complicated such as a list of lists?) and -only_cells (or -only_leaf) acts as a filter to say which information is to be returned. I'd need to read the documentation for those commands to say for sure; it is definitely application-specific and I don't use the Synopsis tools at all.
Flat vs leaf is related to cells and pins in a hierarchical design. You might have a timing path that starts at registerA and ends at registerB. If your cell hierarchy is this:
top_cell
--child_A
--registerA
--child_B
--registerB
then registerA and registerB are leaf cells. The driver and receiver pins are the leaf pins. The net connection from registerA to registerB must also exit child_A and enter child_B through hierarchical pins. A flat collection will include both the leaf pins and the hierarchical pins.
In Synopsys tools, you can quickly get command descriptions with man.
For example, man all_fanin
all_fanin
Creates a collection of pins, ports, or cells in the fanin of
the specified sinks.
. . .
-flat Includes objects throughout the design hierarchy in the result.
This means that the only non-leaf objects in the result are
hierarchical sink pins.
If you do not specify this option, the result includes only
objects within the same hierarchical level as the current sink.
. . .
-only_cells
Includes only cells in the timing fanin of the specified sinks
in the result and not pins or ports.
. . .
There is no -only_leaf option to all_fanin or all_fanout. Returning only leaf objects is the default condition.

How I can send command to the person agents living in one specific GIS region? Consider there are several GIS regions

Suppose there are 1000 Person agent on 4 (a,b, c,d) GIS region area. On a certain event, I want to communicate with all the agents living inside GIS region "a" . In "a" region we have 200 person agents.If I send message or command to Person state chart, how I can make sure that only those 200 person agents living on that specific GIS region "a" is getting my command? Is there any way to model that?
You can filter messages inside the Agent's statechart transition, in order to only executethe transition when a certain expression is true (in your case: Agent is in the right region).
Of course you could do this filtering in a lot of other places too, for example when sending the message, or when receiving it. However you can always use this code to check if the Agent is located inside of a GISRegion:
main.gisRegion1.contains(this.getLatitude(), this.getLongitude())
This is assuming you executed this inside the Agent (therefore main. and this.) and the region you are looking for is named gisRegion1.

How can I make a GIS region an agent in anylogic?

Is there any way to make a GIS region an agent? For example, In Arizona we have 15 counties. Can I make the individual county area an individual agent? In the tutorials it mentions how to place one agent in a GIS region but it's not mentioned how to make the whole GIS region an agent which can have it's own statechart.
(If 1st one can be done) Suppose there lives some Person agent on each of those GIS region area (county). Is there any way to move those Person agent based on the state of the county agent?
In simple words, I want to move some Person agents from county "a" to another county "b" based on county's statechart. If I send msg or command to Person statechart, I have to make sure only those person agents living in the county "a" are getting the command to move. Is there any way to model that?
Number 1 can be done, but not directly. Here is how:
create an agent type "myGISRegion"
place a parameter into it and change its type to "GISRegion", name it "p_MyGISRegion"
when instantiating it on Main (or whereever), set the parameter to the GISRegion you like below

textX: How to generate object names with ObjectProcessors?

I have a simple example model where I would like to generate names for the objects of the Position rule that were not given a name with as <NAME>. This is needed so that I can find them later with the built-in FQN scope provider.
My idea would be to do this in the position_name_generator object processor but that will be only be called after the whole model is parsed. I donĀ“t really understand the reason for that, since by the time I would need a Position object in the Project, the objects are already created, still the object processor will not be called.
Another idea would be to do this in a custom scope provider for Position.location which would then first do the name generation and then use the built-in FQN to find the Location object. Although this would work, I consider this hacky and I would prefer to avoid it.
What would be the textX way of solving this issue?
(Please take into account that this is only a small example. In reality a similar functionality is required for a rather big and complex model. To change this behaviour with the generated names is not possible since it is a requirement.)
import textx
MyLanguage = """
Model
: (locations+=Location)*
(employees+=Employee)*
(positions+=Position)*
(projects+=Project)*
;
Project
: 'project' name=ID
('{'
('use' use=[Position])*
'}')?
;
Position
: 'define' 'position' employee=[Employee|FQN] '->' location=[Location|FQN] ('as' name=ID)?
;
Employee
: 'employee' name=ID
;
Location
: 'location' name=ID
( '{'
(sub_location+=Location)+
'}')?
;
FQN
: ID('.' ID)*
;
Comment:
/\/\/.*$/
;
"""
MyCode = """
location Building
{
location Entrance
location Exit
}
employee Hans
employee Juergen
// Shall be referred to with the given name: "EntranceGuy"
define position Hans->Building.Entrance as EntranceGuy
// Shall be referred to with the autogenerated name: <Employee>"At"<LastLocation>
define position Juergen->Building.Exit
project SecurityProject
{
use EntranceGuy
use JuergenAtExit
}
"""
def position_name_generator(obj):
if "" == obj.name:
obj.name = obj.employee.name + "At" + obj.location.name
def main():
meta_model = textx.metamodel_from_str(MyLanguage)
meta_model.register_scope_providers({
"Position.location": textx.scoping.providers.FQN(),
})
meta_model.register_obj_processors({
"Position": position_name_generator,
})
model = meta_model.model_from_str(MyCode)
assert model, "Could not create model..."
if "__main__" == __name__:
main()
What is the textx way to solve this...
The use case you describe is to define the name of an object based on other model elements, including a reference to other model elements. This is currently not part of any test and use cases included in our test suite and the textx docu.
Object processors are executed at defined stages during model construction (see http://textx.github.io/textX/stable/scoping/#using-the-scope-provider-to-modify-a-model). In the described setup they are executed after reference resolution. Since the name to be defined/deduced itself is required for reference resolution, object processors cannot be used here (even if we allow to control when object processors are executed, before or after scope resolution, the described setup still will not work).
Given the dynamics of model loading (see http://textx.github.io/textX/stable/scoping/#using-the-scope-provider-to-modify-a-model), the solution is located within a scope provider (as you suggested). Here, we allow to control the order of reference resolution, such that references to the object being named by a custom procedure are postponed, until references required to deduce/define the name resolved.
Possible workaround
A preliminary sketch of how your use case can be solved is discussed in a https://github.com/textX/textX/pull/194 (with an attached issue https://github.com/textX/textX/issues/193). This textx PR contains a version of scoping.py you could probably use for your project (just copy and rename the module). A full-fledged solution could be part of the textx TEP-001, where we plan to make scoping more controllable to the end-user.
Playing around with this absolutely interesting issue revealed new aspects to me for the textx framework.
names dependent on model contents (involving unresolved references). This name resolution, which can be Postponed (in the referenced PR, see below), in terms of our reference resolution logic.
Even more interesting are the consequences of that: What happens to references pointing to locations, where unresolved names are found? Here, we must postpone the reference resolution process, because we cannot know if the name might match when resolved...
Your example is included: https://github.com/textX/textX/blob/analysis/issue193/tests/functional/test_scoping/test_name_resolver/test_issue193_auto_name.py

Geocortex "Required parameter is null or empty"

I am currently creating a workflow in which the user captures a point geometry by clicking on the map (this works), then the map zooms to the point's extent (this also works), and then buffers the point (this does not work).
My BufferTask activity gives me this: "Unhandled exception: 'Required parameter is null or empty. Parameter name: Geometry.SpatialReference in activity '1.3: BufferTask'"
This doesn't make sense to me since I have indeed entered a value for this parameter.
sidenote: Geocortex's documentation is virtually non-existent. My inner-cynic is telling me that this is on purpose so that you keep paying them to do things for you.
My 2 best guesses would be either that the buffer spatial reference is null (the spatial reference used to actually create the buffer itself), or that the selectedLocation spatial reference is null for some reason.
For the first, see if there's a value entered for "Buffer Spatial Reference" which you'll see in the properties panel on the right side of the designer when you've got the Buffer Task selected. Note that using Web Mercator as the Buffer Spatial Reference will likely give you an inaccurate buffer due to distance distortion in that projection.
For the second, you could explicitly assign a SpatialReference to selectedLocation.SpatialReference using an assign activity (making sure that the assigned SpatialReference matches the actual spatial reference of your location).
Check to make sure you specified a correct spatialReference, so the workflow module can assess the "length" of buffer.
In addition isolate the problem.
Create a clean variable of type spatialReference and assign a NEW SpatialRef(wkid). Then use that variable.