Cancel
Showing results for 
Search instead for 
Did you mean: 

creating an entity user-defined attribute

Valued Contributor
Valued Contributor

Dear community members,

I'm using a ParallelProc to generate entities with the following "init" user-defined attribute:

is
do
		
	.MUs.Customer.create(self.~);
	
		-- call this method again later to create the next batch
	self.methCall(z_weibull(1, 1.4, 2.6e+002));
end;

I need to create a user defined attribute for the entity being created (Customer) having the value "n" of the following  code:

-- generate an integer from 1 to 21 (including both 1 and 21)
	local n: integer := z_uniform(2, 1, 22);

	if n <=  4 then  
		n := 2;   
	elseif n <= 9 then 
		n := 3; 
	elseif n <= 15 then 
		n := 4;
	elseif n <= 18 then
		n := 5;
	elseif n <= 21 then
		n := 6;		   

Can I do it in the init methos of the ParallelProc without creating a global variable? How? 

8 REPLIES

Re: creating an entity user-defined attribute

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

first create a user defined attribute n in the customer in the class library. Then you can set this attribute in your init-method of the parallelproc:

is
    customer:object;
do
		
  customer:=.MUs.Customer.create(self.~);
  
  -- generate an integer from 1 to 21 (including both 1 and 21)
local n: integer := z_uniform(2, 1, 22);

if n <=  4 then 
n := 2;  
elseif n <= 9 then
n := 3;
elseif n <= 15 then
n := 4;
elseif n <= 18 then
n := 5;
elseif n <= 21 then
n := 6;
end;
--set the Attribute
customer.n:=n; -- call this method again later to create the next batch self.methCall(z_weibull(1, 1.4, 2.6e+002)); end;
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: creating an entity user-defined attribute

Valued Contributor
Valued Contributor
Dear Steffen,
thank you for your reply.
The customers get blocked at the parallelproc. I tried with "self.cont.move" but it gives the error:"unknown identifier cont".
Can you find any mistake?

Re: creating an entity user-defined attribute

Valued Contributor
Valued Contributor
Dear Steffen,
thank you for your reply.
The customers get blocked at the parallelproc. I tried with
"self.cont.move" but it gives the error:"unknown identifier cont".
Can you find any mistake?

Re: creating an entity user-defined attribute

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

How the ParallelProc is connected to the next station? Do you use an exit-control?

self refers in this case to the method, for accessing the parallelProc (if init is a internal method) you need to call: self.~.cont.move.

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: creating an entity user-defined attribute

Valued Contributor
Valued Contributor
It is working. Only one last issue.
i have a method as ParallelProc exit control with the following code:
------------
is
do
print @.people; -- people is the user defined attribute (I called it "people" instead of "n")
end;
------------------

But it does not print anything. It is like the entity jumps the exit control

Re: creating an entity user-defined attribute

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

is your exit-control front or rear?

 

Try rear, I guess your MUs doesnt trigger the exit control front.

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: creating an entity user-defined attribute

Valued Contributor
Valued Contributor
With rear it works! But why with front it does not?

Re: creating an entity user-defined attribute

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

the exit control is triggered only, when the station has finished its work (process time). If you create a MU and move it directly after by SimTalk, this doesn't happen (you move the part before it can trigger the exit-control front). But you trigger with move the exit contol rear (when the MU left the station).

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net