ResultLand Posted October 12, 2018 Share Posted October 12, 2018 Hi, I have a PersonEntity and I would like have different behaviour to it depending on whether it's a woman or a man (and obviously the symbols have to be correct). That's why I figured that 2 object instances would be a good approach, 1 male and 1 female. But now I wonder what my approach should be in the rest of the modelling. For example if I want to randomly spawn females and males from a source, how do I express this in the entity type, as I have to choose there between male and female already. How do I refer in expressions to the object instance? f.e. IF(male); do command So I have 3 questions: 1) is my strategy good? 2) how do I dynamically change the entity type in sources? 3) how do I use object instances (or object types) in expressions like if-statements? Thank you so much in advance, Jarek Result Link to comment Share on other sites More sharing options...
jzhou Posted October 13, 2018 Share Posted October 13, 2018 (edited) please don't use many object to represent female or male. just use one Entity class. you can define a statevariable called gendertype to the Entity Class. then either assign it to 0(male), or 1(female). in the source ,just create the Entity ,and assign ModelEntity.gendertype with random distribution such as Uniform(0,1)..or any empirical distribution you like. If statement : if ModelEntity.gendertype=0 , then Do something.. For the symbol. you can just use the symbol index as ModelEntity.gendertype, and make sure the index 0 is a female symbol and 1 is a male symbol.. Edited October 13, 2018 by jzhou Link to comment Share on other sites More sharing options...
Recommended Posts