Cancel
Showing results for 
Search instead for 
Did you mean: 

Global Array

Pioneer
Pioneer

How can a make a global variable in Plant Sim into a one dim array ?

6 REPLIES 6

Re: Global Array

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

you can use the data type list, but you need to set a data type for the list

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

Re: Global Array

Pioneer
Pioneer

I can...but I cant use the list in a waituntil statement, which is what I am trying to do.

I have a track with a bunch of sensor. I want the transport to waituntil the sensor ahead is free before proceeding.

I figure if i had a global array would help with this.

But the waituntil statement doesnt work with list or table

Re: Global Array

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
how do you want to check, if the sensor is free? The sensor cannot be occupied...
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Global Array

Pioneer
Pioneer

yes, that why i wanted to use a global variable

The transport arrives as sensor..

 

@.stopped:= true

GlobalSensorArray(SensorID) = True

waituntil SensorArray(SensorID + 1) = False

@.stopped:= flase

 

But, I cant make a global variable an array.

 

 

 

Re: Global Array

Legend
Legend

 Hello,

 

you can't use waituntil with table , list and array 

 

And you can't create an user-defined variable of type array, sadly...

 

So you can't do this.

 

 

as a work arround you can create a sensor methode like this

 

param SensorID: integer, Front: boolean

self.~.setAttribute(to_str("sensor",sensorID),true)
if self.~.existsSensorID(sensorID+1)
var sensorName := to_str("sensor",sensorID+1)
execute("waituntil conveyor."+sensorName+" prio 1")
end

end create a boolean for each sensor named sensor1,sensor2,...

 

Regards

 

 

Re: Global Array

Pioneer
Pioneer

Excelllent

Thank you