question

oleg avatar image
0 Likes"
oleg asked Jeanette F commented

How to find out how many messages have been sent?

How to find out how many messages have been sent?For example in this code

Object current = ownerobject(c);

Object fromObject = param(1);

Variant msgparam1 = param(2);

Variant msgparam2 = param(3);

Variant msgparam3 = param(4);


{ // ************* PickOption Start ************* //

/***popup:CloseOpenPortsByCase*/

/**Close and Open Ports Based on Cases*/


Variant value = /***tag:value*//**/msgparam(1)/**/;


/***tagex:data*/

if (value == /**/1/**/) {

/**/current.input.close()/**/; return 0;

}


if (value == /**/2/**/) {

/**/current.input.open()/**/; return 0;

}

/***/


/***tag:default_value*//**//**/;


} // ******* PickOption End ******* //


FlexSim 24.0.3
message triggersend messagemessages
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

oleg avatar image oleg commented ·

On Entry

Object current = ownerobject(c);

Object item = param(1);

int port = param(2);

{ // ************* PickOption Start ************* //

/***popup:SendMessage*/

/**Send Message*/

int NoDelay = -1;

double delaytime = /** \nDelay Time: *//***tag:delaytime*//**/0/**list:NoDelay~0~10~current.messageDelay*/;

treenode toobject = /** \nTo: *//***tag:to*//**/current/**/;

treenode fromobject = /** \nFrom: *//***tag:from*//**/current/**/;

double param1 = /** \nParam1: *//***tag:par1*//**/1/**/;

double param2 = /** \nParam2: *//***tag:par2*//**/0/**/;

double param3 = /** \nParam3: *//***tag:par3*//**/0/**/;

/**\n\nDelay Time:\nNoDelay: message sent immediately within trigger context\n0: delayed message sent in 0 time*/

if (/** \nCondition: *//***tag:condition*//**/content(current) == 1/**/) {

if (delaytime == NoDelay)

sendmessage(toobject,fromobject,param1,param2,param3);

else senddelayedmessage(toobject, max(0,delaytime), fromobject,param1,param2,param3);

}


} // ******* PickOption End ******* // On Exit

Object current = ownerobject(c);

Object item = param(1);

int port = param(2);

{ // ************* PickOption Start ************* //

/***popup:SendMessage*/

/**Send Message*/

int NoDelay = -1;

double delaytime = /** \nDelay Time: *//***tag:delaytime*//**/0/**list:NoDelay~0~10~current.messageDelay*/;

treenode toobject = /** \nTo: *//***tag:to*//**/current/**/;

treenode fromobject = /** \nFrom: *//***tag:from*//**/current/**/;

double param1 = /** \nParam1: *//***tag:par1*//**/2/**/;

double param2 = /** \nParam2: *//***tag:par2*//**/0/**/;

double param3 = /** \nParam3: *//***tag:par3*//**/0/**/;

/**\n\nDelay Time:\nNoDelay: message sent immediately within trigger context\n0: delayed message sent in 0 time*/

if (/** \nCondition: *//***tag:condition*//**/content(current)<=1/**/) {

if (delaytime == NoDelay)

sendmessage(toobject,fromobject,param1,param2,param3);

else senddelayedmessage(toobject, max(0,delaytime), fromobject,param1,param2,param3);

}


} // ******* PickOption End ******* //


0 Likes 0 ·

Hi @oleg, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered oleg commented

This is an on message trigger source code. You can add a template to increment a label at this object.

Edit: You can cut the code lines to increment a label from increment label template and insert it in each code block responsible to send a message.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

oleg avatar image oleg commented ·

so i have thismodel_10.fsm

0 Likes 0 ·
model-10.fsm (35.6 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.