I'm using UPPAAL, and I'm trying to model a shoe factory, where 5 systems run paralelly. I can write on this more detailed if someone needs it, but I do not want to waste anyones time by describing the model.
So straight to the problem:UPPAAL deadlock state
On the picture in the link the automaton cannot make the red transition. The transitions only criteria is that p >= 4, but as I have marked, this should be fine, as p=21.
So why cant it make the transition?
You can find the source on the below link:
https://drive.google.com/open?id=1zuige_JBTPA7kZJPwE5cocWCzY6eh8UL
Any help is highly appreciated!
I am interested in the reason for the deadlock in particular, and why the transition is not possible, even though I was trying to force the transition
(sorry, but I do not have the level to upload images:()
Edit1:
As some people claimed the code is not accessible,so I will paste the 2 files for UPPAAL as below:
hf_elso_1.xml:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_1.dtd'><nta><declaration>// Place global declarations here.
chan ontoindul, talpontkesz, talpakkeszen, felsoreszkesz;
clock t1,t2,t3,globalClock;
int p, to, talp, fr,cipo;</declaration><template><name x="5" y="5">talponto</name><declaration>// Place local declarations here.
</declaration><location id="id0" x="-24" y="-216"></location><location id="id1" x="-464" y="240"><committed/></location><location id="id2" x="-464" y="-24"><label kind="invariant" x="-536" y="-48">t1<=500</label></location><location id="id3" x="-24" y="-80"><committed/></location><location id="id4" x="-24" y="-152"><label kind="invariant" x="0" y="-160">t1<=800</label></location><location id="id5" x="-24" y="64"><label kind="invariant" x="-32" y="80">t1<1</label></location><location id="id6" x="-24" y="-288"><name x="-34" y="-318">start</name></location><init ref="id6"/><transition><source ref="id0"/><target ref="id4"/><label kind="synchronisation" x="-96" y="-192">ontoindul!</label></transition><transition><source ref="id6"/><target ref="id0"/><label kind="assignment" x="-80" y="-264">p:=40</label></transition><transition><source ref="id2"/><target ref="id1"/><label kind="assignment" x="-528" y="112">p=p-4</label></transition><transition><source ref="id1"/><target ref="id5"/><label kind="assignment" x="-384" y="216">to:=to+1</label></transition><transition><source ref="id5"/><target ref="id2"/><label kind="guard" x="-352" y="-48">p>=4</label><label kind="synchronisation" x="-352" y="-32">ontoindul!</label><label kind="assignment" x="-352" y="-16">t1:=0</label></transition><transition><source ref="id3"/><target ref="id5"/><label kind="assignment" x="-124" y="-40">to:=to+1,p:=p-4</label><nail x="-24" y="8"/><nail x="-24" y="16"/></transition><transition><source ref="id4"/><target ref="id3"/><label kind="assignment" x="-96" y="-120">t1:=0</label></transition></template><template><name>talpkeszito</name><location id="id7" x="88" y="120"><committed/></location><location id="id8" x="-208" y="120"><label kind="invariant" x="-256" y="136">t1<=100</label></location><location id="id9" x="-72" y="-80"></location><init ref="id9"/><transition><source ref="id7"/><target ref="id9"/><label kind="assignment" x="-52" y="20">to=to-3</label></transition><transition><source ref="id8"/><target ref="id7"/><label kind="assignment" x="-120" y="144">talp=talp+5</label></transition><transition><source ref="id9"/><target ref="id8"/><label kind="guard" x="-200" y="-10">to>2</label><label kind="synchronisation" x="-200" y="5">ontoindul?</label></transition></template><template><name>felsvag</name><location id="id10" x="112" y="-168"><label kind="invariant" x="102" y="-153">t1<=200</label></location><location id="id11" x="368" y="-176"><label kind="invariant" x="352" y="-224">t1<=100</label></location><location id="id12" x="-80" y="16"></location><location id="id13" x="-80" y="-168"></location><init ref="id13"/><transition><source ref="id10"/><target ref="id12"/><label kind="guard" x="-40" y="-144">p>0</label><label kind="assignment" x="-40" y="-128">p=p-1, fr=fr+5</label></transition><transition><source ref="id11"/><target ref="id10"/><label kind="guard" x="200" y="-208">p>0</label><label kind="assignment" x="180" y="-172">p=p-1, fr=fr+5</label></transition><transition><source ref="id12"/><target ref="id11"/><label kind="guard" x="224" y="96">fr<20</label><label kind="synchronisation" x="216" y="112">ontoindul?</label><nail x="196" y="110"/></transition><transition><source ref="id13"/><target ref="id12"/><label kind="guard" x="-152" y="-144">p>0</label><label kind="synchronisation" x="-152" y="-128">ontoindul?</label><label kind="assignment" x="-152" y="-112">p=p-1</label></transition></template><template><name>Varras</name><declaration>int osszcipo;</declaration><location id="id14" x="232" y="-216"><label kind="invariant" x="232" y="-192">t2<=10</label></location><location id="id15" x="-24" y="-208"></location><init ref="id15"/><transition><source ref="id14"/><target ref="id15"/><nail x="104" y="-328"/></transition><transition><source ref="id15"/><target ref="id14"/><label kind="guard" x="40" y="-88">talp>0 and fr>1</label><label kind="assignment" x="40" y="-72">cipo=cipo+1, talp=talp-1, fr=fr-2, t2=0,osszcipo=osszcipo+1</label><nail x="104" y="-104"/></transition></template><template><name>Kereskedo</name><location id="id16" x="16" y="-104"><label kind="invariant" x="32" y="-96">t3<=100</label></location><location id="id17" x="-184" y="-104"></location><init ref="id17"/><transition><source ref="id16"/><target ref="id17"/><nail x="-80" y="-200"/></transition><transition><source ref="id17"/><target ref="id16"/><label kind="guard" x="-48" y="16">cipo>2</label><label kind="assignment" x="-80" y="48">cipo=cipo-2,p=p+4,t3=0</label><nail x="-88" y="16"/></transition></template><system>// Place template instantiations here.
To = talponto();
Tk = talpkeszito();
Fv = felsvag();
V = Varras();
K = Kereskedo();
// List one or more processes to be composed into a system.
system To,Tk,Fv,V,K;</system></nta>
And below you can find the queries I created for system checking:
hf_elso_1.q:
//This file was generated from (Commercial) UPPAAL 4.0.14 (rev. 5615), May 2014
/*
*/
A[] !deadlock
/*
*/
E<> p>=41
/*
*/
E<> (cipo==1 and p>=26)
/*
*/
E<> (p==0 and talp==0 and fr==0 and to==0)
/*
*/
E<> p>=0 imply V.osszcipo>=5
/*
*/
E<> (V.osszcipo>=10)
So I found out what was my problem, and below are some rules of thumb for uppaal channel synchronization:
1. If you use a normal channel declaration, then the sender (marked with !) will not be able to move on if the guard on the receiver side (marked with ?) is not fulfilled.
2. To avoid the first anomaly, declare the channel as broadcast, so the sender will always be able to move on even though the receiver guard is not fulfilled.
I hope this will be useful for future users of UPPAAL.
Related
I have one rect tag as mentioned below, I am able to locate its position but now when i perform right click on it it can not perform any operation.
Is there any solution for it?
<rect class="" stroke-dasharray="" vector-effect="" height="22" width="22" y="0" x="0" visibility="visible" stroke-width="1" fill="rgba(255,255,255,255)" stroke="rgba(0,0,0,255)" transform="matrix(1 0 0 1 169 -11)"></rect>
You can perform right click operation in Selenium using Actions class. Here's a sample of it -
Actions actions = new Actions(driver);
actions.contextClick(WebElement).build().perform(); //pass your rect WebElement as an argument
Hope this helps.
You can try this code
Actions action= new Actions(driver);
action.contextClick(productLink).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();
If you want to click on any specified webElement,
change productLink to driver.findElement(By.id("ID"));
I am working on a sample map application using Flex 4/fxg? Now I have got FXG paths held in Group elements with id's( I have assigned path's id's to the corresponding group container)? But when I click anywhere in the map, I do not get the clicked group as target/currentTarget in event handler.
How to determine which element is clicked?
Code sample:
<Graphic xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:view="view.*"
version="2.0" viewWidth="1425" viewHeight="1140">
----
----
<view:GraphicItem id="CityofLondon">
<Path data="path data" winding="evenOdd">
<fill>
<SolidColor color="#FEFEE9" alpha="1"/>
</fill>
<stroke>
<SolidColorStroke color="#646464" alpha="1" weight="2" miterLimit="10" joints="round" caps="round"/>
</stroke>
</Path>
</view:GraphicItem>
<view:GraphicItem id="BarkingandDagenham">
<Path data="path data" winding="evenOdd">
<fill>
<SolidColor color="#FEFEE9" alpha="1"/>
</fill>
<stroke>
<SolidColorStroke color="#646464" alpha="1" weight="2" miterLimit="10" joints="round" caps="round"/>
</stroke>
</Path>
</view:GraphicItem>
----
------
</Graphic>
GraphicItem is Group container.
Any help would be greatly appreciated. Thanks.
I asked a similar question, and it is answered here:
Flex Path - capturing Click event
Had to set the mouseEnabledWhereTransparent="false" to a Group, and add the FXG path to that group.
I've created a Flex website that plays a video using the Spark VideoDisplay component.
When selected, the VideoDisplay loads in the PopUpManager.
This works fine in all the browsers, except Google Chrome take significantly longer to start playing, during which the CPU usage peaks, then goes back down once video starts playing.
I've traced the player states it goes through and they are as follows:
Loading
ready (hangs for ages with high cpu)
buffering
playing (immediately after buffering, CPU usage goes down, video plays smoothly)
What could be causing this to temporarily hang for so much longer in Chrome? I thought I could expect the same functionality and behaviour throughout all the browsers, as Flash is simply a plugin that runs as a separate process?
Thanks!
Edit: It seems that it's the same in Opera too. Is there any commonality between the two that would explain this behaviour?
Edit 2: Thanks for your reply, here's the relevant code:
MXML:
<s:Group id="videoPopup"
click="closePopupHandler(event)">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="#2a2a2a"/>
</s:fill>
</s:Rect>
<spinner:Spinner id="spinner"
tickColor="#ffffff"
horizontalCenter="0" verticalCenter="0"/>
<s:VideoDisplay id="videoDisplay" width="100%" height="100%"
updateComplete="videoDisplay_updateCompleteHandler(event)"
mediaPlayerStateChange="videoDisplay_mediaPlayerStateChangeHandler(event)"
complete="videoCompleteHandler(event)"/>
<graphics:CloseButton id="closeVideoButton" visible="false" width="60" height="60" top="10" right="10"/>
<s:Label id="videoCredit" text="Filmed & produced by Engine Creative"
bottom="25" right="10" alpha="0"
fontFamily="HelveticaEmbedded" fontSize="11" color="#cccccc"/>
</s:Group>
Initiating actionscript:
PopUpManager.addPopUp(this.videoPopup, FlexGlobals.topLevelApplication as DisplayObject, true);
videoPopup.width = Math.min(1280, stage.stageWidth * 0.9);
videoPopup.height = Math.min(720, stage.stageHeight * 0.9);
PopUpManager.centerPopUp(this.videoPopup);
hidePlayOverlay.play();
showVideoCredit.end();
spinner.play();
showCreditTimer.addEventListener(TimerEvent.TIMER_COMPLETE, showCredit);
showCreditTimer.reset();
showCreditTimer.stop();
if(!videoDisplay.source || videoDisplay.source != _asset.source)
videoDisplay.source = _asset.source;
videoDisplay.seek(0);
videoDisplay.play();
And relevant event handlers:
protected function videoDisplay_updateCompleteHandler(event:FlexEvent):void
{
Debug.log("video update complete");
if (videoDisplay.videoObject)
videoDisplay.videoObject.smoothing = true;
}
protected function videoDisplay_mediaPlayerStateChangeHandler(event:MediaPlayerStateChangeEvent):void
{
Debug.log("player state: " + event.state);
showCreditTimer.reset();
if (event.state == MediaPlayerState.PLAYING)
{
showCreditTimer.start();
showCloseButton();
spinner.stop();
}
}
Thanks again!
Hardware acceleration is partially supported by default if you have a supported GPU. If you want full 3d support, you need to use StageVideo and need to set the 'wmode' param in html to 'direct'. You should read up more on it.
I have a flex pie chart:
<mx:PieChart alpha="0.9" fontSize="{QPieSeries_font}" width="100%" top="20" height="320" id="QPieChart"
dataProvider="{dataObj}" horizontalCenter="0" color="0xFFFFFF" fontFamily="MyriadWebPro"
showDataTips="true" dataTipFunction="QdataTipFunction"
dataTipItemsSet="true" itemClick="QPieChart_itemClickHandler(event)">
<mx:series>
<mx:PieSeries id="QPieSeries" labelField="Answer" field="Value" labelPosition="callout"
showDataEffect="QSeriesInterpolate" alpha="1"
reserveExplodeRadius="0.05"/>
</mx:series>
</mx:PieChart>
where the QSeriesInterpolate is a simple interpolation given in the declaration:
<fx:Declarations>
<mx:SeriesInterpolate id="QSeriesInterpolate" duration="500" />
</fx:Declarations>
and the item click event looks like:
protected function QPieChart_itemClickHandler(event:ChartItemEvent):void
{
var ExAr:Array = [];
ExAr[event.hitData.chartItem.index] = 0.05;
QPieSeries.perWedgeExplodeRadius = ExAr;
}
Basically, what annoys me is that when I click a segment to activate the interpolated event, the datatips disappear for it's duration. Whilst this is only half a second, it still detracts from user experience. Is there anything I can do to avoid it??
ALSO! Another thing: Is it obvious to anyone why my dataTipFunction doesnt work? It looks as follows:
public function QdataTipFunction(hitData:HitData):String
{
var a:String = "abc"
return a;
}
Yes it's simple but I was just trying to persuade it to work... to no avail. I think it might be some sort of font issue?
Thanks!
Josh
You might consider looking into Axiis. It is a flex data visualization framework, and has some awesome example charts. The main deal though is you have full control over EVERTHING! Probably overkill for what you are doing, but it really is awesome.
http://www.axiis.org/examples.html
I want to use an AreaSeries to display the content of an arrayCollection (the cell values are displayed on the y axis).
The Array collection is dataManager.tagViewTimelineModel.summedPopularity
<mx:AreaSeries id="timeArea" styleName="timeArea" name="A" dataProvider="dataManager.tagViewTimelineModel.summedPopularity" areaStroke="{new Stroke(0x0033CC, 2)}" areaFill="{new SolidColor(0x0033CC, 0.5)}" />
But it doesn't work, the graph is empty....
Am I doing something wrong ?
This is the full code for completeness.
mx:CartesianChart id="AllChart" dataProvider="{dataManager.tagViewTimelineModel.tags}" width="100%" height="100">
<mx:horizontalAxis><mx:CategoryAxis id="horiz1" dataProvider="['1','2','3','4','5','6','7','8','9','10','11','23','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']"/></mx:horizontalAxis>
<mx:horizontalAxisRenderers><mx:AxisRenderer axis="{horiz1}"/></mx:horizontalAxisRenderers>
<mx:verticalAxis><mx:LinearAxis id="vert1" /></mx:verticalAxis>
<mx:verticalAxisRenderers><mx:AxisRenderer axis="{vert1}"/></mx:verticalAxisRenderers>
<mx:series>
<mx:AreaSeries id="timeArea" styleName="timeArea" name="A" dataProvider="dataManager.tagViewTimelineModel.summedPopularity" areaStroke="{new Stroke(0x0033CC, 2)}" areaFill="{new SolidColor(0x0033CC, 0.5)}" />
</mx:series>
</mx:CartesianChart>
thanks
I think you might need { } around your dataProvider for your AreaSeries declaration. You have it on top for your chart but you probably overrode it below.