Open xiangyuanhang opened 5 years ago
The easiest way to do that is to start the second group in a "waiting" state that has a 5-second timer transition out of it and into a "walking" state.
On Sat, Feb 2, 2019 at 1:29 AM XIANG Yuanhang notifications@github.com wrote:
Hi, I wonder if it's possible to start different groups of agent at different time? For example, group1 starts immediately after clicking the space, group2 starts 5 seconds after clicking the space.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MengeCrowdSim/Menge/issues/109, or mute the thread https://github.com/notifications/unsubscribe-auth/AH8tK3DzAE69Q3WzrTsWW9VIegmaTaDuks5vJVpYgaJpZM4afgmx .
There are two PRs in flight: #110 and #111.
If you look at the example in #111 (examples\core\events\change_state_effect), you'll see a case where the movement of two groups isn't coordinated by a timer, but by events.
PRs #110 and #111 have now been merged.
So, there are now a couple solutions to your question:
Thanks for your answers! For adding a 5-second timer, I have tried to modify pedModelSwapB.xml, haven't succeeded yet. Could you please tell me how to modify pedModelSwapB.xml and any other files if necessary?
I've created a gist: https://gist.github.com/curds01/025c125fdeef5fd7dc31076d6d4ee145#file-pedmodelswapb_delayed_movement-xml-L38
This is based on the new example created in #111. That, in turn, is a simplification of the pedModelSwapB.xml
file. I would emphasize several things:
WaitLeft
WaitLeft
to MoveLeft
that depends on a 3-second timer. MoveLeft
should be changed to WaitLeft
.Thanks for your answer! I downloaded the lastest version but I have been running into these errors when building "MengeCore.vcxproj" . Is there something wrong with EventEffectDB.cpp?
2>EventEffectDB.obj : error LNK2001: unresolved external symbol "public: virtual void thiscall Menge::ChangeStateEffect::finalize(void)" (?finalize@ChangeStateEffect@Menge@@UAEXXZ)
2>EventEffectDB.obj : error LNK2001: unresolved external symbol "protected: virtual void thiscall Menge::ChangeStateEffect::agentEffect(class Menge::Agents::BaseAgent )" (?agentEffect@ChangeStateEffect@Menge@@MAEXPAVBaseAgent@Agents@2@@Z)
2>EventEffectDB.obj : error LNK2019: unresolved external symbol "public: thiscall Menge::ChangeStateEffectFactory::ChangeStateEffectFactory(void)" (??0ChangeStateEffectFactory@Menge@@QAE@XZ) referenced in function "public: static void cdecl Menge::ElementDB<class Menge::EventEffectFactory,class Menge::EventEffect>::addBuiltins(void)" (?addBuiltins@?$ElementDB@VEventEffectFactory@Menge@@VEventEffect@2@@Menge@@SAXXZ)
2>EventEffectDB.obj : error LNK2001: unresolved external symbol "protected: virtual bool __thiscall Menge::ChangeStateEffectFactory::setFromXML(class Menge::EventEffect ,class TiXmlElement *,class std::basic_string<char,struct std::char_traits
Sorry about the linking difficulty. Which VS project are you using? I hadn't tested either VS2015 or VS2013 and there could be an error there. It seems like the ChangeStateEffect
symbols aren't being properly exported.
Try pulling PR #113; it's the 2017 project that I was working in.
Also, PR #114 corrects the oversight of not having included the change effect in the projects.
Thanks for your answer! I have successfully built the project vs2017 and I made the three changes you have emphasized:
WaitLeft
(in pedModelSwapB.xml)WaitLeft
to MoveLeft
(in pedModelSwapB,xml)
https://gist.github.com/xiangyuanhang/24819ad80671b21fcfa205afa0c2d795WaitLeft
(in pedModelSwapS.xml)
https://gist.github.com/xiangyuanhang/9017cde8c6e0806856a83b8c5aa5dfbe
But the simulation still fails...It returns
Simulation terminated through error. See error log for details.
Where could we find the error log?
Thanks
It writes to a file called log.html
in the Exe
directory. That should give you some information about how things are.
Did you try running the examples/core/events/change_state_effect/change_state.xml
example? Can you confirm that runs?
Also, I didn't test the XML I'd put in the gist, I may have introduced an error there. I'd start with the example I indicated just above (change_state.xml
).
Thanks for your answer!
I have confirmed change_state.xml
. It runs perfectly.
So I suppose this could be the problem with the timer.
For XML containing a timer, it returns these errors according to error log:
So, in that case, it's just badly formatted XML. Tinyxml parsed it and said, "This isn't real xml". If you dump the contents of that file into an online XML linter it'll tell you more detail about the problem.
Thanks for your answer! I did make some syntax errors with xml file (sorry for that) and I corrected them. And now I ran into these errors, it seemed that there is something wrong with timer:
The error message says you're missing an attribute on the "timer" condition. Specifically, the per_agent
attribute. It should look something like:
<Condition type="timer" per_agent="0" dist="c" value="10" />
(By the way, the gist links you provided above aren't valid.)
Thanks for your answer!
Yes I did miss per_agent
attribute.
Now it works!
Many THANKS for your help !
BTW, Sorry for the unvalid gist links, the corrected links are as follows (the final version which works): https://gist.github.com/xiangyuanhang/9017cde8c6e0806856a83b8c5aa5dfbe https://gist.github.com/xiangyuanhang/24819ad80671b21fcfa205afa0c2d795
Glad it's working for you.
This underscores the difficulty in authoring scenarios. That puts a little more weight on the scales of providing a tool that makes it easier to create scenarios....
Hi, I wonder if it's possible to start different groups of agent at different time? For example, group1 starts immediately after clicking the space, group2 starts 5 seconds after clicking the space. Thanks