add new task       

Task ID:  1032  Need to add .NET optional [Input]'s    
 
Created by hol353 on 2009-09-16 4:41 PM, 3078 days ago
Project:  Infrastructure
Category:  Minor
Priority:  high
Assigned to:  hol353  
Status:  closed
Apsim Version:7.1
Your Name:Rogerio Cichota
Contact Details:
Rogerio.Cichota@agresearch.co.nz
 
 

show inline images      show change history

 comment 30838 posted by hol353 on 2009-09-17 10:13 AM, 3077 days ago 
Done. You can use it by another [Input] constructor e.g.

[Input(true)] private double uptake_water_agpasture = null
 comment 30836 posted by hol353 on 2009-09-16 4:41 PM, 3078 days ago 

Hi Dean,

Thanks for you help. But it seems the question of whether it would work at the start of the simulation is negative. I made sure that crop_type is advertised as ‘AgPasture’ and added it to the SWIM crops as well. I the added “[Input] private float[] uptake_water_AgPasture = null” in the declarations. Unfortunately when I run I get the message

     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                      APSIM  Fatal  Error

                      -------------------

     No component responded to a 'get' for variable: uptake_water_AgPasture

     Component name: AgPasture

    

     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

It occurs just at the ‘start of the simulation’.  The initialization seems to happen without problems. Is this what is to be expected with the error you mentioned could occur? And so it means we do not have a work around?…

 

___________________________

Cheers,
Rogerio Cichota

 

 

From: Dean Holzworth [mailto:Dean.Holzworth@csiro.au]
Sent: Wednesday, 16 September 2009 10:58 a.m.
To: Cichota, Rogerio
Subject: Re: Question about ASPIM 7.1

 

Hi Rogerio

Using [Input] is the right thing to do in this case but...

We don't currently support optional input's, so this may or may not work at the start of the simulation until SWIM has initialised itself and run the first timestep. It also won't work unless SWIM is plugged into the simulation.

The name of the variable is "uptake_water_ " and then the value of the "crop_type" [Output] variable that your module returns. SWIM will ask for crop_type to get this value to work out what crop models are running. e.g. if your crop_type is AgPasture then you need to supply an [input] of uptake_water_agpasture.

I'll have a go at getting SWIM and .net modules running properly in the next week or so.

Dean.

Cichota, Rogerio wrote:

Hi Dean,

I got another question, it is related to what Frank has called you for this morning.

To work with SWIM we have to make the plat leave the uptake to SWIM, this is done by setting the parameter “uptake_source” to ‘apsim’ instead of the default ‘calc’. We did this in AgPasture, but then the plant needs to know what is the uptake then. This was done using the “get” method, which seems to be no longer valid. How can I get a value from other module now?  The command before was something like “Get(‘uptake_water_[crop_name]’, (), SWUptake)”, so read the ‘uptake_water_[crop_name]’ from SWIM into ‘SWUptake’. I tried “[Input] private float[] uptake_water_AgPasture”, but got this message:

     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                      APSIM  Fatal  Error

                      -------------------

     No component responded to a 'get' for variable: uptake_water_AgPasture

     Component name: AgPasture

    

     !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

Can you help me with any ideas or I have to wait for Niel?

 

___________________________

Cheers,
Rogerio Cichota