Mismatching phase size in tls when setting up more than one lane in Simple Grid Scenario - sumo

I am modifying SimpleGridScenario class in ../flow/scenarios/grid.py and .../examples/rllib/green_wave.py so that I can turn my simple grid into a double lane per corridor scenario. I added them and I also set up new connections so that vehicles can turn right and left. This is shown in the attached image. For every approach, the first lane allows vehicles to turn left and go straight on and the second one allows vehicles to turn right and go straight on as well.
Unfortunately, every time I run a simulation I receive the following error:
Error: Mismatching phase size in tls 'center0', program 'online'.
Quitting (on error).
Sample node in the grid
connections in NETEDIT
Phases in SUMO
Does anyone know why?
I've verified the phase size in sumo-gui and it is 16, what is correct since I have 4 possible movements per approach.
SimpleGridScenario > __init__()
phases = [{
"duration": "25",
"minDur": "8",
"maxDur": "45",
"state": "GGGgrrrrGGGgrrrr"
}, {
"duration": "7",
"minDur": "3",
"maxDur": "6",
"state": "yyygrrrryyygrrrr"
}, {
"duration": "6",
"minDur": "3",
"maxDur": "6",
"state": "rrrGrrrrrrrGrrrr"
}, {
"duration": "7",
"minDur": "3",
"maxDur": "6",
"state": "rrryrrrrrrryrrrr"
}, {
"duration": "25",
"minDur": "8",
"maxDur": "45",
"state": "rrrrGGGgrrrrGGGg"
}, {
"duration": "7",
"minDur": "3",
"maxDur": "6",
"state": "rrrryyygrrrryyyg"
}, {
"duration": "6",
"minDur": "3",
"maxDur": "6",
"state": "rrrrrrrGrrrrrrrG"
}, {
"duration": "7",
"minDur": "3",
"maxDur": "6",
"state": "rrrrrrryrrrrrrry"
}]
for i in range(self.row_num * self.col_num):
node_id = "center"+str(i)
traffic_lights.add(node_id, phases=phases, tls_type="actuated")
Files can be downloaded in the following link: Flow files
Do not forget to replace the __init__.py file by yours in the scenario directory!
UPDATE: It seems that there might be an online modification of the TLS, probably by Traci. For further details please check this (last comment): Click here

would you be able to attach the image? This would help a lot in figuring this out.

For some phases (like the last one) MaxDur is less than the duration. Try increasing MaxDur or reducing duration.

You can right click in sumo on a traffic light (green or red bar) and "Show phases" to see how long the "state" string should be (as many as the number of rows in the window that opens).

It turns out that the phase size was correct, but my flow environment ( green_wave_env.py ) was setting the traffic light state in the 'online' program with a bad phase size. It works now.
Thank you!

Related

Workaround for XLSM issues

My company receives a daily CDR report from Comcast and I'm trying to get this data into our database in an automated fashion. Unfortunately, Comcast has advised there is a 0% chance they send us a CSV or XLSX or anything that is NOT an XLSM. For some context, Comcast's CDR report is several sheets but I need only the data from Sheet1 (called All CDR) and there are NO macros in sheet1.
So, I have been working all week on a workaround. During testing I was able to get this code to work:
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0 Macro;
Database=\\\fileserver\Comcast.xlsm;IMEX=1;HDR=YES','select * from [All CDR$]')
NOTE: This only reads the data, I will turn it into an INSERT statement once working.
But I found out that this code ONLY works if the file has been opened and saved. I.e. I had to open the file, enable content, then Excel asks "Do you want to make this file a trusted document?" which I click Yes, then save and exit. Then the code works.
So how can I work around this awful issue courtesy of Comcast? I have Power Automate at my disposal as well as SQL Server and other standard business tools. I have tried using power automate to read the excel file but this has failed as Sharepoint would not recognize the XLSM files, only XLSX. I wanted to use power automate to open the Excel file, save it and close it but I do not think this is possible. Thanks in advance
If you can't find a nicer way then you can do this using an Office Script. It may or may not work as you need it but you can work through that.
If you go into Excel Online (any workbook) under the user that will run the script in PowerAutomate, you should have an option in the ribbon called Automate.
Find it and create a new script called ... Get All Data from Worksheet
Paste this code in ...
function main(workbook: ExcelScript.Workbook, worksheetName: string)
{
let worksheet = workbook.getWorksheet(worksheetName);
let usedRange = worksheet.getUsedRange(true);
return usedRange.getValues();
}
Now, you can call that from PowerAutomate using the Run script action under Excel Online (Business) ...
Action
Result
JSON Response
[
[
"Header 1",
"Header 2",
"Header 3",
"Header 4",
"Header 5",
"Header 6",
"Header 7"
],
[
"21",
"22",
"23",
"24",
"25",
"26",
"27"
],
[
"31",
"32",
"33",
"34",
"35",
"36",
"37"
],
[
"41",
"42",
"43",
"44",
"45",
"46",
"47"
],
[
"51",
"52",
"53",
"54",
"55",
"56",
"57"
],
[
"61",
"62",
"63",
"64",
"65",
"66",
"67"
],
[
"71",
"72",
"73",
"74",
"75",
"76",
"77"
],
[
"81",
"82",
"83",
"84",
"85",
"86",
"87"
],
[
"91",
"92",
"93",
"94",
"95",
"96",
"97"
],
[
"101",
"102",
"103",
"104",
"105",
"106",
"107"
],
[
"111",
"112",
"113",
"114",
"115",
"116",
"117"
]
]
From there, you can do what you need with the data.

Can AggregateRating in Schema Be Extended to include a Source or URL Property?

I don't really know if there is a way around it, kindly chip in your suggestions.
I think aggregateRating of an entity is limiting in schema markup. If there is a possibility of extension I believe an attribute such as source or url would be great because we can tell from which source the rating is coming from.
Challenge scenario:
I am marking up a schema for a book, this book has ratings on both goodreads.com and amazon.com. Both ratings are different, however, there is no way to account for the different aggregate ratings since it is not available at the moment. I don't think it is cool to just take an average.
Right now:
"keys": "values",
"aggregateRating": {
"#type": "AggregateRating",
"reviewCount": "25",
"ratingValue": "5"
},
Suggestion:
"keys": "values",
"aggregateRating": [
{
"#type": "AggregateRating",
"reviewCount": "25",
"ratingValue": "5",
"source": "https://amzn.com/product/url/reviews"
},
{
"#type": "AggregateRating",
"reviewCount": "5",
"ratingValue": "4",
"source": "https://gdreads.com/product/url/reviews"
}
],

Deserializing JSON in Visual basic

I want to deserialize this string, it is from a rest api, but i dont know how to do it.
i know i have to create a class with the struture of the string, and i have to run the command with deserialize.
Can anyone help me?
Thanks
"
{
"success": true,
"data": {
"categories": {
"17": [
{
"category_id": "17",
"name": "Software",
"description": "",
"sort_order": "4",
"meta_title": "",
"meta_description": "",
"meta_keyword": "",
"language_id": "1",
"image": "http://newapi3.opencart-api.com/image/cache/catalog/categories/12316636179756542373092288841575795860377n-100x100.jpg",
"categories": null
},
{
"category_id": "17",
"name": "Software",
"description": "",
"sort_order": "4",
"meta_title": "",
"meta_description": "",
"meta_keyword": "",
"language_id": "2",
"image": "http://newapi3.opencart-api.com/image/cache/catalog/categories/12316636179756542373092288841575795860377n-100x100.jpg",
"categories": null
}
],
"18": [
{
"category_id": "18",
"name": "Laptops & Notebooks",
"description": "<p>\r\n\tShop Laptop feature only the best laptop deals on the market. By comparing laptop deals from the likes of PC World, Comet, Dixons, The Link and Carphone Warehouse, Shop Laptop has the most comprehensive selection of laptops on the internet. At Shop Laptop, we pride ourselves on offering customers the very best laptop deals. From refurbished laptops to netbooks, Shop Laptop ensures that every laptop - in every colour, style, size and technical spec - is featured on the site at the lowest possible price.</p>\r\n",
"sort_order": "2",
"meta_title": "",
"meta_description": "",
"meta_keyword": "",
"language_id": "1",
"image": "http://newapi3.opencart-api.com/image/cache/catalog/demo/hp_2-100x100.jpg",
"categories": null
},
{
"category_id": "18",
"name": "Laptops & Notebooks",
"description": "<p>\r\n\tShop Laptop feature only the best laptop deals on the market. By comparing laptop deals from the likes of PC World, Comet, Dixons, The Link and Carphone Warehouse, Shop Laptop has the most comprehensive selection of laptops on the internet. At Shop Laptop, we pride ourselves on offering customers the very best laptop deals. From refurbished laptops to netbooks, Shop Laptop ensures that every laptop - in every colour, style, size and technical spec - is featured on the site at the lowest possible price.</p>\r\n",
"sort_order": "2",
"meta_title": "",
"meta_description": "",
"meta_keyword": "",
"language_id": "2",
"image": "http://newapi3.opencart-api.com/image/cache/catalog/demo/hp_2-100x100.jpg",
"categories": null
}
]
}
}
}"
Use this service to generate classes from JSON strings. It will save you a lot of time (and headache).
After that, you might consider using a third-party library for deserializing the JSON string. You have quite a few options but the most popular and the best according to me, is JSON.NET.
After you have installed it, you can go forward and access whatever data you want after deserializing the JSON.
Example:
Dim data = JsonConvert.DeserializeObject(Of YourDataClass)("<YourJSONString>");
If data.Success Then
Console.WriteLine(data.Data.Categories(0).Name);
End If

Yodlee getSiteLoginForm API response changes between attempts

There seems to be an inconsistency with the responses for Yodlee's getSiteLoginForm REST API function.
For a site that has a login field with radio buttons, sometimes the data coming back from Yodlee for that particular field will look like this:
{
"fieldInfoList": [
{
"validValues": [
"1",
"2",
"3",
"4"
],
"displayValidValues": [
"1",
"2",
"3",
"4"
],
"valueIdentifier": "OPTIONS",
"valueMask": "LOGIN_FIELD",
"fieldType": {
"typeName": "OPTIONS"
},
"size": 20,
"maxlength": 40,
"name": "OPTIONS",
"displayName": "Issue Number",
"isEditable": true,
"isOptional": false,
"isEscaped": false,
"helpText": "76367",
"isOptionalMFA": false,
"isMFA": false
}
]
}
and other times it looks like this:
{
"validValues": [
"1",
"2",
"3",
"4"
],
"displayValidValues": [
"1",
"2",
"3",
"4"
],
"valueIdentifier": "OPTION",
"valueMask": "LOGIN_FIELD",
"fieldType": {
"typeName": "OPTIONS"
},
"size": 20,
"maxlength": 40,
"name": "OPTION",
"displayName": "Issue Number",
"isEditable": true,
"isOptional": false,
"isEscaped": false,
"helpText": "76367",
"isOptionalMFA": false,
"isMFA": false
}
It's the same field but the valueIdentifier value has changed and the data isn't being enclosed in a fieldInfoList variable.
What would be the reason for this response data-set changing between two attempts if there's no difference in the code?
In addition to that, could a similar response inconsistency be affecting other API functions from Yodlee, and if so how does one deal with this uncertain variance?
We did analysis and Yodlee provides every time same response, no matter how many attempts you'll do. While I am assuming that you might be confused between getSiteLoginForm and getLoginFomForContentService, as both are two different APIs and belongs to approach i.e., Site Based and Container Based respectively. And the response you have mentioned first comes when you use getSiteLoginForm while the later one comes with getLoginFormForContentService.
Hope this helps as there is no issue with the API, these are two different response from 2 different APIs.

How can I get a list of all the projects in our Rally instance via the REST API?

How can I query our Rally instance for all of our available projects?
Output from REST call https://rally1.rallydev.com/slm/webservice/1.29/subscription.js?fetch=Workspaces,Name,Projects&pretty=true
...
"Workspaces": [
{
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "29",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.29/workspace/1376977801.js",
"_objectVersion": "10",
"_refObjectName": "Workspace 1",
"Name": "Workspace 1",
"Projects": [ {
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "29",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.29/project/2510231094.js",
"_objectVersion": "3",
"_refObjectName": "Layout",
"Name": "Layout",
"_type": "Project"
}],
"_type": "Workspace"
},
{
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "29",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.29/workspace/1462743357.js",
"_objectVersion": "8",
"_refObjectName": "Bugzilla Workspace",
"Name": "Bugzilla Workspace",
"Projects": [ {
"_rallyAPIMajor": "1",
"_rallyAPIMinor": "29",
"_ref": "https://rally1.rallydev.com/slm/webservice/1.29/project/2510231094.js",
"_objectVersion": "3",
"_refObjectName": "Layout",
"Name": "Layout",
"_type": "Project"
}],
"_type": "Workspace"
},
...
Update #2
The user account being used for the API calls is indeed a subscription admin. I tried a few things with our admin to try and narrow down the problem as to what is occurring and noted a few things:
The projects that are getting returned in the call, are not projects that the api user is a team member of
When we assigned a story to the api user and refreshed the result of the REST call, the projects that were returned in every workspace were identical and seemed to be all of the projects from the given workspace of the project that we assigned the story from. For example, I've pasted the top part of a return: http://khayes.privatepaste.com/cfc730dcf8
It appears this particular REST call has a bug in it.
This should be possible by querying on type 'Subscription'. Make sure you include Workspaces and Projects (and any other data you might want like Name) in your Fetch.
https://rally1.rallydev.com/slm/webservice/1.29/subscription.js?fetch=Workspaces,Projects,Name&pretty=true
The results should look something like this:
{
_ref: "/subscription/1.js",
_refObjectName: "My Subscription",
Workspaces: [
_ref: "/workspace/2.js"
_refObjectName: "My Workspace",
Projects: [
{
_ref: "/project/3.js"
_refObjectName: "Project 1"
}
]
]
}
The REST URL would look like this
https://rally1.rallydev.com/slm/webservice/1.29/subscription?fetch=Workspaces,Name,Projects
I tried in postman with basic authentication: username and password of rally:
All APIs are inter related : let us see step by step and always notice the _ref in your response.
Step 1: First you want the subscription.
https://rally1.rallydev.com/slm/webservice/v2.0/subscription?fetch=Workspaces,Name,Projects
It will return subscription ID suppose it is X.
Step 2: Find the workspaces in that subscription. Put X value as subscription shown below.
https://rally1.rallydev.com/slm/webservice/v2.0/Subscription/X/Workspaces
It will return the workspace id. Let us say it Y.
Step 3: Find the projects in the workspace.
https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/Y/Projects?fetch=ObjectID
There will be URLs in the response which refers to your projects associated to your workspace.
OR,
if you know your workspace ID then use below api: your_WS_id= your workspace ID in below request. just replace this.
https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/your_WS_ID/Projects?fetch=Name
I hope it helps.