cancel
Showing results for 
Search instead for 
Did you mean: 

An Error

Builder
Builder

An error window poped out when simulation is being as attached. Any reminds what will be the possible issue lead to this error?

 

Will the error from the code:

 

local obj : object := EnergyAnalyzer.EnergyConsumers;

 

I define a local variable "obj" with object type to describe the tablefile of "EnergyConsumers" from EnergyAnalyer. It looks correct.

 

Why the line of "do" is highlighted with orange color (see attachment)? What does this signal mean? 

 

 

 

Thanks.

3 REPLIES

Betreff: An Error

The orange "signal" (and also the error-message at the bottom of the screen) means that your method contains syntax errors.

It would have been more helpful, if you posted the whole source-code of your method as text, instead of a screenshot of some part of the method. But directly the first line after "do" shows that you want to set the value of "a", which is not defined as local variable (you've commented it out above), so that's the (first) syntax error in the method.

Regards,
Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!
This answered your question? Please mark it as "Accepted Solution", thank you!

Betreff: An Error

Builder
Builder

Here is the code:

 

is
i:integer;
a:integer;
--row: integer;
--s: string;
objrow:integer;
objSmiley Surprisedbject;
do
a:=time_to_num(timeofDay(EventController.AbsSimTime))-8*3600; --the simulation begins at 2013/1/1 8:00 am, AbsSimTime is absolute time which equals 0 at 2013/1/1 0:00 am
i:=a//900;

Mytable.SetDataType(1,"real");
Mytable.SetDataType(2,"real");
Mytable.SetDataType(3,"real");
Mytable.SetDataType(4,"real");

Mytable[1,1]:="Time interval";
Mytable[2,1]:="Cumulative Energy Consumption";
Mytable[2,1]:="Energy Consumption each 15-min Interval";
Mytable[3,1]:="Power Demand";

obj:= EnergyAnalyzer.EnergyConsumers;
objrow:=obj.yDim; --the total column number in EnergyConsumer (the number of machines)
Mytable[1,i]:=i; --the index of interval
Mytable[2,i]:=obj.sum ({1,1}..{1,obj.yDim}); --the cumulative energy consumption up to interval i
if i==1 then --the energy consumption of interval 1
Mytabel[3,i]:=Mytable[2,i]
else
Mytabel[3,i]:=Mytable[2,i]-Mytable[2,i-1] --the energy consumptoin of interval 2,3,....
end;
Mytable[4,1]:=Mytable[3,i]*4; --the power demand of interval i
end

Betreff: An Error

Phenom
Phenom

in the last part you need some more ";"

 

if i==1 then --the energy consumption of interval 1
	Mytabel[3,i]:=Mytable[2,i];
else
	Mytabel[3,i]:=Mytable[2,i]-Mytable[2,i-1]; --the energy consumptoin of interval 2,3,....
end;
Mytable[4,1]:=Mytable[3,i]*4; --the power demand of interval i
end;

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